本文整理汇总了PHP中CCrmDeal::CheckFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmDeal::CheckFields方法的具体用法?PHP CCrmDeal::CheckFields怎么用?PHP CCrmDeal::CheckFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmDeal
的用法示例。
在下文中一共展示了CCrmDeal::CheckFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($productRows as &$productRow) {
$productRow['CUSTOMIZED'] = 'Y';
}
unset($productRow);
$result = CCrmProductRow::CalculateTotalInfo('D', 0, false, $fields, $productRows);
$fields['OPPORTUNITY'] = isset($result['OPPORTUNITY']) ? $result['OPPORTUNITY'] : 0.0;
$fields['TAX_VALUE'] = isset($result['TAX_VALUE']) ? $result['TAX_VALUE'] : 0.0;
}
}
$assignedByID = isset($data['ASSIGNED_BY_ID']) ? intval($data['ASSIGNED_BY_ID']) : 0;
if ($assignedByID <= 0) {
$assignedByID = intval($curUser->GetID());
}
$fields['ASSIGNED_BY_ID'] = $assignedByID;
$entity = new CCrmDeal(false);
if (!$entity->CheckFields($fields, !$isNew ? $ID : false, array('DISABLE_USER_FIELD_CHECK' => true))) {
__CrmMobileDealEditEndResonse(array('ERROR' => strip_tags(preg_replace("/<br[^>]*>/", "\n", $entity->LAST_ERROR))));
} else {
//$DB->StartTransaction();
$successed = false;
if ($isNew) {
$ID = $entity->Add($fields, true, array('DISABLE_USER_FIELD_CHECK' => true, 'REGISTER_SONET_EVENT' => true));
$successed = $ID !== false;
} else {
$successed = $entity->Update($ID, $fields, true, true, array('DISABLE_USER_FIELD_CHECK' => true, 'REGISTER_SONET_EVENT' => true));
}
if ($successed && $processProductRows && (!$isNew || !empty($productRows))) {
$successed = CCrmDeal::SaveProductRows($ID, $productRows, false, true, false);
if (!$successed) {
$fields['RESULT_MESSAGE'] = 'Could not save product rows.';
}
示例2: executePhase
public function executePhase()
{
if ($this->currentPhase === QuoteConversionPhase::DEAL_CREATION || $this->currentPhase === QuoteConversionPhase::INVOICE_CREATION) {
if ($this->currentPhase === QuoteConversionPhase::DEAL_CREATION) {
$entityTypeID = \CCrmOwnerType::Deal;
} else {
$entityTypeID = \CCrmOwnerType::Invoice;
}
$entityTypeName = \CCrmOwnerType::ResolveName($entityTypeID);
$config = $this->config->getItem($entityTypeID);
if (!$config->isActive()) {
return false;
}
/** @var \CCrmPerms $permissions */
$permissions = $this->getUserPermissions();
$entityID = isset($this->contextData[$entityTypeName]) ? $this->contextData[$entityTypeName] : 0;
if ($entityID > 0) {
if ($entityTypeID === \CCrmOwnerType::Deal) {
if (!\CCrmDeal::Exists($entityID)) {
throw new EntityConversionException(\CCrmOwnerType::Quote, \CCrmOwnerType::Deal, EntityConversionException::TARG_DST, EntityConversionException::NOT_FOUND);
}
$this->resultData[$entityTypeName] = $entityID;
} else {
if (!\CCrmInvoice::Exists($entityID)) {
throw new EntityConversionException(\CCrmOwnerType::Quote, \CCrmOwnerType::Invoice, EntityConversionException::TARG_DST, EntityConversionException::NOT_FOUND);
}
if (!\CCrmInvoice::CheckUpdatePermission($entityID, $permissions)) {
throw new EntityConversionException(\CCrmOwnerType::Quote, \CCrmOwnerType::Invoice, EntityConversionException::TARG_DST, EntityConversionException::UPDATE_DENIED);
}
$entity = new \CCrmInvoice(false);
$fields = array('UF_QUOTE_ID' => $this->entityID);
try {
$entity->Update($entityID, $fields);
} catch (Main\DB\SqlQueryException $e) {
}
$this->resultData[$entityTypeName] = $entityID;
}
return true;
}
if (!\CCrmAuthorizationHelper::CheckCreatePermission($entityTypeName, $permissions)) {
throw new EntityConversionException(\CCrmOwnerType::Quote, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::CREATE_DENIED);
}
if (UserFieldSynchronizer::needForSynchronization(\CCrmOwnerType::Quote, $entityTypeID)) {
throw new EntityConversionException(\CCrmOwnerType::Quote, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::NOT_SYNCHRONIZED);
}
if (!ConversionSettings::getCurrent()->isAutocreationEnabled()) {
throw new EntityConversionException(\CCrmOwnerType::Quote, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::AUTOCREATION_DISABLED);
}
if ($entityTypeID === \CCrmOwnerType::Deal && \CCrmBizProcHelper::HasAutoWorkflows($entityTypeID, \CCrmBizProcEventType::Create)) {
throw new EntityConversionException(\CCrmOwnerType::Lead, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::HAS_WORKFLOWS);
}
/** @var QuoteConversionMapper $mapper */
$mapper = $this->getMapper();
$map = self::prepareMap($entityTypeID);
$fields = $mapper->map($map);
if (empty($fields)) {
throw new EntityConversionException(\CCrmOwnerType::Quote, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::EMPTY_FIELDS);
}
if ($entityTypeID === \CCrmOwnerType::Deal) {
$entity = new \CCrmDeal(false);
if (!$entity->CheckFields($fields)) {
throw new EntityConversionException(\CCrmOwnerType::Quote, \CCrmOwnerType::Deal, EntityConversionException::TARG_DST, EntityConversionException::INVALID_FIELDS, $entity->LAST_ERROR);
}
$productRows = isset($fields['PRODUCT_ROWS']) && is_array($fields['PRODUCT_ROWS']) ? $fields['PRODUCT_ROWS'] : array();
if (!empty($productRows)) {
$result = \CCrmProductRow::CalculateTotalInfo('D', 0, false, $fields, $productRows);
$fields['OPPORTUNITY'] = isset($result['OPPORTUNITY']) ? $result['OPPORTUNITY'] : 1.0;
$fields['TAX_VALUE'] = isset($result['TAX_VALUE']) ? $result['TAX_VALUE'] : 0.0;
}
$entityID = $entity->Add($fields);
if ($entityID <= 0) {
throw new EntityConversionException(\CCrmOwnerType::Quote, \CCrmOwnerType::Deal, EntityConversionException::TARG_DST, EntityConversionException::CREATE_FAILED, $entity->LAST_ERROR);
}
if (!empty($productRows)) {
\CCrmDeal::SaveProductRows($entityID, $productRows, false, false, false);
}
$this->resultData[\CCrmOwnerType::DealName] = $entityID;
} else {
$entity = new \CCrmInvoice(false);
if (!$entity->CheckFields($fields)) {
throw new EntityConversionException(\CCrmOwnerType::Quote, \CCrmOwnerType::Invoice, EntityConversionException::TARG_DST, EntityConversionException::INVALID_FIELDS, $entity->LAST_ERROR);
}
$entityID = $entity->Add($fields);
if ($entityID <= 0) {
throw new EntityConversionException(\CCrmOwnerType::Quote, \CCrmOwnerType::Invoice, EntityConversionException::TARG_DST, EntityConversionException::CREATE_FAILED, $entity->LAST_ERROR);
}
$this->resultData[\CCrmOwnerType::InvoiceName] = $entityID;
}
return true;
} elseif ($this->currentPhase === DealConversionPhase::FINALIZATION) {
$fields = array();
if (isset($this->resultData[\CCrmOwnerType::DealName])) {
$fields['DEAL_ID'] = $this->resultData[\CCrmOwnerType::DealName];
}
if (!empty($fields)) {
$entity = new \CCrmQuote(false);
$entity->Update($this->entityID, $fields);
}
return true;
}
//.........这里部分代码省略.........
示例3: isset
if (is_array($arSettings)) {
$productRowSettings['ENABLE_DISCOUNT'] = isset($arSettings['ENABLE_DISCOUNT']) ? $arSettings['ENABLE_DISCOUNT'] === 'Y' : false;
$productRowSettings['ENABLE_TAX'] = isset($arSettings['ENABLE_TAX']) ? $arSettings['ENABLE_TAX'] === 'Y' : false;
}
}
unset($productRowSettingsFieldName, $settingsJson, $arSettings);
if (!$bEdit) {
$originatorId = intval($_POST["EXTERNAL_SALE_ID"]);
$originId = intval($_POST["SYNC_ORDER_ID"]);
} else {
$originatorId = intval($arResult['ELEMENT']["ORIGINATOR_ID"]);
$originId = intval($arResult['ELEMENT']["ORIGIN_ID"]);
}
$USER_FIELD_MANAGER->EditFormAddFields(CCrmDeal::$sUFEntityID, $arFields);
$arResult['ERROR_MESSAGE'] = '';
if (!$CCrmDeal->CheckFields($arFields, $bEdit ? $arResult['ELEMENT']['ID'] : false)) {
if (!empty($CCrmDeal->LAST_ERROR)) {
$arResult['ERROR_MESSAGE'] .= $CCrmDeal->LAST_ERROR;
} else {
$arResult['ERROR_MESSAGE'] .= GetMessage('UNKNOWN_ERROR');
}
}
if (($arBizProcParametersValues = $CCrmBizProc->CheckFields($bEdit ? $arResult['ELEMENT']['ID'] : false, false, $arResult['ELEMENT']['ASSIGNED_BY'], $bEdit ? array($arResult['ELEMENT']['ID'] => $arEntityAttr[$arResult['ELEMENT']['ID']]) : null)) === false) {
$arResult['ERROR_MESSAGE'] .= $CCrmBizProc->LAST_ERROR;
}
if (empty($arResult['ERROR_MESSAGE'])) {
$DB->StartTransaction();
$bSuccess = false;
if ($bEdit) {
$bSuccess = $CCrmDeal->Update($arResult['ELEMENT']['ID'], $arFields, true, true, array('REGISTER_SONET_EVENT' => true));
} else {
示例4: GetMessage
$bVarsFromForm = true;
if (!empty($CCrmCompany->LAST_ERROR)) {
$arResult['ERROR_MESSAGE'] .= $CCrmCompany->LAST_ERROR;
} else {
$arResult['ERROR_MESSAGE'] .= GetMessage('UNKNOWN_ERROR') . '<br />';
}
}
/* else if (!$bConvertCompany && $iCompanyId <= 0)
$arResult['ERROR_MESSAGE'] .= GetMessage('CRM_COMPANY_ERROR').'<br />';*/
}
if (!$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'ADD')) {
$CCrmDeal = new CCrmDeal(false);
if ($bConvertDeal) {
$prodJson = isset($_POST['DEAL_PRODUCT_DATA']) ? strval($_POST['DEAL_PRODUCT_DATA']) : '';
$arFields['DEAL']['PRODUCT_ROWS'] = isset($prodJson[0]) ? CUtil::JsObjectToPhp($prodJson, true) : array();
if ($CCrmDeal->CheckFields($arFields['DEAL']) == false) {
$bVarsFromForm = true;
if (!empty($CCrmDeal->LAST_ERROR)) {
$arResult['ERROR_MESSAGE'] .= $CCrmDeal->LAST_ERROR;
} else {
$arResult['ERROR_MESSAGE'] .= GetMessage('UNKNOWN_ERROR') . '<br />';
}
}
}
}
/*
if (!$bConvertCompany && !$bConvertContact && !$bConvertDeal)
{
$arResult['ERROR_MESSAGE'] .= GetMessage('CRM_DEAL_ERROR').'<br />';
$_POST['CONVERT_DEAL'] = 'Y';
}