当前位置: 首页>>代码示例>>PHP>>正文


PHP CCrmContact::CheckFields方法代码示例

本文整理汇总了PHP中CCrmContact::CheckFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmContact::CheckFields方法的具体用法?PHP CCrmContact::CheckFields怎么用?PHP CCrmContact::CheckFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCrmContact的用法示例。


在下文中一共展示了CCrmContact::CheckFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: intval

 if (isset($_POST['ASSIGNED_BY_ID'])) {
     $arFields['ASSIGNED_BY_ID'] = intval(is_array($_POST['ASSIGNED_BY_ID']) ? $_POST['ASSIGNED_BY_ID'][0] : $_POST['ASSIGNED_BY_ID']);
 }
 if (isset($_POST['CONFM'])) {
     $arFields['FM'] = $_POST['CONFM'];
 }
 if (isset($_POST['BIRTHDATE'])) {
     $arFields['BIRTHDATE'] = $_POST['BIRTHDATE'];
 }
 $USER_FIELD_MANAGER->EditFormAddFields(CCrmContact::$sUFEntityID, $arFields);
 $originID = isset($_REQUEST['origin_id']) ? $_REQUEST['origin_id'] : '';
 if ($originID !== '') {
     $arFields['ORIGIN_ID'] = $originID;
 }
 $arResult['ERROR_MESSAGE'] = '';
 if (!$CCrmContact->CheckFields($arFields, $isEditMode ? $arResult['ELEMENT']['ID'] : false)) {
     if (!empty($CCrmContact->LAST_ERROR)) {
         $arResult['ERROR_MESSAGE'] .= $CCrmContact->LAST_ERROR;
     } else {
         $arResult['ERROR_MESSAGE'] .= GetMessage('UNKNOWN_ERROR');
     }
 }
 if ($arBizProcParametersValues = $CCrmBizProc->CheckFields($isEditMode ? $arResult['ELEMENT']['ID'] : false, false, $arResult['ELEMENT']['ASSIGNED_BY'], $isEditMode ? array($arResult['ELEMENT']['ID'] => $arEntityAttr[$arResult['ELEMENT']['ID']]) : null) === false) {
     $arResult['ERROR_MESSAGE'] .= $CCrmBizProc->LAST_ERROR;
 }
 if (empty($arResult['ERROR_MESSAGE'])) {
     $DB->StartTransaction();
     $success = false;
     if ($isEditMode) {
         $success = $CCrmContact->Update($arResult['ELEMENT']['ID'], $arFields, true, true, array('REGISTER_SONET_EVENT' => true));
     } else {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例2: executePhase

 public function executePhase()
 {
     if ($this->currentPhase === LeadConversionPhase::COMPANY_CREATION || $this->currentPhase === LeadConversionPhase::CONTACT_CREATION || $this->currentPhase === LeadConversionPhase::DEAL_CREATION) {
         if ($this->currentPhase === LeadConversionPhase::COMPANY_CREATION) {
             $entityTypeID = \CCrmOwnerType::Company;
         } elseif ($this->currentPhase === LeadConversionPhase::CONTACT_CREATION) {
             $entityTypeID = \CCrmOwnerType::Contact;
         } else {
             $entityTypeID = \CCrmOwnerType::Deal;
         }
         $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::Company) {
                 if (!\CCrmCompany::Exists($entityID)) {
                     throw new EntityConversionException(\CCrmOwnerType::Lead, \CCrmOwnerType::Company, EntityConversionException::TARG_DST, EntityConversionException::NOT_FOUND);
                 }
                 $entity = new \CCrmCompany(false);
             } elseif ($entityTypeID === \CCrmOwnerType::Contact) {
                 if (!\CCrmContact::Exists($entityID)) {
                     throw new EntityConversionException(\CCrmOwnerType::Lead, \CCrmOwnerType::Contact, EntityConversionException::TARG_DST, EntityConversionException::NOT_FOUND);
                 }
                 $entity = new \CCrmContact(false);
             } else {
                 if (!\CCrmDeal::Exists($entityID)) {
                     throw new EntityConversionException(\CCrmOwnerType::Lead, \CCrmOwnerType::Deal, EntityConversionException::TARG_DST, EntityConversionException::NOT_FOUND);
                 }
                 $entity = new \CCrmDeal(false);
             }
             if (!\CCrmAuthorizationHelper::CheckUpdatePermission($entityTypeName, $entityID, $permissions)) {
                 throw new EntityConversionException(\CCrmOwnerType::Lead, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::UPDATE_DENIED);
             }
             $fields = array('LEAD_ID' => $this->entityID);
             $entity->Update($entityID, $fields);
             $this->resultData[$entityTypeName] = $entityID;
             return true;
         }
         if (!\CCrmAuthorizationHelper::CheckCreatePermission($entityTypeName, $permissions)) {
             throw new EntityConversionException(\CCrmOwnerType::Lead, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::CREATE_DENIED);
         }
         if (UserFieldSynchronizer::needForSynchronization(\CCrmOwnerType::Lead, $entityTypeID)) {
             throw new EntityConversionException(\CCrmOwnerType::Lead, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::NOT_SYNCHRONIZED);
         }
         if (!ConversionSettings::getCurrent()->isAutocreationEnabled()) {
             throw new EntityConversionException(\CCrmOwnerType::Lead, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::AUTOCREATION_DISABLED);
         }
         if (\CCrmBizProcHelper::HasAutoWorkflows($entityTypeID, \CCrmBizProcEventType::Create)) {
             throw new EntityConversionException(\CCrmOwnerType::Lead, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::HAS_WORKFLOWS);
         }
         /** @var LeadConversionMapper $mapper */
         $mapper = $this->getMapper();
         $map = self::prepareMap($entityTypeID);
         $fields = $mapper->map($map);
         if (empty($fields)) {
             throw new EntityConversionException(\CCrmOwnerType::Lead, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::EMPTY_FIELDS);
         }
         if ($entityTypeID === \CCrmOwnerType::Company) {
             $entity = new \CCrmCompany(false);
             $entityID = $entity->Add($fields);
             if ($entityID <= 0) {
                 throw new EntityConversionException(\CCrmOwnerType::Lead, \CCrmOwnerType::Company, EntityConversionException::TARG_DST, EntityConversionException::CREATE_FAILED, $entity->LAST_ERROR);
             }
             //region BizProcess
             $arErrors = array();
             \CCrmBizProcHelper::AutoStartWorkflows(\CCrmOwnerType::Company, $entityID, \CCrmBizProcEventType::Create, $arErrors);
             //endregion
             $this->resultData[\CCrmOwnerType::CompanyName] = $entityID;
         } elseif ($entityTypeID === \CCrmOwnerType::Contact) {
             if (isset($this->resultData[\CCrmOwnerType::CompanyName])) {
                 $fields['COMPANY_ID'] = $this->resultData[\CCrmOwnerType::CompanyName];
             }
             $entity = new \CCrmContact(false);
             if (!$entity->CheckFields($fields)) {
                 throw new EntityConversionException(\CCrmOwnerType::Lead, $entityTypeID, EntityConversionException::TARG_DST, EntityConversionException::INVALID_FIELDS, $entity->LAST_ERROR);
             }
             $entityID = $entity->Add($fields);
             if ($entityID <= 0) {
                 throw new EntityConversionException(\CCrmOwnerType::Lead, \CCrmOwnerType::Contact, EntityConversionException::TARG_DST, EntityConversionException::CREATE_FAILED, $entity->LAST_ERROR);
             }
             //region BizProcess
             $arErrors = array();
             \CCrmBizProcHelper::AutoStartWorkflows(\CCrmOwnerType::Contact, $entityID, \CCrmBizProcEventType::Create, $arErrors);
             //endregion
             $this->resultData[\CCrmOwnerType::ContactName] = $entityID;
         } else {
             if (isset($this->resultData[\CCrmOwnerType::ContactName])) {
                 $fields['CONTACT_ID'] = $this->resultData[\CCrmOwnerType::ContactName];
             }
             if (isset($this->resultData[\CCrmOwnerType::CompanyName])) {
                 $fields['COMPANY_ID'] = $this->resultData[\CCrmOwnerType::CompanyName];
             }
             $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);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:leadconverter.php

示例3: CCrmContact

         if ($currentPhotoID > 0) {
             $allowedFileIDs[] = $currentPhotoID;
         }
     }
     if (!in_array($photoID, $allowedFileIDs, true)) {
         $photoID = 0;
     }
 }
 if ($photoID > 0) {
     $fields['PHOTO'] = $photoID;
 }
 if (isset($data['FM']) && is_array($data['FM']) && !empty($data['FM'])) {
     $fields['FM'] = $data['FM'];
 }
 $entity = new CCrmContact(false);
 if (!$entity->CheckFields($fields, !$isNew ? $ID : false, array('DISABLE_USER_FIELD_CHECK' => true))) {
     __CrmMobileContactEditEndResonse(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) {
         //$DB->Commit();
         $errors = array();
         CCrmBizProcHelper::AutoStartWorkflows(CCrmOwnerType::Contact, $ID, $isNew ? CCrmBizProcEventType::Create : CCrmBizProcEventType::Edit, $errors);
         $dbRes = CCrmContact::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php

示例4: trim

     $arFields['COMPANY']['REG_ADDRESS_REGION'] = trim($_POST['COMPANY_REG_ADDRESS_REGION']);
 }
 if (isset($_POST['COMPANY_REG_ADDRESS_PROVINCE'])) {
     $arFields['COMPANY']['REG_ADDRESS_PROVINCE'] = trim($_POST['COMPANY_REG_ADDRESS_PROVINCE']);
 }
 if (isset($_POST['COMPANY_REG_ADDRESS_COUNTRY'])) {
     $arFields['COMPANY']['REG_ADDRESS_COUNTRY'] = trim($_POST['COMPANY_REG_ADDRESS_COUNTRY']);
 }
 if (isset($_POST['COMPANY_REG_ADDRESS_COUNTRY_CODE'])) {
     $arFields['COMPANY']['REG_ADDRESS_COUNTRY_CODE'] = trim($_POST['COMPANY_REG_ADDRESS_COUNTRY_CODE']);
 }
 $iCompanyId = (int) (is_array($arFields['COMPANY']['COMPANY_ID']) ? $arFields['COMPANY']['COMPANY_ID'][0] : (!empty($arFields['COMPANY']['COMPANY_ID']) ? $arFields['COMPANY']['COMPANY_ID'] : 0));
 $iContactId = (int) (is_array($arFields['CONTACT']['CONTACT_ID']) ? $arFields['CONTACT']['CONTACT_ID'][0] : (!empty($arFields['CONTACT']['CONTACT_ID']) ? $arFields['CONTACT']['CONTACT_ID'] : 0));
 $arResult['ERROR_MESSAGE'] = '';
 $CCrmContact = new CCrmContact(false);
 if ($bConvertContact && $CCrmContact->CheckFields($arFields['CONTACT']) == false) {
     $bVarsFromForm = true;
     if (!empty($CCrmContact->LAST_ERROR)) {
         $arResult['ERROR_MESSAGE'] .= $CCrmContact->LAST_ERROR;
     } else {
         $arResult['ERROR_MESSAGE'] .= GetMessage('UNKNOWN_ERROR') . '<br />';
     }
 } else {
     if (!$bConvertContact && $iContactId <= 0) {
         $arResult['ERROR_MESSAGE'] .= GetMessage('CRM_CONTACT_ERROR') . '<br />';
     }
 }
 if (!$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'ADD')) {
     $CCrmCompany = new CCrmCompany(false);
     if ($bConvertCompany && empty($arResult['ERROR_MESSAGE']) && $CCrmCompany->CheckFields($arFields['COMPANY']) == false) {
         $bVarsFromForm = true;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


注:本文中的CCrmContact::CheckFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。