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


PHP CCrmFieldMulti::SetFields方法代码示例

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


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

示例1: Update


//.........这里部分代码省略.........
                     $arEvent['USER_ID'] = $iUserId;
                 }
                 $CCrmEvent = new CCrmEvent();
                 $eventID = $CCrmEvent->Add($arEvent, $this->bCheckPermission);
             }
         }
         // Calculation of Account Data
         $accData = CCrmAccountingHelper::PrepareAccountingData(array('CURRENCY_ID' => isset($arFields['CURRENCY_ID']) ? $arFields['CURRENCY_ID'] : (isset($arRow['CURRENCY_ID']) ? $arRow['CURRENCY_ID'] : null), 'SUM' => isset($arFields['OPPORTUNITY']) ? $arFields['OPPORTUNITY'] : (isset($arRow['OPPORTUNITY']) ? $arRow['OPPORTUNITY'] : null), 'EXCH_RATE' => isset($arFields['EXCH_RATE']) ? $arFields['EXCH_RATE'] : (isset($arRow['EXCH_RATE']) ? $arRow['EXCH_RATE'] : null)));
         if (is_array($accData)) {
             $arFields['ACCOUNT_CURRENCY_ID'] = $accData['ACCOUNT_CURRENCY_ID'];
             $arFields['OPPORTUNITY_ACCOUNT'] = $accData['ACCOUNT_SUM'];
         }
         $accData = CCrmAccountingHelper::PrepareAccountingData(array('CURRENCY_ID' => isset($arFields['CURRENCY_ID']) ? $arFields['CURRENCY_ID'] : (isset($arRow['CURRENCY_ID']) ? $arRow['CURRENCY_ID'] : null), 'SUM' => isset($arFields['TAX_VALUE']) ? $arFields['TAX_VALUE'] : (isset($arRow['TAX_VALUE']) ? $arRow['TAX_VALUE'] : null), 'EXCH_RATE' => isset($arFields['EXCH_RATE']) ? $arFields['EXCH_RATE'] : (isset($arRow['EXCH_RATE']) ? $arRow['EXCH_RATE'] : null)));
         if (is_array($accData)) {
             $arFields['TAX_VALUE_ACCOUNT'] = $accData['ACCOUNT_SUM'];
         }
         if (isset($arFields['STATUS_ID'])) {
             $arFields['CLOSED'] = self::GetStatusSemantics($arFields['STATUS_ID']) === 'process' ? 'N' : 'Y';
         }
         if (isset($arFields['BEGINDATE']) && !isset($arFields['BEGINDATE'][0])) {
             unset($arFields['BEGINDATE']);
         }
         if (isset($arFields['CLOSED']) && $arFields['CLOSED'] === 'Y' && (!isset($arFields['CLOSEDATE']) || $arFields['CLOSEDATE'] === '')) {
             $arFields['CLOSEDATE'] = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'FULL', SITE_ID);
         }
         if (!isset($arFields['ID'])) {
             $arFields['ID'] = $ID;
         }
         foreach (GetModuleEvents('crm', 'OnBeforeCrmQuoteUpdate', true) as $arEvent) {
             if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
                 if (isset($arFields['RESULT_MESSAGE'])) {
                     $this->LAST_ERROR = $arFields['RESULT_MESSAGE'];
                 } else {
                     $this->LAST_ERROR = GetMessage('CRM_QUOTE_UPDATE_CANCELED', array('#NAME#' => $arEvent['TO_NAME']));
                     $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
                 }
                 return false;
             }
         }
         unset($arFields['ID']);
         $sUpdate = $DB->PrepareUpdate('b_crm_quote', $arFields);
         if (strlen($sUpdate) > 0) {
             $clobFieldNames = array('COMMENTS', 'CONTENT', 'STORAGE_ELEMENT_IDS');
             $arBinds = array();
             foreach ($clobFieldNames as $fieldName) {
                 if (array_key_exists($fieldName, $arFields)) {
                     $arBinds[$fieldName] = $arFields[$fieldName];
                 }
             }
             unset($fieldName);
             $sql = "UPDATE b_crm_quote SET {$sUpdate} WHERE ID = {$ID}";
             if (!empty($arBinds)) {
                 $DB->QueryBind($sql, $arBinds, false);
             } else {
                 $DB->Query($sql, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
             }
             $bResult = true;
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             static $arNameFields = array("TITLE");
             $bClear = false;
             foreach ($arNameFields as $val) {
                 if (isset($arFields[$val])) {
                     $bClear = true;
                     break;
                 }
             }
             if ($bClear) {
                 $GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Quote . "_" . $ID);
             }
         }
         CCrmPerms::UpdateEntityAttr('QUOTE', $ID, $arEntityAttr);
         CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
         $GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $ID, $arFields);
         if (is_array($storageElementIDs)) {
             CCrmQuote::DoSaveElementIDs($ID, $storageTypeID, $storageElementIDs);
         }
         unset($storageTypeID, $storageElementIDs);
         if ($bUpdateSearch) {
             $arFilterTmp = array('ID' => $ID);
             if (!$this->bCheckPermission) {
                 $arFilterTmp["CHECK_PERMISSIONS"] = "N";
             }
             CCrmSearch::UpdateSearch($arFilterTmp, 'QUOTE', true);
         }
         $arFields['ID'] = $ID;
         if (isset($arFields['FM']) && is_array($arFields['FM'])) {
             $CCrmFieldMulti = new CCrmFieldMulti();
             $CCrmFieldMulti->SetFields('QUOTE', $ID, $arFields['FM']);
         }
         // Responsible user sync
         //CCrmActivity::Synchronize(CCrmOwnerType::Quote, $ID);
         if ($bResult) {
             foreach (GetModuleEvents('crm', 'OnAfterCrmQuoteUpdate', true) as $arEvent) {
                 ExecuteModuleEventEx($arEvent, array(&$arFields));
             }
         }
     }
     return $bResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_quote.php

示例2: Update


//.........这里部分代码省略.........
                 if (isset($arFields[$val])) {
                     $bClear = true;
                     break;
                 }
             }
             if ($bClear) {
                 $GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Deal . "_" . $ID);
             }
         }
         CCrmPerms::UpdateEntityAttr('DEAL', $ID, $arEntityAttr);
         CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
         $GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $ID, $arFields);
         //Statistics & History -->
         $currentDbResult = \CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
         $currentFields = $currentDbResult->Fetch();
         Bitrix\Crm\Statistics\DealSumStatisticEntry::register($ID, $currentFields);
         Bitrix\Crm\History\DealStageHistoryEntry::synchronize($ID, $currentFields);
         Bitrix\Crm\Statistics\DealInvoiceStatisticEntry::synchronize($ID, $currentFields);
         Bitrix\Crm\Statistics\DealActivityStatisticEntry::synchronize($ID, $currentFields);
         if (isset($arFields['STAGE_ID'])) {
             Bitrix\Crm\History\DealStageHistoryEntry::register($ID, $arFields, array('IS_NEW' => false));
         }
         //<-- Statistics & History
         if ($bUpdateSearch) {
             $arFilterTmp = array('ID' => $ID);
             if (!$this->bCheckPermission) {
                 $arFilterTmp['CHECK_PERMISSIONS'] = 'N';
             }
             CCrmSearch::UpdateSearch($arFilterTmp, 'DEAL', true);
         }
         $arFields['ID'] = $ID;
         if (isset($arFields['FM']) && is_array($arFields['FM'])) {
             $CCrmFieldMulti = new CCrmFieldMulti();
             $CCrmFieldMulti->SetFields('DEAL', $ID, $arFields['FM']);
         }
         // Responsible user sync
         //CCrmActivity::Synchronize(CCrmOwnerType::Deal, $ID);
         $registerSonetEvent = isset($options['REGISTER_SONET_EVENT']) && $options['REGISTER_SONET_EVENT'] === true;
         if ($bResult && isset($arFields['ASSIGNED_BY_ID'])) {
             CCrmSonetSubscription::ReplaceSubscriptionByEntity(CCrmOwnerType::Deal, $ID, CCrmSonetSubscriptionType::Responsibility, $arFields['ASSIGNED_BY_ID'], $arRow['ASSIGNED_BY_ID'], $registerSonetEvent);
         }
         if ($bResult && $bCompare && $registerSonetEvent && !empty($sonetEventData)) {
             //CONTACT
             $newContactID = isset($arFields['CONTACT_ID']) ? intval($arFields['CONTACT_ID']) : 0;
             $oldContactID = isset($arRow['CONTACT_ID']) ? intval($arRow['CONTACT_ID']) : 0;
             $contactID = $newContactID > 0 ? $newContactID : $oldContactID;
             //COMPANY
             $newCompanyID = isset($arFields['COMPANY_ID']) ? intval($arFields['COMPANY_ID']) : 0;
             $oldCompanyID = isset($arRow['COMPANY_ID']) ? intval($arRow['COMPANY_ID']) : 0;
             $companyID = $newCompanyID > 0 ? $newCompanyID : $oldCompanyID;
             $modifiedByID = intval($arFields['MODIFY_BY_ID']);
             foreach ($sonetEventData as &$sonetEvent) {
                 $sonetEventType = $sonetEvent['TYPE'];
                 $sonetEventCode = isset($sonetEvent['CODE']) ? $sonetEvent['CODE'] : '';
                 $sonetEventFields =& $sonetEvent['FIELDS'];
                 $sonetEventFields['ENTITY_TYPE_ID'] = CCrmOwnerType::Deal;
                 $sonetEventFields['ENTITY_ID'] = $ID;
                 $sonetEventFields['USER_ID'] = $modifiedByID;
                 //Register contact & company relations
                 if ($sonetEventCode === 'CLIENT') {
                     $sonetEventFields['PARENTS'] = array();
                     //If contact changed bind events to old and new contacts
                     if ($oldContactID !== $newContactID) {
                         if ($oldContactID > 0) {
                             $sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $oldContactID);
                         }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:67,代码来源:crm_deal.php

示例3: Update


//.........这里部分代码省略.........
                     $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
                 }
                 return false;
             }
         }
         $sUpdate = $DB->PrepareUpdate('b_crm_company', $arFields, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
         if (strlen($sUpdate) > 0) {
             $DB->Query("UPDATE b_crm_company SET {$sUpdate} WHERE ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
             $bResult = true;
             $newTitle = isset($arFields['TITLE']) ? $arFields['TITLE'] : '';
             $oldTitle = isset($arRow['TITLE']) ? $arRow['TITLE'] : '';
             if ($newTitle !== '' && $newTitle !== $oldTitle) {
                 \Bitrix\Crm\Integrity\DuplicateOrganizationCriterion::register(CCrmOwnerType::Company, $ID, $newTitle);
             }
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             static $arNameFields = array("TITLE");
             $bClear = false;
             foreach ($arNameFields as $val) {
                 if (isset($arFields[$val])) {
                     $bClear = true;
                     break;
                 }
             }
             if ($bClear) {
                 $GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Company . "_" . $ID);
             }
         }
         CCrmPerms::UpdateEntityAttr('COMPANY', $ID, $arEntityAttr);
         CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
         $GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $ID, $arFields);
         if (isset($arFields['FM']) && is_array($arFields['FM'])) {
             $CCrmFieldMulti = new CCrmFieldMulti();
             $CCrmFieldMulti->SetFields('COMPANY', $ID, $arFields['FM']);
             \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Company, $ID, 'EMAIL', \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($arFields['FM'], 'EMAIL'));
             \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Company, $ID, 'PHONE', \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($arFields['FM'], 'PHONE'));
         }
         \Bitrix\Crm\Integrity\DuplicateEntityRanking::registerEntityStatistics(CCrmOwnerType::Company, $ID, array_merge($arRow, $arFields));
         if ($bUpdateSearch) {
             CCrmSearch::UpdateSearch(array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), 'COMPANY', true);
         }
         $arFields['ID'] = $ID;
         if (isset($arFields['CONTACT_ID']) && is_array($arFields['CONTACT_ID'])) {
             if (!empty($arFields['CONTACT_ID'])) {
                 $arCurrentContact = array();
                 $res = CCrmContact::GetContactByCompanyId($arFields['ID']);
                 while ($ar = $res->Fetch()) {
                     $arCurrentContact[] = $ar['ID'];
                 }
                 $arAdd = array_diff($arFields['CONTACT_ID'], $arCurrentContact);
                 $arDelete = array_diff($arCurrentContact, $arFields['CONTACT_ID']);
                 $CCrmContact = new CCrmContact();
                 $CCrmContact->UpdateCompanyId($arAdd, $arFields['ID']);
                 $CCrmContact->UpdateCompanyId($arDelete, 0);
                 if (isset($GLOBALS["USER"])) {
                     if (!class_exists('CUserOptions')) {
                         include_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . $GLOBALS['DBType'] . "/favorites.php";
                     }
                     CUserOptions::SetOption("crm", "crm_contact_search", array('last_selected' => implode(',', $arAdd)));
                 }
             } else {
                 $arDelete = array();
                 $res = CCrmContact::GetContactByCompanyId($arFields['ID']);
                 while ($ar = $res->Fetch()) {
                     $arDelete[] = $ar['ID'];
                 }
开发者ID:konvita2,项目名称:portal,代码行数:67,代码来源:crm_company.php

示例4: Update


//.........这里部分代码省略.........
             $arRes = $dbRes->Fetch();
             $arFields['FULL_NAME'] = trim((isset($arFields['NAME']) ? $arFields['NAME'] : $arRes['NAME']) . ' ' . (isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : $arRes['LAST_NAME']));
         }
         $sUpdate = $DB->PrepareUpdate('b_crm_lead', $arFields, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
         if (strlen($sUpdate) > 0) {
             $DB->Query("UPDATE b_crm_lead SET {$sUpdate} WHERE ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
             if (isset($arFields['COMPANY_TITLE'])) {
                 $newCompanyTitle = $arFields['COMPANY_TITLE'];
                 $oldCompanyTitle = isset($arRow['COMPANY_TITLE']) ? $arRow['COMPANY_TITLE'] : '';
                 if ($newCompanyTitle !== $oldCompanyTitle) {
                     \Bitrix\Crm\Integrity\DuplicateOrganizationCriterion::register(CCrmOwnerType::Lead, $ID, $newCompanyTitle);
                 }
             }
             if (isset($arFields['LAST_NAME']) || isset($arFields['NAME']) || isset($arFields['SECOND_NAME'])) {
                 $lastName = isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : (isset($arRow['LAST_NAME']) ? $arRow['LAST_NAME'] : '');
                 $name = isset($arFields['NAME']) ? $arFields['NAME'] : (isset($arRow['NAME']) ? $arRow['NAME'] : '');
                 $secondName = isset($arFields['SECOND_NAME']) ? $arFields['SECOND_NAME'] : (isset($arRow['SECOND_NAME']) ? $arRow['SECOND_NAME'] : '');
                 \Bitrix\Crm\Integrity\DuplicatePersonCriterion::register(CCrmOwnerType::Lead, $ID, $lastName, $name, $secondName);
             }
             $bResult = true;
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             static $arNameFields = array("TITLE");
             $bClear = false;
             foreach ($arNameFields as $val) {
                 if (isset($arFields[$val])) {
                     $bClear = true;
                     break;
                 }
             }
             if ($bClear) {
                 $GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Lead . "_" . $ID);
             }
         }
         CCrmPerms::UpdateEntityAttr('LEAD', $ID, $arEntityAttr);
         if (isset($arFields['ADDRESS']) || isset($arFields['ADDRESS_2']) || isset($arFields['ADDRESS_CITY']) || isset($arFields['ADDRESS_POSTAL_CODE']) || isset($arFields['ADDRESS_REGION']) || isset($arFields['ADDRESS_PROVINCE']) || isset($arFields['ADDRESS_COUNTRY'])) {
             \Bitrix\Crm\EntityAddress::register(CCrmOwnerType::Lead, $ID, \Bitrix\Crm\EntityAddress::Primary, array('ADDRESS_1' => isset($arFields['ADDRESS']) ? $arFields['ADDRESS'] : (isset($arRow['ADDRESS']) ? $arRow['ADDRESS'] : null), 'ADDRESS_2' => isset($arFields['ADDRESS_2']) ? $arFields['ADDRESS_2'] : (isset($arRow['ADDRESS_2']) ? $arRow['ADDRESS_2'] : null), 'CITY' => isset($arFields['ADDRESS_CITY']) ? $arFields['ADDRESS_CITY'] : (isset($arRow['ADDRESS_CITY']) ? $arRow['ADDRESS_CITY'] : null), 'POSTAL_CODE' => isset($arFields['ADDRESS_POSTAL_CODE']) ? $arFields['ADDRESS_POSTAL_CODE'] : (isset($arRow['ADDRESS_POSTAL_CODE']) ? $arRow['ADDRESS_POSTAL_CODE'] : null), 'REGION' => isset($arFields['ADDRESS_REGION']) ? $arFields['ADDRESS_REGION'] : (isset($arRow['ADDRESS_REGION']) ? $arRow['ADDRESS_REGION'] : null), 'PROVINCE' => isset($arFields['ADDRESS_PROVINCE']) ? $arFields['ADDRESS_PROVINCE'] : (isset($arRow['ADDRESS_PROVINCE']) ? $arRow['ADDRESS_PROVINCE'] : null), 'COUNTRY' => isset($arFields['ADDRESS_COUNTRY']) ? $arFields['ADDRESS_COUNTRY'] : (isset($arRow['ADDRESS_COUNTRY']) ? $arRow['ADDRESS_COUNTRY'] : null), 'COUNTRY_CODE' => isset($arFields['ADDRESS_COUNTRY_CODE']) ? $arFields['ADDRESS_COUNTRY_CODE'] : (isset($arRow['ADDRESS_COUNTRY_CODE']) ? $arRow['ADDRESS_COUNTRY_CODE'] : null)));
         }
         CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
         $GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $ID, $arFields);
         if (isset($arFields['FM']) && is_array($arFields['FM'])) {
             $CCrmFieldMulti = new CCrmFieldMulti();
             $CCrmFieldMulti->SetFields(CCrmOwnerType::LeadName, $ID, $arFields['FM']);
             $multifields = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::prepareEntityMultifieldsValues(CCrmOwnerType::Lead, $ID);
             \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Lead, $ID, 'EMAIL', \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($multifields, 'EMAIL'));
             \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Lead, $ID, 'PHONE', \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($multifields, 'PHONE'));
         }
         \Bitrix\Crm\Integrity\DuplicateEntityRanking::registerEntityStatistics(CCrmOwnerType::Lead, $ID, array_merge($arRow, $arFields));
         if ($bUpdateSearch) {
             CCrmSearch::UpdateSearch(array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), 'LEAD', true);
         }
         $arFields['ID'] = $ID;
         // Responsible user sync
         //CCrmActivity::Synchronize(CCrmOwnerType::Lead, $ID);
         // Sonet events registration
         $registerSonetEvent = isset($arOptions['REGISTER_SONET_EVENT']) && $arOptions['REGISTER_SONET_EVENT'] === true;
         if ($bResult && isset($arFields['ASSIGNED_BY_ID'])) {
             CCrmSonetSubscription::ReplaceSubscriptionByEntity(CCrmOwnerType::Lead, $ID, CCrmSonetSubscriptionType::Responsibility, $arFields['ASSIGNED_BY_ID'], $arRow['ASSIGNED_BY_ID'], $registerSonetEvent);
         }
         if ($bResult && $bCompare && $registerSonetEvent && !empty($sonetEventData)) {
             $modifiedByID = intval($arFields['MODIFY_BY_ID']);
             foreach ($sonetEventData as &$sonetEvent) {
                 $sonetEventFields =& $sonetEvent['FIELDS'];
                 $sonetEventFields['ENTITY_TYPE_ID'] = CCrmOwnerType::Lead;
                 $sonetEventFields['ENTITY_ID'] = $ID;
                 $sonetEventFields['USER_ID'] = $modifiedByID;
                 $logEventID = CCrmLiveFeed::CreateLogEvent($sonetEventFields, $sonetEvent['TYPE']);
                 if ($logEventID && CModule::IncludeModule("im")) {
                     $url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Lead, $ID);
                     $serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
                     if ($sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'] != $modifiedByID && $sonetEvent['TYPE'] == CCrmLiveFeedEvent::Responsible) {
                         $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "lead_update", "NOTIFY_TAG" => "CRM|LEAD_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_LEAD_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_LEAD_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']))) . " (" . $serverName . $url . ")");
                         CIMNotify::Add($arMessageFields);
                     }
                     if ($sonetEvent['TYPE'] == CCrmLiveFeedEvent::Responsible && $sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'] != $modifiedByID) {
                         $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "lead_update", "NOTIFY_TAG" => "CRM|LEAD_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_LEAD_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_LEAD_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']))) . " (" . $serverName . $url . ")");
                         CIMNotify::Add($arMessageFields);
                     }
                     if ($sonetEvent['TYPE'] == CCrmLiveFeedEvent::Progress && $sonetEventFields['PARAMS']['START_STATUS_ID'] && $sonetEventFields['PARAMS']['FINAL_STATUS_ID']) {
                         $assignedByID = isset($arFields['ASSIGNED_BY_ID']) ? $arFields['ASSIGNED_BY_ID'] : $arRow['ASSIGNED_BY_ID'];
                         $infos = CCrmStatus::GetStatus('STATUS');
                         if ($assignedByID != $modifiedByID && array_key_exists($sonetEventFields['PARAMS']['START_STATUS_ID'], $infos) && array_key_exists($sonetEventFields['PARAMS']['FINAL_STATUS_ID'], $infos)) {
                             $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $assignedByID, "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "lead_update", "NOTIFY_TAG" => "CRM|LEAD_PROGRESS|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_LEAD_PROGRESS_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>", "#start_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['START_STATUS_ID']]['NAME']), "#final_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['FINAL_STATUS_ID']]['NAME']))), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_LEAD_PROGRESS_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']), "#start_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['START_STATUS_ID']]['NAME']), "#final_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['FINAL_STATUS_ID']]['NAME']))) . " (" . $serverName . $url . ")");
                             CIMNotify::Add($arMessageFields);
                         }
                     }
                 }
                 unset($sonetEventFields);
             }
             unset($sonetEvent);
         }
         if ($bResult) {
             $afterEvents = GetModuleEvents('crm', 'OnAfterCrmLeadUpdate');
             while ($arEvent = $afterEvents->Fetch()) {
                 ExecuteModuleEventEx($arEvent, array(&$arFields));
             }
         }
     }
     return $bResult;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:crm_lead.php

示例5: Update


//.........这里部分代码省略.........
         unset($arFields['ID']);
         $sUpdate = $DB->PrepareUpdate('b_crm_contact', $arFields, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
         if (strlen($sUpdate) > 0) {
             $bResult = true;
             $DB->Query("UPDATE b_crm_contact SET {$sUpdate} WHERE ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
             if (isset($arFields['LAST_NAME']) || isset($arFields['NAME']) || isset($arFields['SECOND_NAME'])) {
                 $lastName = isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : (isset($arRow['LAST_NAME']) ? $arRow['LAST_NAME'] : '');
                 $name = isset($arFields['NAME']) ? $arFields['NAME'] : (isset($arRow['NAME']) ? $arRow['NAME'] : '');
                 $secondName = isset($arFields['SECOND_NAME']) ? $arFields['SECOND_NAME'] : (isset($arRow['SECOND_NAME']) ? $arRow['SECOND_NAME'] : '');
                 \Bitrix\Crm\Integrity\DuplicatePersonCriterion::register(CCrmOwnerType::Contact, $ID, $lastName, $name, $secondName);
             }
         }
         CCrmPerms::UpdateEntityAttr('CONTACT', $ID, $arEntityAttr);
         if (isset($arFields['ADDRESS']) || isset($arFields['ADDRESS_2']) || isset($arFields['ADDRESS_CITY']) || isset($arFields['ADDRESS_POSTAL_CODE']) || isset($arFields['ADDRESS_REGION']) || isset($arFields['ADDRESS_PROVINCE']) || isset($arFields['ADDRESS_COUNTRY'])) {
             \Bitrix\Crm\EntityAddress::register(CCrmOwnerType::Contact, $ID, \Bitrix\Crm\EntityAddress::Primary, array('ADDRESS_1' => isset($arFields['ADDRESS']) ? $arFields['ADDRESS'] : (isset($arRow['ADDRESS']) ? $arRow['ADDRESS'] : null), 'ADDRESS_2' => isset($arFields['ADDRESS_2']) ? $arFields['ADDRESS_2'] : (isset($arRow['ADDRESS_2']) ? $arRow['ADDRESS_2'] : null), 'CITY' => isset($arFields['ADDRESS_CITY']) ? $arFields['ADDRESS_CITY'] : (isset($arRow['ADDRESS_CITY']) ? $arRow['ADDRESS_CITY'] : null), 'POSTAL_CODE' => isset($arFields['ADDRESS_POSTAL_CODE']) ? $arFields['ADDRESS_POSTAL_CODE'] : (isset($arRow['ADDRESS_POSTAL_CODE']) ? $arRow['ADDRESS_POSTAL_CODE'] : null), 'REGION' => isset($arFields['ADDRESS_REGION']) ? $arFields['ADDRESS_REGION'] : (isset($arRow['ADDRESS_REGION']) ? $arRow['ADDRESS_REGION'] : null), 'PROVINCE' => isset($arFields['ADDRESS_PROVINCE']) ? $arFields['ADDRESS_PROVINCE'] : (isset($arRow['ADDRESS_PROVINCE']) ? $arRow['ADDRESS_PROVINCE'] : null), 'COUNTRY' => isset($arFields['ADDRESS_COUNTRY']) ? $arFields['ADDRESS_COUNTRY'] : (isset($arRow['ADDRESS_COUNTRY']) ? $arRow['ADDRESS_COUNTRY'] : null), 'COUNTRY_CODE' => isset($arFields['ADDRESS_COUNTRY_CODE']) ? $arFields['ADDRESS_COUNTRY_CODE'] : (isset($arRow['ADDRESS_COUNTRY_CODE']) ? $arRow['ADDRESS_COUNTRY_CODE'] : null)));
         }
         CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
         $GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $ID, $arFields);
         if (defined("BX_COMP_MANAGED_CACHE")) {
             static $arNameFields = array("NAME", "LAST_NAME", "SECOND_NAME");
             $bClear = false;
             foreach ($arNameFields as $val) {
                 if (isset($arFields[$val])) {
                     $bClear = true;
                     break;
                 }
             }
             if ($bClear) {
                 $GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Contact . "_" . $ID);
             }
         }
         if (isset($arFields['FM']) && is_array($arFields['FM'])) {
             $CCrmFieldMulti = new CCrmFieldMulti();
             $CCrmFieldMulti->SetFields(CCrmOwnerType::ContactName, $ID, $arFields['FM']);
             $multifields = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::prepareEntityMultifieldsValues(CCrmOwnerType::Contact, $ID);
             $emails = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($multifields, 'EMAIL');
             \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Contact, $ID, 'EMAIL', $emails);
             $phones = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($multifields, 'PHONE');
             \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Contact, $ID, 'PHONE', $phones);
             $hasEmail = empty($emails) ? 'N' : 'Y';
             $hasPhone = empty($phones) ? 'N' : 'Y';
             if ($hasEmail !== (isset($arRow['HAS_EMAIL']) ? $arRow['HAS_EMAIL'] : 'N') || $hasPhone !== (isset($arRow['HAS_PHONE']) ? $arRow['HAS_PHONE'] : 'N')) {
                 $DB->Query("UPDATE b_crm_contact SET HAS_EMAIL = '{$hasEmail}', HAS_PHONE = '{$hasPhone}' WHERE ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
                 $arFields['HAS_EMAIL'] = $hasEmail;
                 $arFields['HAS_PHONE'] = $hasPhone;
             }
         }
         \Bitrix\Crm\Integrity\DuplicateEntityRanking::registerEntityStatistics(CCrmOwnerType::Contact, $ID, array_merge($arRow, $arFields));
         if ($bUpdateSearch) {
             CCrmSearch::UpdateSearch(array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), 'CONTACT', true);
         }
         if (isset($GLOBALS["USER"]) && isset($arFields['COMPANY_ID']) && intval($arFields['COMPANY_ID']) > 0) {
             if (!class_exists('CUserOptions')) {
                 include_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . $GLOBALS['DBType'] . "/favorites.php";
             }
             CUserOptions::SetOption("crm", "crm_company_search", array('last_selected' => $arFields['COMPANY_ID']));
         }
         $arFields['ID'] = $ID;
         $newCompanyID = isset($arFields['COMPANY_ID']) ? intval($arFields['COMPANY_ID']) : 0;
         $oldCompanyID = isset($arRow['COMPANY_ID']) ? intval($arRow['COMPANY_ID']) : 0;
         $companyID = $newCompanyID > 0 ? $newCompanyID : $oldCompanyID;
         $registerSonetEvent = isset($arOptions['REGISTER_SONET_EVENT']) && $arOptions['REGISTER_SONET_EVENT'] === true;
         if ($bResult && isset($arFields['ASSIGNED_BY_ID'])) {
             CCrmSonetSubscription::ReplaceSubscriptionByEntity(CCrmOwnerType::Contact, $ID, CCrmSonetSubscriptionType::Responsibility, $arFields['ASSIGNED_BY_ID'], $arRow['ASSIGNED_BY_ID'], $registerSonetEvent);
         }
         if ($bResult && $bCompare && $registerSonetEvent && !empty($sonetEventData)) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:crm_contact.php


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