本文整理汇总了PHP中CCrmContact::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmContact::GetList方法的具体用法?PHP CCrmContact::GetList怎么用?PHP CCrmContact::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmContact
的用法示例。
在下文中一共展示了CCrmContact::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$matches = array();
if (preg_match('/^\\[(\\d+?)]/i', $search, $matches)) {
$matches[1] = intval($matches[1]);
if ($matches[1] > 0) {
$dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $matches[1]));
if ($arRes = $dbRes->Fetch()) {
$arData = array(array('ID' => $arRes['ID'], 'NAME' => str_replace(array(';', ','), ' ', (isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] . ' ' : '') . $arRes['NAME']), 'READY' => 'Y'));
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject($arData);
die;
}
}
}
$arData = array();
$dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('FULL_NAME' => trim($search)));
while ($arRes = $dbRes->Fetch()) {
$arData[] = array('ID' => $arRes['ID'], 'NAME' => str_replace(array(';', ','), ' ', (isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] . ' ' : '') . $arRes['NAME']), 'READY' => 'Y');
}
if (empty($arData)) {
$dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => intval($search)));
if ($arRes = $dbRes->Fetch()) {
$arData = array(array('ID' => $arRes['ID'], 'NAME' => str_replace(array(';', ','), ' ', (isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] . ' ' : '') . $arRes['NAME']), 'READY' => 'Y'));
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject($arData);
die;
}
}
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject($arData);
die;
}
示例2: UpdateSearch
public static function UpdateSearch($arFilter, $ENTITY_TYPE, $bOverWrite = false)
{
if (!CModule::IncludeModule('search')) {
return false;
}
$limit = 1000;
switch ($ENTITY_TYPE) {
case 'CONTACT':
$obRes = CCrmContact::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
$sTitleID = 'FULL_NAME';
break;
case 'DEAL':
$obRes = CCrmDeal::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
$sTitleID = 'TITLE';
break;
case 'INVOICE':
$obRes = CCrmInvoice::GetList(array('ID' => 'DESC'), $arFilter, false, array('nTopCount' => $limit), array('*'));
$sTitleID = 'ORDER_TOPIC';
break;
case 'QUOTE':
$obRes = CCrmQuote::GetList(array('ID' => 'ASC'), $arFilter, false, array('nTopCount' => intval($limit)), array());
$sTitleID = 'TITLE';
break;
case 'COMPANY':
$obRes = CCrmCompany::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
$sTitleID = 'TITLE';
break;
default:
case 'LEAD':
$obRes = CCrmLead::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
$sTitleID = 'TITLE';
$ENTITY_TYPE = 'LEAD';
break;
}
if (!isset(self::$arMess[$ENTITY_TYPE])) {
self::$arMess[$ENTITY_TYPE] = __IncludeLang($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/components/bitrix/crm.' . strtolower($ENTITY_TYPE) . '.show/lang/' . LANGUAGE_ID . '/component.php', true);
}
$arAllResult = array();
$qty = 0;
$lastItemID = '';
if (is_object($obRes)) {
while (($arRow = $obRes->Fetch()) !== false) {
$elementID = $arRow['ID'];
$lastItemID = $ENTITY_TYPE . '.' . $elementID;
if ($ENTITY_TYPE === 'INVOICE') {
$arResult = CCrmInvoice::BuildSearchCard($arRow, self::$bReIndex);
} elseif ($ENTITY_TYPE === 'QUOTE') {
$arResult = CCrmQuote::BuildSearchCard($arRow, self::$bReIndex);
} else {
$multiFields = array();
if ($ENTITY_TYPE === 'CONTACT' || $ENTITY_TYPE === 'COMPANY' || $ENTITY_TYPE === 'LEAD') {
$obMultiFieldRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => $ENTITY_TYPE, 'ELEMENT_ID' => $elementID));
while ($multiField = $obMultiFieldRes->Fetch()) {
$fieldValue = $multiField['VALUE'];
$fieldTypeID = $multiField['TYPE_ID'];
if ($fieldValue === '' || $fieldTypeID !== 'PHONE' && $fieldTypeID !== 'EMAIL') {
continue;
}
if (!isset($multiFields[$fieldTypeID])) {
$multiFields[$fieldTypeID] = array();
}
$multiFields[$fieldTypeID][] = $fieldValue;
}
}
$arResult = self::_buildEntityCard($arRow, $sTitleID, $ENTITY_TYPE, array('FM' => $multiFields));
}
if (self::$bReIndex) {
if (self::$oCallback) {
$res = call_user_func(array(self::$oCallback, self::$callback_method), $arResult);
if (!$res) {
return $lastItemID;
}
}
} else {
CSearch::Index('crm', $ENTITY_TYPE . '.' . $arRow['ID'], $arResult, $bOverWrite);
}
$arAllResult[] = $arResult;
$qty++;
}
}
if (!self::$bReIndex && !empty($arFilter['ID']) && $qty === 0) {
CSearch::DeleteIndex('crm', (int) $arFilter['ID']);
}
if (self::$bReIndex && $qty === $limit && $lastItemID !== '') {
return $lastItemID;
}
return $arAllResult;
}
示例3: trim
} else {
if (preg_match('/(.*)\\[(\\d+?)\\]/i' . BX_UTF_PCRE_MODIFIER, $search, $arMatches)) {
$arFilter['ID'] = (int) $arMatches[2];
$arFilter['%FULL_NAME'] = trim($arMatches[1]);
$arFilter['LOGIC'] = 'OR';
} else {
$arFilter['%FULL_NAME'] = trim($search);
$arFilter['%COMPANY_TITLE'] = trim($search);
$arFilter['LOGIC'] = 'OR';
}
}
$arContactTypeList = CCrmStatus::GetStatusListEx('CONTACT_TYPE');
$arSelect = array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'COMPANY_TITLE', 'PHOTO', 'TYPE_ID');
$arOrder = array('LAST_NAME' => 'ASC', 'NAME' => 'ASC');
$arData = array();
$obRes = CCrmContact::GetList($arOrder, $arFilter, $arSelect, $nPageTop);
$arFiles = array();
$i = 0;
$contactIndex = array();
$contactTypes = CCrmStatus::GetStatusList('CONTACT_TYPE');
while ($arRes = $obRes->Fetch()) {
$photoID = intval($arRes['PHOTO']);
if ($photoID > 0 && !isset($arFiles[$photoID])) {
$arFiles[$photoID] = CFile::ResizeImageGet($photoID, array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
}
// advanced info
$advancedInfo = array();
if (isset($arRes['TYPE_ID']) && $arRes['TYPE_ID'] != '' && isset($contactTypes[$arRes['TYPE_ID']])) {
$advancedInfo['contactType'] = array('id' => $arRes['TYPE_ID'], 'name' => $contactTypes[$arRes['TYPE_ID']]);
}
$arData[$i] = array('id' => $multi ? 'C_' . $arRes['ID'] : $arRes['ID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])), 'title' => CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''), false, false), 'desc' => empty($arRes['COMPANY_TITLE']) ? "" : $arRes['COMPANY_TITLE'], 'image' => isset($arFiles[$photoID]['src']) ? $arFiles[$photoID]['src'] : '', 'type' => 'contact');
示例4: SaveOrderDataContact
private function SaveOrderDataContact($arOrder)
{
if (!isset($arOrder["CONTRACTOR"]) || !is_array($arOrder["CONTRACTOR"])) {
return false;
}
$contactId = 0;
$contactXmlId = $arOrder["CONTRACTOR"]["ID"];
if (isset($arOrder["CONTRACTOR"]["FIRST_NAME"]) && $arOrder["CONTRACTOR"]["FIRST_NAME"] != "") {
$contactXmlId .= "|" . $arOrder["CONTRACTOR"]["FIRST_NAME"];
}
if (isset($arOrder["CONTRACTOR"]["LAST_NAME"]) && $arOrder["CONTRACTOR"]["LAST_NAME"] != "") {
$contactXmlId .= "|" . $arOrder["CONTRACTOR"]["LAST_NAME"];
}
$dbContact = CCrmContact::GetList(array(), array("ORIGINATOR_ID" => $this->externalSaleId, "ORIGIN_ID" => $contactXmlId, "CHECK_PERMISSIONS" => "N"));
if ($arContact = $dbContact->Fetch()) {
$contactId = $arContact["ID"];
}
$arFields = array('ORIGINATOR_ID' => $this->externalSaleId, 'ORIGIN_ID' => $contactXmlId, 'TYPE_ID' => 'CLIENT', 'OPENED' => 'Y');
$sources = CCrmStatus::GetStatusList('SOURCE');
if (isset($sources['WEB'])) {
$arFields['SOURCE_ID'] = 'WEB';
}
if (isset($arOrder["CONTRACTOR"]["FIRST_NAME"]) && $arOrder["CONTRACTOR"]["FIRST_NAME"] != "") {
$arFields['NAME'] = $arOrder["CONTRACTOR"]["FIRST_NAME"];
}
if (isset($arOrder["CONTRACTOR"]["LAST_NAME"]) && $arOrder["CONTRACTOR"]["LAST_NAME"] != "") {
$arFields['LAST_NAME'] = $arOrder["CONTRACTOR"]["LAST_NAME"];
}
if (isset($arOrder["CONTRACTOR"]["SECOND_NAME"]) && $arOrder["CONTRACTOR"]["SECOND_NAME"] != "") {
$arFields['SECOND_NAME'] = $arOrder["CONTRACTOR"]["SECOND_NAME"];
}
if (isset($arOrder["CONTRACTOR"]["BIRTHDAY"]) && $arOrder["CONTRACTOR"]["BIRTHDAY"] != "") {
$arFields['BIRTHDATE'] = $arOrder["CONTRACTOR"]["BIRTHDAY"];
}
if (isset($arOrder["CONTRACTOR"]["FULL_NAME"]) && $arOrder["CONTRACTOR"]["FULL_NAME"] != "") {
$arFields['FULL_NAME'] = $arOrder["CONTRACTOR"]["FULL_NAME"];
} elseif (isset($arOrder["CONTRACTOR"]["NAME"]) && $arOrder["CONTRACTOR"]["NAME"] != "") {
$arFields['FULL_NAME'] = $arOrder["CONTRACTOR"]["NAME"];
}
if (is_array($arOrder["CONTRACTOR"]["ADDRESS"])) {
foreach ($arOrder["CONTRACTOR"]["ADDRESS"] as $key => $val) {
if ($key == "VIEW") {
continue;
}
if (!empty($arFields["ADDRESS"])) {
$arFields["ADDRESS"] .= ", ";
}
$arFields["ADDRESS"] .= $val;
}
if (isset($arOrder["CONTRACTOR"]["ADDRESS"]["VIEW"])) {
if (!empty($arFields["ADDRESS"])) {
$arFields["ADDRESS"] .= "\n";
}
$arFields["ADDRESS"] .= $arOrder["CONTRACTOR"]["ADDRESS"]["VIEW"];
}
}
if (is_array($arOrder["CONTRACTOR"]["CONTACTS"])) {
$arFields["FM"] = array();
if ($contactId > 0) {
$dbCrmFieldMulti = CCrmFieldMulti::GetList(array(), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => $contactId, "CHECK_PERMISSIONS" => "N"));
while ($arCrmFieldMulti = $dbCrmFieldMulti->Fetch()) {
$arFields["FM"][$arCrmFieldMulti["TYPE_ID"]][$arCrmFieldMulti["ID"]] = array("VALUE_TYPE" => $arCrmFieldMulti["VALUE_TYPE"], "VALUE" => $arCrmFieldMulti["VALUE"]);
}
}
$arMapTmp = array("MAIL" => "EMAIL", "E-MAIL" => "EMAIL", "WORKPHONE" => "PHONE");
$arInc = array();
foreach ($arOrder["CONTRACTOR"]["CONTACTS"] as $val) {
$t = strtoupper(preg_replace("/\\s/", "", $val["TYPE"]));
if (!isset($arMapTmp[$t])) {
continue;
}
$bFound = false;
$tNew = $arMapTmp[$t];
if (isset($arFields["FM"][$tNew]) && is_array($arFields["FM"][$tNew])) {
if (count($arFields["FM"][$tNew]) >= 50) {
//Disable adding new communication after threshold is exceeded
$bFound = true;
} else {
foreach ($arFields["FM"][$tNew] as $k => $v) {
if ($v["VALUE"] == $val["VALUE"]) {
$bFound = true;
break;
}
}
}
}
if (!$bFound) {
$arInc[$tNew]++;
$arFields["FM"][$tNew]["n" . $arInc[$tNew]] = array("VALUE_TYPE" => "WORK", "VALUE" => $val["VALUE"]);
}
}
}
$newContact = $contactId == 0;
$obj = new CCrmContact(false);
if ($contactId == 0) {
if ((!isset($arFields['NAME']) || strlen($arFields['NAME']) <= 0) && (!isset($arFields['LAST_NAME']) || strlen($arFields['LAST_NAME']) <= 0)) {
$arFields['LAST_NAME'] = $contactXmlId;
}
$res = $obj->Add($arFields, true, array('DISABLE_USER_FIELD_CHECK' => true));
if ($res > 0) {
//.........这里部分代码省略.........
示例5: foreach
if ($bSuccess) {
// Save settings
if (is_array($productRowSettings) && count($productRowSettings) > 0) {
$arSettings = CCrmProductRow::LoadSettings('I', $arResult['ELEMENT']['ID']);
foreach ($productRowSettings as $k => $v) {
$arSettings[$k] = $v;
}
CCrmProductRow::SaveSettings('I', $arResult['ELEMENT']['ID'], $arSettings);
}
unset($arSettings);
}
// link contact to company
if ($bSuccess) {
if ($arFields['UF_CONTACT_ID'] > 0 && $arFields['UF_COMPANY_ID'] > 0) {
$CrmContact = new CCrmContact();
$dbRes = CCrmContact::GetList(array(), array('ID' => $arFields['UF_CONTACT_ID']), array('COMPANY_ID'));
$arContactInfo = $dbRes->Fetch();
if ($arContactInfo && intval($arContactInfo['COMPANY_ID']) <= 0) {
$arContactFields = array('COMPANY_ID' => $arFields['UF_COMPANY_ID']);
$bSuccess = $CrmContact->Update($arFields['UF_CONTACT_ID'], $arContactFields, false, true, array('DISABLE_USER_FIELD_CHECK' => true));
if (!$bSuccess) {
$arResult['ERROR_MESSAGE'] = !empty($arFields['RESULT_MESSAGE']) ? $arFields['RESULT_MESSAGE'] : GetMessage('UNKNOWN_ERROR');
}
}
unset($arContactInfo, $dbRes, $CrmContact);
}
}
if ($bSuccess) {
$DB->Commit();
} else {
$DB->Rollback();
示例6: array
if ($arRes = $dbRes->Fetch()) {
$arResult['ENTITY_TITLE'] = $arRes['TITLE'];
$arResult['STATUS_ID'] = $arRes['STATUS_ID'];
}
$arResult['STATUS_LIST'] = array();
$arEventType = CCrmStatus::GetStatusList('QUOTE_STATUS');
foreach ($arEventType as $key => $value) {
if ($CCrmPerms->GetPermType('QUOTE', 'WRITE', array('QUOTE_STATUS' . $key)) > BX_CRM_PERM_NONE) {
$arResult['STATUS_LIST']['REFERENCE'][] = $value;
$arResult['STATUS_LIST']['REFERENCE_ID'][] = $key;
}
}
if ($arParams['EVENT_TYPE'] === 'PHONE') {
$contactID = isset($arRes['CONTACT_ID']) ? intval($arRes['CONTACT_ID']) : 0;
if ($contactID > 0) {
$rsContacts = CCrmContact::GetList(array(), array('ID' => $contactID), array('FULL_NAME'), 1);
$arContact = $rsContacts->Fetch();
if ($arContact) {
$arResult['PHONE_GROUPS'][] = array('TITLE' => $arContact['FULL_NAME'], 'PHONES' => __CrmEventGetPhones('CONTACT', $contactID));
}
}
$companyID = isset($arRes['COMPANY_ID']) ? intval($arRes['COMPANY_ID']) : 0;
if ($companyID > 0) {
$rsCompanies = CCrmCompany::GetList(array(), array('ID' => $companyID), array('TITLE'), 1);
$arCompany = $rsCompanies->Fetch();
if ($arCompany) {
$arResult['PHONE_GROUPS'][] = array('TITLE' => $arCompany['TITLE'], 'PHONES' => __CrmEventGetPhones('COMPANY', $companyID));
}
}
}
}
示例7: CompareFields
public static function CompareFields($arFieldsOrig, $arFieldsModif, $bCheckPerms = true)
{
$arMsg = array();
if (isset($arFieldsOrig['TITLE']) && isset($arFieldsModif['TITLE']) && $arFieldsOrig['TITLE'] != $arFieldsModif['TITLE']) {
$arMsg[] = array('ENTITY_FIELD' => 'TITLE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_TITLE'), 'EVENT_TEXT_1' => $arFieldsOrig['TITLE'], 'EVENT_TEXT_2' => $arFieldsModif['TITLE']);
}
if (isset($arFieldsOrig['COMPANY_ID']) && isset($arFieldsModif['COMPANY_ID']) && (int) $arFieldsOrig['COMPANY_ID'] != (int) $arFieldsModif['COMPANY_ID']) {
$arCompany = array();
$arFilterTmp = array('ID' => array($arFieldsOrig['COMPANY_ID'], $arFieldsModif['COMPANY_ID']));
if (!$bCheckPerms) {
$arFilterTmp["CHECK_PERMISSIONS"] = "N";
}
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), $arFilterTmp);
while ($arRes = $dbRes->Fetch()) {
$arCompany[$arRes['ID']] = $arRes['TITLE'];
}
$arMsg[] = array('ENTITY_FIELD' => 'COMPANY_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMPANY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arCompany, $arFieldsOrig['COMPANY_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arCompany, $arFieldsModif['COMPANY_ID']));
}
if (isset($arFieldsOrig['CONTACT_ID']) && isset($arFieldsModif['CONTACT_ID']) && (int) $arFieldsOrig['CONTACT_ID'] != (int) $arFieldsModif['CONTACT_ID']) {
$arContact = array();
$arFilterTmp = array('ID' => array($arFieldsOrig['CONTACT_ID'], $arFieldsModif['CONTACT_ID']));
if (!$bCheckPerms) {
$arFilterTmp["CHECK_PERMISSIONS"] = "N";
}
$dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), $arFilterTmp);
while ($arRes = $dbRes->Fetch()) {
$arContact[$arRes['ID']] = $arRes['LAST_NAME'] . ' ' . $arRes['NAME'];
}
$arMsg[] = array('ENTITY_FIELD' => 'CONTACT_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_CONTACT_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arContact, $arFieldsOrig['CONTACT_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arContact, $arFieldsModif['CONTACT_ID']));
}
if (isset($arFieldsOrig['ASSIGNED_BY_ID']) && isset($arFieldsModif['ASSIGNED_BY_ID']) && (int) $arFieldsOrig['ASSIGNED_BY_ID'] != (int) $arFieldsModif['ASSIGNED_BY_ID']) {
$arUser = array();
$dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', array('ID' => implode('|', array(intval($arFieldsOrig['ASSIGNED_BY_ID']), intval($arFieldsModif['ASSIGNED_BY_ID'])))), array('SELECT' => array('NAME', 'SECOND_NAME', 'LAST_NAME', 'LOGIN', 'EMAIL')));
while ($arRes = $dbUsers->Fetch()) {
$arUser[$arRes['ID']] = CUser::FormatName(CSite::GetNameFormat(false), $arRes);
}
$arMsg[] = array('ENTITY_FIELD' => 'ASSIGNED_BY_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_ASSIGNED_BY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arUser, $arFieldsOrig['ASSIGNED_BY_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arUser, $arFieldsModif['ASSIGNED_BY_ID']));
}
if (isset($arFieldsOrig['STAGE_ID']) && isset($arFieldsModif['STAGE_ID']) && $arFieldsOrig['STAGE_ID'] != $arFieldsModif['STAGE_ID']) {
$arStatus = CCrmStatus::GetStatusList('DEAL_STAGE');
$arMsg[] = array('ENTITY_FIELD' => 'STAGE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_STAGE'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['STAGE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['STAGE_ID'])));
}
/*
if (isset($arFieldsOrig['STATE_ID']) && isset($arFieldsModif['STATE_ID'])
&& $arFieldsOrig['STATE_ID'] != $arFieldsModif['STATE_ID'])
{
$CCrmStatus = new CCrmStatus('DEAL_STATE');
$arStatusOrig = $CCrmStatus->GetStatusByStatusId($arFieldsOrig['STATE_ID']);
$arStatusModif = $CCrmStatus->GetStatusByStatusId($arFieldsModif['STATE_ID']);
$arMsg[] = Array(
'ENTITY_FIELD' => 'STATE_ID',
'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_STATE'),
'EVENT_TEXT_1' => isset($arStatusOrig['NAME'])? $arStatusOrig['NAME']: GetMessage('CRM_FIELD_COMPARE_EMPTY'),
'EVENT_TEXT_2' => isset($arStatusModif['NAME'])? $arStatusModif['NAME']: GetMessage('CRM_FIELD_COMPARE_EMPTY'),
);
}
*/
if (isset($arFieldsOrig['TYPE_ID']) && isset($arFieldsModif['TYPE_ID']) && $arFieldsOrig['TYPE_ID'] != $arFieldsModif['TYPE_ID']) {
$arStatus = CCrmStatus::GetStatusList('DEAL_TYPE');
$arMsg[] = array('ENTITY_FIELD' => 'TYPE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_TYPE'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['TYPE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['TYPE_ID'])));
}
if (isset($arFieldsOrig['COMMENTS']) && isset($arFieldsModif['COMMENTS']) && $arFieldsOrig['COMMENTS'] != $arFieldsModif['COMMENTS']) {
$arMsg[] = array('ENTITY_FIELD' => 'COMMENTS', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMMENTS'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['COMMENTS']) ? $arFieldsOrig['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['COMMENTS']) ? $arFieldsModif['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
// if (isset($arFieldsOrig['PRODUCT_ID']) && isset($arFieldsModif['PRODUCT_ID'])
// && $arFieldsOrig['PRODUCT_ID'] != $arFieldsModif['PRODUCT_ID'])
// {
// $arStatus = CCrmStatus::GetStatusList('PRODUCT');
// $arMsg[] = Array(
// 'ENTITY_FIELD' => 'PRODUCT_ID',
// 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_PRODUCT'),
// 'EVENT_TEXT_1' => CrmCompareFieldsList($arStatus, $arFieldsOrig['PRODUCT_ID']),
// 'EVENT_TEXT_2' => CrmCompareFieldsList($arStatus, $arFieldsModif['PRODUCT_ID'])
// );
// }
if (isset($arFieldsOrig['OPPORTUNITY']) && isset($arFieldsModif['OPPORTUNITY']) && $arFieldsOrig['OPPORTUNITY'] != $arFieldsModif['OPPORTUNITY'] || isset($arFieldsOrig['CURRENCY_ID']) && isset($arFieldsModif['CURRENCY_ID']) && $arFieldsOrig['CURRENCY_ID'] != $arFieldsModif['CURRENCY_ID']) {
$arStatus = CCrmCurrencyHelper::PrepareListItems();
$arMsg[] = array('ENTITY_FIELD' => 'OPPORTUNITY', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_OPPORTUNITY'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['OPPORTUNITY']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsOrig['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['OPPORTUNITY']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsModif['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''));
}
if (isset($arFieldsOrig['TAX_VALUE']) && isset($arFieldsModif['TAX_VALUE']) && $arFieldsOrig['TAX_VALUE'] != $arFieldsModif['TAX_VALUE'] || isset($arFieldsOrig['CURRENCY_ID']) && isset($arFieldsModif['CURRENCY_ID']) && $arFieldsOrig['CURRENCY_ID'] != $arFieldsModif['CURRENCY_ID']) {
$arStatus = CCrmCurrencyHelper::PrepareListItems();
$arMsg[] = array('ENTITY_FIELD' => 'TAX_VALUE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_TAX_VALUE'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['TAX_VALUE']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsOrig['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['TAX_VALUE']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsModif['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''));
}
if (isset($arFieldsOrig['PROBABILITY']) && isset($arFieldsModif['PROBABILITY']) && $arFieldsOrig['PROBABILITY'] != $arFieldsModif['PROBABILITY']) {
$arMsg[] = array('ENTITY_FIELD' => 'PROBABILITY', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_PROBABILITY'), 'EVENT_TEXT_1' => intval($arFieldsOrig['PROBABILITY']) . '%', 'EVENT_TEXT_2' => intval($arFieldsModif['PROBABILITY']) . '%');
}
if (array_key_exists('BEGINDATE', $arFieldsOrig) && array_key_exists('BEGINDATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['BEGINDATE'])) != $arFieldsModif['BEGINDATE'] && $arFieldsOrig['BEGINDATE'] != $arFieldsModif['BEGINDATE']) {
$arMsg[] = array('ENTITY_FIELD' => 'BEGINDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_BEGINDATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['BEGINDATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['BEGINDATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['BEGINDATE']) ? $arFieldsModif['BEGINDATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (array_key_exists('CLOSEDATE', $arFieldsOrig) && array_key_exists('CLOSEDATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['CLOSEDATE'])) != $arFieldsModif['CLOSEDATE'] && $arFieldsOrig['CLOSEDATE'] != $arFieldsModif['CLOSEDATE']) {
$arMsg[] = array('ENTITY_FIELD' => 'CLOSEDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_CLOSEDATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['CLOSEDATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['CLOSEDATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['CLOSEDATE']) ? $arFieldsModif['CLOSEDATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (array_key_exists('EVENT_DATE', $arFieldsOrig) && array_key_exists('EVENT_DATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['EVENT_DATE'])) != $arFieldsModif['EVENT_DATE'] && $arFieldsOrig['EVENT_DATE'] != $arFieldsModif['EVENT_DATE']) {
$arMsg[] = array('ENTITY_FIELD' => 'EVENT_DATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_EVENT_DATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['EVENT_DATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['EVENT_DATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['EVENT_DATE']) ? $arFieldsModif['EVENT_DATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['EVENT_ID']) && isset($arFieldsModif['EVENT_ID']) && $arFieldsOrig['EVENT_ID'] != $arFieldsModif['EVENT_ID']) {
$arStatus = CCrmStatus::GetStatusList('EVENT_TYPE');
$arMsg[] = array('ENTITY_FIELD' => 'EVENT_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_EVENT_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arStatus, $arFieldsOrig['EVENT_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arStatus, $arFieldsModif['EVENT_ID']));
}
//.........这里部分代码省略.........
示例8: prepareCrmSelectorItem
protected function prepareCrmSelectorItem($ufInfo)
{
/** @global CUser $USER */
global $USER;
$result = false;
$selectorItem = array();
if (!CModule::IncludeModule('crm')) {
return $result;
}
$CCrmPerms = new CCrmPerms($USER->GetID());
$nPermittedEntityTypes = 0;
if ($ufInfo['SETTINGS']['LEAD'] == 'Y' && !$CCrmPerms->HavePerm('LEAD', BX_CRM_PERM_NONE, 'READ')) {
$nPermittedEntityTypes++;
}
if ($ufInfo['SETTINGS']['CONTACT'] == 'Y' && !$CCrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ')) {
$nPermittedEntityTypes++;
}
if ($ufInfo['SETTINGS']['COMPANY'] == 'Y' && !$CCrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ')) {
$nPermittedEntityTypes++;
}
if ($ufInfo['SETTINGS']['DEAL'] == 'Y' && !$CCrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ')) {
$nPermittedEntityTypes++;
}
if ($ufInfo['SETTINGS']['QUOTE'] == 'Y' && !$CCrmPerms->HavePerm('QUOTE', BX_CRM_PERM_NONE, 'READ')) {
$nPermittedEntityTypes++;
}
if ($ufInfo['SETTINGS']['PRODUCT'] == 'Y' && $CCrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ')) {
$nPermittedEntityTypes++;
}
$usePrefix = true;
/*$nPermittedEntityTypes > 1;*/
// last 50 entity
$entityTypes = array();
$elements = array();
$arSettings = $ufInfo['SETTINGS'];
if (isset($arSettings['LEAD']) && $arSettings['LEAD'] == 'Y') {
$entityTypes[] = 'lead';
$arSelect = array('ID', 'TITLE', 'FULL_NAME', 'STATUS_ID');
$obRes = CCrmLead::GetList(array('ID' => 'DESC'), array(), $arSelect, 50);
$arFiles = array();
while ($arRes = $obRes->Fetch()) {
$arRes['SID'] = $usePrefix ? 'L_' . $arRes['ID'] : $arRes['ID'];
$elements[] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => $arRes['FULL_NAME'], 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID'])), 'type' => 'lead', 'selected' => 'N');
}
}
if (isset($arSettings['CONTACT']) && $arSettings['CONTACT'] == 'Y') {
$entityTypes[] = 'contact';
$arSelect = array('ID', 'FULL_NAME', 'COMPANY_TITLE', 'PHOTO');
$obRes = CCrmContact::GetList(array('ID' => 'DESC'), array(), $arSelect, 50);
while ($arRes = $obRes->Fetch()) {
$strImg = '';
if (!empty($arRes['PHOTO']) && !isset($arFiles[$arRes['PHOTO']])) {
if ($arFile = CFile::GetFileArray($arRes['PHOTO'])) {
$arImg = CFile::ResizeImageGet($arFile, array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
if (is_array($arImg) && isset($arImg['src'])) {
$strImg = CHTTP::URN2URI($arImg['src'], '', true);
}
}
}
$arRes['SID'] = $usePrefix ? 'C_' . $arRes['ID'] : $arRes['ID'];
$elements[] = array('title' => str_replace(array(';', ','), ' ', $arRes['FULL_NAME']), 'desc' => empty($arRes['COMPANY_TITLE']) ? '' : $arRes['COMPANY_TITLE'], 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])), 'image' => $strImg, 'type' => 'contact', 'selected' => 'N');
}
}
if (isset($arSettings['COMPANY']) && $arSettings['COMPANY'] == 'Y') {
$entityTypes[] = 'company';
$arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
$arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
$arSelect = array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO');
$obRes = CCrmCompany::GetList(array('ID' => 'DESC'), array(), $arSelect, 50);
$arFiles = array();
while ($arRes = $obRes->Fetch()) {
$strImg = '';
if (!empty($arRes['LOGO']) && !isset($arFiles[$arRes['LOGO']])) {
if ($arFile = CFile::GetFileArray($arRes['LOGO'])) {
$arImg = CFile::ResizeImageGet($arFile, array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
if (is_array($arImg) && isset($arImg['src'])) {
$strImg = CHTTP::URN2URI($arImg['src'], '', true);
}
}
$arFiles[$arRes['LOGO']] = $strImg;
}
$arRes['SID'] = $usePrefix ? 'CO_' . $arRes['ID'] : $arRes['ID'];
$arDesc = array();
if (isset($arCompanyTypeList[$arRes['COMPANY_TYPE']])) {
$arDesc[] = $arCompanyTypeList[$arRes['COMPANY_TYPE']];
}
if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
$arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
}
$elements[] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => implode(', ', $arDesc), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $arRes['ID'])), 'image' => $strImg, 'type' => 'company', 'selected' => 'N');
}
}
if (isset($arSettings['DEAL']) && $arSettings['DEAL'] == 'Y') {
$entityTypes[] = 'deal';
$arDealStageList = CCrmStatus::GetStatusListEx('DEAL_STAGE');
$arSelect = array('ID', 'TITLE', 'STAGE_ID', 'COMPANY_TITLE', 'CONTACT_FULL_NAME');
$obRes = CCrmDeal::GetList(array('ID' => 'DESC'), array(), $arSelect, 50);
while ($arRes = $obRes->Fetch()) {
$arRes['SID'] = $usePrefix ? 'D_' . $arRes['ID'] : $arRes['ID'];
$clientTitle = !empty($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '';
//.........这里部分代码省略.........
示例9: UpdateDocument
public static function UpdateDocument($documentId, $arFields)
{
global $DB;
$arDocumentID = self::GetDocumentInfo($documentId);
if (empty($arDocumentID)) {
throw new CBPArgumentNullException('documentId');
}
$dbDocumentList = CCrmContact::GetList(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), array('ID'));
$arResult = $dbDocumentList->Fetch();
if (!$arResult) {
throw new Exception(GetMessage('CRM_DOCUMENT_ELEMENT_IS_NOT_FOUND'));
}
$arDocumentFields = self::GetDocumentFields($arDocumentID['TYPE']);
$arKeys = array_keys($arFields);
foreach ($arKeys as $key) {
if (!array_key_exists($key, $arDocumentFields)) {
//Fix for issue #40374
unset($arFields[$key]);
continue;
}
$fieldType = $arDocumentFields[$key]["Type"];
if (in_array($fieldType, array("phone", "email", "im", "web"), true)) {
CCrmDocument::PrepareEntityMultiFields($arFields, strtoupper($fieldType));
continue;
}
$arFields[$key] = is_array($arFields[$key]) && !CBPHelper::IsAssociativeArray($arFields[$key]) ? $arFields[$key] : array($arFields[$key]);
if ($fieldType == "user") {
$ar = array();
foreach ($arFields[$key] as $v1) {
if (substr($v1, 0, strlen("user_")) == "user_") {
$ar[] = substr($v1, strlen("user_"));
} else {
$a1 = self::GetUsersFromUserGroup($v1, $documentId);
foreach ($a1 as $a11) {
$ar[] = $a11;
}
}
}
$arFields[$key] = $ar;
} elseif ($fieldType == "select" && substr($key, 0, 3) == "UF_") {
$db = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "CRM_CONTACT", "FIELD_NAME" => $key));
if ($ar = $db->Fetch()) {
$arV = array();
$db = CUserTypeEnum::GetList($ar);
while ($ar = $db->GetNext()) {
$arV[$ar["XML_ID"]] = $ar["ID"];
}
foreach ($arFields[$key] as &$value) {
if (array_key_exists($value, $arV)) {
$value = $arV[$value];
}
}
unset($value);
}
} elseif ($fieldType == "file") {
$arFileOptions = array('ENABLE_ID' => true);
foreach ($arFields[$key] as &$value) {
//Issue #40380. Secure URLs and file IDs are allowed.
$file = false;
CCrmFileProxy::TryResolveFile($value, $file, $arFileOptions);
$value = $file;
}
unset($value);
} elseif ($fieldType == "S:HTML") {
foreach ($arFields[$key] as &$value) {
$value = array("VALUE" => $value);
}
unset($value);
}
if (!$arDocumentFields[$key]["Multiple"] && is_array($arFields[$key])) {
if (count($arFields[$key]) > 0) {
$a = array_values($arFields[$key]);
$arFields[$key] = $a[0];
} else {
$arFields[$key] = null;
}
}
}
if (isset($arFields['COMMENTS']) && $arFields['COMMENTS'] !== '') {
$arFields['COMMENTS'] = preg_replace("/[\r\n]+/" . BX_UTF_PCRE_MODIFIER, "<br/>", $arFields['COMMENTS']);
}
$DB->StartTransaction();
$CCrmEntity = new CCrmContact(false);
$res = $CCrmEntity->Update($arDocumentID['ID'], $arFields);
if (!$res) {
$DB->Rollback();
throw new Exception($CCrmEntity->LAST_ERROR);
}
if (COption::GetOptionString("crm", "start_bp_within_bp", "N") == "Y") {
$CCrmBizProc = new CCrmBizProc('CONTACT');
if (false === $CCrmBizProc->CheckFields($arDocumentID['ID'], true)) {
throw new Exception($CCrmBizProc->LAST_ERROR);
}
if ($res && !$CCrmBizProc->StartWorkflow($arDocumentID['ID'])) {
$DB->Rollback();
throw new Exception($CCrmBizProc->LAST_ERROR);
}
}
if ($res) {
$DB->Commit();
//.........这里部分代码省略.........
示例10: GetAttachmentCollection
public function GetAttachmentCollection($listName, $listItemID)
{
$start = microtime(true);
if (!($listName_original = self::checkGUID($listName))) {
return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
}
$listName = ToUpper(self::makeGUID($listName_original));
$listItemID = intval($listItemID);
$dbRes = CCrmContact::GetList(array(), array('ID' => $listItemID), array('PHOTO'));
$obData = new CXMLCreator('Attachments');
if (($arContact = $dbRes->Fetch()) && $arContact['PHOTO']) {
$arImage = self::InitImage($arContact['PHOTO'], 100, 100);
$obData->addChild($obAttachment = new CXMLCreator('Attachment'));
$obAttachment->setData(CHTTP::URN2URI($arImage['CACHE']['src']));
}
return array('GetAttachmentCollectionResult' => $obData);
}
示例11: ListAddEnumFieldsValue
//.........这里部分代码省略.........
}
}
$arReplaceValue[$ID][$FIELD_NAME] = '';
} else {
if ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'file' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'employee' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'iblock_element' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'enumeration' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'iblock_section') {
$bSecondLoop = true;
$arVal = $arValue[$ID][$FIELD_NAME];
$arReplaceValue[$ID][$FIELD_NAME] = '';
if (!is_array($arVal)) {
$arVal = array($arVal);
}
foreach ($arVal as $value) {
$arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['FIELD'][$ID][$FIELD_NAME][$value] = $value;
$arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['ID'][] = $value;
}
} else {
if ($arUserField['MULTIPLE'] == 'Y' && is_array($arValue[$ID][$FIELD_NAME])) {
array_walk($arValue[$ID][$FIELD_NAME], create_function('&$v', '$v = htmlspecialcharsbx($v);'));
$arReplaceValue[$ID][$FIELD_NAME] = implode($delimiter, $arValue[$ID][$FIELD_NAME]);
}
}
}
}
}
}
unset($arUserField);
// The second loop for special field
if ($bSecondLoop) {
$arValueReplace = array();
$arList = array();
foreach ($arValuePrepare as $KEY => $VALUE) {
// collect multi data
if ($KEY == 'iblock_section') {
$dbRes = CIBlockSection::GetList(array('left_margin' => 'asc'), array('ID' => $VALUE['ID']), false);
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'file') {
$dbRes = CFile::GetList(array(), array('@ID' => implode(',', $VALUE['ID'])));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'iblock_element') {
$dbRes = CIBlockElement::GetList(array('SORT' => 'DESC', 'NAME' => 'ASC'), array('ID' => $VALUE['ID']), false);
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'employee') {
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', array('ID' => implode('|', $VALUE['ID'])));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'enumeration') {
foreach ($VALUE['ID'] as $___value) {
$rsEnum = CUserFieldEnum::GetList(array(), array('ID' => $___value));
while ($arRes = $rsEnum->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
}
} elseif ($KEY == 'crm') {
if (isset($VALUE['LEAD']) && !empty($VALUE['LEAD'])) {
$dbRes = CCrmLead::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $VALUE['LEAD']));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY]['LEAD'][$arRes['ID']] = $arRes;
}
}
示例12: array_search
} else {
$result = array_search($data, $arStatus['EVENT_LIST']);
$arDeal[$currentKey] = $result !== false ? $result : $data;
}
} elseif ($currentKey == 'CLOSED' || $currentKey == 'OPENED') {
$arDeal[$currentKey] = isset($arStatus[$currentKey . '_LIST'][$data]) ? $data : array_search($data, $arStatus[$currentKey . '_LIST']);
if ($arDeal[$currentKey] === false) {
unset($arDeal[$currentKey]);
}
} elseif ($currentKey == 'COMPANY_ID') {
$obRes = CCrmCompany::GetList(array(), array('TITLE' => $data), array('ID'));
if (($arRow = $obRes->Fetch()) !== false) {
$arDeal[$currentKey] = $arRow['ID'];
}
} elseif ($currentKey == 'CONTACT_ID') {
$obRes = CCrmContact::GetList(array(), array('FULL_NAME' => $data), array('ID'));
if (($arRow = $obRes->Fetch()) !== false) {
$arDeal[$currentKey] = $arRow['ID'];
}
} elseif ($currentKey == 'ASSIGNED_BY_ID') {
$userID = 0;
if (is_numeric($data)) {
// 1. Try to interpret value as user ID
$userID = is_int($data) ? $data : intval($data);
if ($userID > 0 && !isset($usersByID[$userID])) {
$dbUsers = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => $userID), array('FIELDS' => array('ID')));
$user = is_object($dbUsers) ? $dbUsers->Fetch() : null;
if (is_array($user)) {
$usersByID[$userID] = $user;
} else {
//Reset user
示例13: InstallService
function InstallService($serviceID, $serviceStage)
{
$wizard =& $this->GetWizard();
if (CModule::IncludeModule("iblock")) {
$type = substr($serviceID, 0, -1);
if ($type == "iblockElement") {
$dbItem = CIBlockElement::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockElement::Delete($arItem["ID"]);
}
} elseif ($type == "iblockSectionElement") {
$dbItem = CIBlockElement::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockElement::Delete($arItem["ID"]);
}
$dbItem = CIBlockSection::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockSection::Delete($arItem["ID"]);
}
} elseif ($serviceID == "iblockDepartmentsElement") {
$dbItem = CIBlockSection::GetList(array(), array("=IBLOCK_CODE" => "departments"));
while ($arItem = $dbItem->Fetch()) {
if ($arItem["DEPTH_LEVEL"] > 2) {
CIBlockSection::Delete($arItem["ID"]);
}
}
} elseif ($serviceID == "tasks") {
if (CModule::IncludeModule("tasks")) {
$dbItem = CTasks::GetList(array(), array("SITE_ID" => $wizard->GetVar("siteID")));
while ($arItem = $dbItem->Fetch()) {
CTasks::Delete($arItem["ID"]);
}
}
} elseif ($serviceID == "calendar") {
if (CModule::IncludeModule("calendar")) {
$dbItem = CCalendarEvent::GetList();
foreach ($dbItem as $arItem) {
CCalendarEvent::Delete(array("id" => $arItem["ID"]));
}
}
} elseif ($serviceID == "meeting") {
if (CModule::IncludeModule("meeting")) {
$dbItem = CMeeting::GetList(array(), array());
while ($arItem = $dbItem->Fetch()) {
if ($arItem["ID"]) {
CMeeting::Delete($arItem["ID"]);
}
}
}
} elseif ($serviceID == "user") {
if ($serviceStage == "user") {
$dbUser = CUser::GetList($by = "ID", $order = "DESC", array(">ID" => 1));
while ($arUser = $dbUser->Fetch()) {
CUser::Delete($arUser["ID"]);
}
}
} elseif ($serviceID == "crm") {
if ($serviceStage == "crm") {
if (CModule::IncludeModule('crm')) {
$CCrmLead = new CCrmLead();
$resLead = CCrmLead::GetList(array(), array(), array(), false);
while ($rowLead = $resLead->Fetch()) {
$CCrmLead->Delete($rowLead["ID"]);
}
$CCrmContact = new CCrmContact();
$resContact = CCrmContact::GetList(array(), array(), array(), false);
while ($rowContact = $resContact->Fetch()) {
$CCrmContact->Delete($rowContact["ID"]);
}
$CCrmCompany = new CCrmCompany();
$resCompany = CCrmCompany::GetList(array(), array(), array(), false);
while ($rowCompany = $resCompany->Fetch()) {
$CCrmCompany->Delete($rowCompany["ID"]);
}
$CCrmDeal = new CCrmDeal();
$resDeal = CCrmDeal::GetList(array(), array(), array(), false);
while ($rowDeal = $resDeal->Fetch()) {
$CCrmDeal->Delete($rowDeal["ID"]);
}
}
}
} elseif ($serviceID == "cache") {
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/cache_html.php";
if ($serviceStage == "cache1") {
BXClearCache(true);
} elseif ($serviceStage == "cache2") {
$GLOBALS["CACHE_MANAGER"]->CleanAll();
} elseif ($serviceStage == "cache3") {
$GLOBALS["stackCacheManager"]->CleanAll();
} elseif ($serviceStage == "cache4") {
CHTMLPagesCache::CleanAll();
}
COption::SetOptionString("main", "wizard_clear_exec", "Y", false, $wizard->GetVar("siteID"));
}
}
}
示例14: array
$ar = array();
while ($arRes = $obRes->Fetch()) {
$arRes['SID'] = $arResult['PREFIX'] == 'Y' ? 'L_' . $arRes['ID'] : $arRes['ID'];
if (isset($arResult['SELECTED'][$arRes['SID']])) {
unset($arResult['SELECTED'][$arRes['SID']]);
$sSelected = 'Y';
} else {
$sSelected = 'N';
}
$ar[] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => $arRes['FULL_NAME'], 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID'])), 'type' => 'lead', 'selected' => $sSelected);
}
$arResult['ELEMENT'] = array_merge($ar, $arResult['ELEMENT']);
}
if ($arSettings['CONTACT'] == 'Y' && isset($arSelected['CONTACT']) && !empty($arSelected['CONTACT'])) {
$arSelect = array('ID', 'FULL_NAME', 'COMPANY_TITLE', 'PHOTO');
$obRes = CCrmContact::GetList(array('ID' => 'DESC'), array('ID' => $arSelected['CONTACT']), $arSelect);
$ar = array();
while ($arRes = $obRes->Fetch()) {
$arImg = array();
if (!empty($arRes['PHOTO']) && !isset($arFiles[$arRes['PHOTO']])) {
if (intval($arRes['PHOTO']) > 0) {
$arImg = CFile::ResizeImageGet($arRes['PHOTO'], array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
}
}
$arRes['SID'] = $arResult['PREFIX'] == 'Y' ? 'C_' . $arRes['ID'] : $arRes['ID'];
if (isset($arResult['SELECTED'][$arRes['SID']])) {
unset($arResult['SELECTED'][$arRes['SID']]);
$sSelected = 'Y';
} else {
$sSelected = 'N';
}
示例15: PrepareEntityInfo
public static function PrepareEntityInfo($entityTypeName, $entityID, $options = array())
{
$entityTypeName = strtoupper(strval($entityTypeName));
$entityID = intval($entityID);
if (!is_array($options)) {
$options = array();
}
$result = array('TITLE' => "{$entityTypeName}_{$entityID}", 'URL' => '');
if ($entityTypeName === '' || $entityID <= 0) {
return $result;
}
if ($entityTypeName === 'CONTACT') {
$contactTypes = CCrmStatus::GetStatusList('CONTACT_TYPE');
$obRes = CCrmContact::GetList(array(), array('=ID' => $entityID), array('NAME', 'SECOND_NAME', 'LAST_NAME', 'TYPE_ID'));
if ($arRes = $obRes->Fetch()) {
$nameTemplate = isset($options['NAME_TEMPLATE']) ? $options['NAME_TEMPLATE'] : '';
if ($nameTemplate === '') {
$nameTemplate = \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
}
$result['TITLE'] = CUser::FormatName($nameTemplate, array('LOGIN' => '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : ''), false, false);
$result['URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $entityID));
// advanced info
$advancedInfo = array();
if (isset($arRes['TYPE_ID']) && $arRes['TYPE_ID'] != '' && isset($contactTypes[$arRes['TYPE_ID']])) {
$advancedInfo['CONTACT_TYPE'] = array('ID' => $arRes['TYPE_ID'], 'NAME' => $contactTypes[$arRes['TYPE_ID']]);
}
if (!empty($advancedInfo)) {
$result['ADVANCED_INFO'] = $advancedInfo;
}
// advanced info - phone number, e-mail
$obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => $entityID));
while ($arRes = $obRes->Fetch()) {
if ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL') {
if (!is_array($result['ADVANCED_INFO'])) {
$result['ADVANCED_INFO'] = array();
}
if (!is_array($result['ADVANCED_INFO']['MULTY_FIELDS'])) {
$result['ADVANCED_INFO']['MULTY_FIELDS'] = array();
}
$result['ADVANCED_INFO']['MULTY_FIELDS'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
}
}
}
} elseif ($entityTypeName === 'COMPANY') {
$obRes = CCrmCompany::GetList(array(), array('=ID' => $entityID), array('TITLE'));
if ($arRes = $obRes->Fetch()) {
$result['TITLE'] = $arRes['TITLE'];
$result['URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $entityID));
// advanced info - phone number, e-mail
$obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $entityID));
while ($arRes = $obRes->Fetch()) {
if ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL') {
if (!is_array($result['ADVANCED_INFO'])) {
$result['ADVANCED_INFO'] = array();
}
if (!is_array($result['ADVANCED_INFO']['MULTY_FIELDS'])) {
$result['ADVANCED_INFO']['MULTY_FIELDS'] = array();
}
$result['ADVANCED_INFO']['MULTY_FIELDS'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
}
}
}
} elseif ($entityTypeName === 'LEAD') {
$obRes = CCrmLead::GetList(array(), array('=ID' => $entityID), array('TITLE'));
if ($arRes = $obRes->Fetch()) {
$result['TITLE'] = $arRes['TITLE'];
$result['URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $entityID));
// advanced info - phone number, e-mail
$obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'LEAD', 'ELEMENT_ID' => $entityID));
while ($arRes = $obRes->Fetch()) {
if ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL') {
if (!is_array($result['ADVANCED_INFO'])) {
$result['ADVANCED_INFO'] = array();
}
if (!is_array($result['ADVANCED_INFO']['MULTY_FIELDS'])) {
$result['ADVANCED_INFO']['MULTY_FIELDS'] = array();
}
$result['ADVANCED_INFO']['MULTY_FIELDS'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
}
}
}
} elseif ($entityTypeName === 'DEAL') {
$obRes = CCrmDeal::GetList(array(), array('=ID' => $entityID), array('TITLE'));
if ($arRes = $obRes->Fetch()) {
$result['TITLE'] = $arRes['TITLE'];
$result['URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $entityID));
}
} elseif ($entityTypeName === 'QUOTE') {
$obRes = CCrmQuote::GetList(array(), array('=ID' => $entityID), false, false, array('QUOTE_NUMBER', 'TITLE'));
if ($arRes = $obRes->Fetch()) {
$result['TITLE'] = empty($arRes['TITLE']) ? $arRes['QUOTE_NUMBER'] : $arRes['QUOTE_NUMBER'] . ' - ' . $arRes['TITLE'];
$result['URL'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_show'), array('quote_id' => $entityID));
}
}
return $result;
}