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


PHP CCrmPerms::GetCurrentUserID方法代码示例

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


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

示例1: foreach

                @unlink($_SESSION['CRM_IMPORT_FILE']);
                foreach ($_SESSION as $key => $value) {
                    if (strpos($key, 'CRM_IMPORT_FILE') !== false) {
                        unset($_SESSION[$key]);
                    }
                }
                LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_LIST'], array()));
            }
        }
    }
}
$arResult['FORM_ID'] = 'CRM_LEAD_IMPORT';
$arResult['FIELDS']['tab_1'] = array();
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_FILE', 'name' => GetMessage('CRM_FIELD_IMPORT_FILE'), 'params' => array(), 'type' => 'file', 'required' => true);
$encodings = array('_' => GetMessage('CRM_FIELD_IMPORT_DEFAULT_FILE_ENCODING'), 'ascii' => 'ASCII', 'UTF-8' => 'UTF-8', 'UTF-16' => 'UTF-16', 'windows-1251' => 'Windows-1251', 'Windows-1252' => 'Windows-1252', 'iso-8859-1' => 'ISO-8859-1', 'iso-8859-2' => 'ISO-8859-2', 'iso-8859-3' => 'ISO-8859-3', 'iso-8859-4' => 'ISO-8859-4', 'iso-8859-5' => 'ISO-8859-5', 'iso-8859-6' => 'ISO-8859-6', 'iso-8859-7' => 'ISO-8859-7', 'iso-8859-8' => 'ISO-8859-8', 'iso-8859-9' => 'ISO-8859-9', 'iso-8859-10' => 'ISO-8859-10', 'iso-8859-13' => 'ISO-8859-13', 'iso-8859-14' => 'ISO-8859-14', 'iso-8859-15' => 'ISO-8859-15', 'koi8-r' => 'KOI8-R');
$siteEncoding = strtolower(SITE_CHARSET);
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_FILE_ENCODING', 'name' => GetMessage('CRM_FIELD_IMPORT_FILE_ENCODING'), 'items' => $encodings, 'type' => 'list', 'value' => isset($encodings[$siteEncoding]) ? $siteEncoding : '_');
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_DEFAULT_RESPONSIBLE', 'name' => GetMessage('CRM_FIELD_IMPORT_DEFAULT_RESPONSIBLE'), 'type' => 'intranet_user_search', 'componentParams' => array('NAME' => 'crm_lead_import_responsible', 'INPUT_NAME' => 'IMPORT_DEFAULT_RESPONSIBLE_ID', 'SEARCH_INPUT_NAME' => 'IMPORT_DEFAULT_RESPONSIBLE_NAME'), 'value' => CCrmPerms::GetCurrentUserID());
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_NAME_FORMAT', 'name' => GetMessage('CRM_FIELD_NAME_FORMAT'), 'items' => $userNameFormats, 'type' => 'list', 'value' => \Bitrix\Crm\Format\PersonNameFormatter::FirstLast);
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_FILE_EXAMPLE', 'name' => GetMessage('CRM_FIELD_IMPORT_FILE_EXAMPLE'), 'params' => array(), 'type' => 'label', 'value' => '<a href="?getSample=csv&ncc=1">' . GetMessage('CRM_DOWNLOAD') . '</a>');
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_FILE_FORMAT', 'name' => GetMessage('CRM_SECTION_IMPORT_FILE_FORMAT'), 'type' => 'section');
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_FILE_SEPORATOR', 'name' => GetMessage('CRM_FIELD_IMPORT_FILE_SEPORATOR'), 'items' => array('semicolon' => GetMessage('CRM_FIELD_IMPORT_FILE_SEPORATOR_SEMICOLON'), 'comma' => GetMessage('CRM_FIELD_IMPORT_FILE_SEPORATOR_COMMA'), 'tab' => GetMessage('CRM_FIELD_IMPORT_FILE_SEPORATOR_TAB'), 'space' => GetMessage('CRM_FIELD_IMPORT_FILE_SEPORATOR_SPACE')), 'type' => 'list', 'value' => isset($_POST['IMPORT_FILE_SEPORATOR']) ? $_POST['IMPORT_FILE_SEPORATOR'] : 'semicolon');
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_FILE_FIRST_HEADER', 'name' => GetMessage('CRM_FIELD_IMPORT_FILE_FIRST_HEADER'), 'type' => 'checkbox', 'value' => isset($_POST['IMPORT_FILE_FIRST_HEADER']) && $_POST['IMPORT_FILE_FIRST_HEADER'] == 'N' ? 'N' : 'Y');
$arResult['FIELDS']['tab_1'][] = array('id' => 'IMPORT_FILE_SKIP_EMPTY', 'name' => GetMessage('CRM_FIELD_IMPORT_FILE_SKIP_EMPTY'), 'type' => 'checkbox', 'value' => isset($_POST['IMPORT_FILE_SKIP_EMPTY']) && $_POST['IMPORT_FILE_SKIP_EMPTY'] == 'N' ? 'N' : 'Y');
for ($i = 1; $i <= 4; $i++) {
    if ($arResult['STEP'] != $i) {
        $arResult['FIELDS']['tab_' . $i] = array();
    }
}
$this->IncludeComponentTemplate();
include_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/components/bitrix/crm.lead/include/nav.php';
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例2: array

        $filterFieldInfo = array('typeName' => 'USER', 'id' => $filterID, 'params' => array('data' => array('paramName' => "{$filterID}", 'elementId' => "{$prefix}_{$filterID}"), 'search' => array('paramName' => "{$filterID}_name", 'elementId' => "{$prefix}_{$filterID}_NAME")));
        $gridManagerCfg['filterFields'][] = $filterFieldInfo;
    }
}
$arResult['GRID_DATA'] = array();
foreach ($arResult['EVENT'] as $arEvent) {
    $arEvent['FILE_HTML'] = "";
    if (!empty($arEvent['FILES'])) {
        $arEvent['FILE_HTML'] = '<div class="event-detail-files"><label class="event-detail-files-title">' . GetMessage('CRM_EVENT_TABLE_FILES') . ':</label><div class="event-detail-files-list">';
        foreach ($arEvent['FILES'] as $key => $value) {
            $arEvent['FILE_HTML'] .= '<div class="event-detail-file"><span class="event-detail-file-number">' . $key . '.</span><span class="event-detail-file-info"><a href="' . htmlspecialcharsbx($value['PATH']) . '" target="_blank" class="event-detail-file-link">' . htmlspecialcharsbx($value['NAME']) . '</a><span class="event-detail-file-size">(' . htmlspecialcharsbx($value['SIZE']) . ')</span></span></div>';
        }
        $arEvent['FILE_HTML'] .= '</div></div>';
    }
    $arActions = array();
    if (CCrmPerms::IsAdmin() || $arEvent['USER_ID'] == CCrmPerms::GetCurrentUserID()) {
        $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_EVENT_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_EVENT_DELETE'), 'ONCLICK' => "crm_event_delete_grid('" . GetMessage('CRM_EVENT_DELETE_TITLE') . "', '" . GetMessage('CRM_EVENT_DELETE_CONFIRM') . "', '" . GetMessage('CRM_EVENT_DELETE') . "', '" . $arEvent['PATH_TO_EVENT_DELETE'] . "')");
    }
    $eventColor = '';
    if ($arEvent['TYPE'] == '0') {
        $eventColor = 'color: #208c0b';
    } elseif ($arEvent['TYPE'] == '2') {
        $eventColor = 'color: #9c8000';
    }
    $arColumns = array('CREATED_BY_FULL_NAME' => $arEvent['CREATED_BY_FULL_NAME'] == '' ? '' : '<a href="' . $arEvent['CREATED_BY_LINK'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arEvent['ID'] . '">' . $arEvent['CREATED_BY_FULL_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arEvent['USER_ID'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arEvent['ID'] . '", "");</script>', 'EVENT_NAME' => '<span style="' . $eventColor . '">' . $arEvent['EVENT_NAME'] . '</span>', 'EVENT_DESC' => $arEvent['EVENT_DESC'] . $arEvent['FILE_HTML'], 'DATE_CREATE' => FormatDate('x', MakeTimeStamp($arEvent['DATE_CREATE']), time() + CTimeZone::GetOffset()));
    //			if ($arResult['EVENT_ENTITY_LINK'] == 'Y')
    //			{
    //				$arColumns['ENTITY_TYPE'] = !empty($arEvent['ENTITY_TYPE'])? GetMessage('CRM_EVENT_ENTITY_TYPE_'.$arEvent['ENTITY_TYPE']): '';
    //				$arColumns['ENTITY_TITLE'] = !empty($arEvent['ENTITY_TITLE'])?
    //					'<a href="'.$arEvent['ENTITY_LINK'].'" id="balloon_'.$arResult['GRID_ID'].'_I_'.$arEvent['ID'].'">'.$arEvent['ENTITY_TITLE'].'</a>'.
    //					'<script type="text/javascript">BX.tooltip("'.$arEvent['ENTITY_TYPE'].'_'.$arEvent['ENTITY_ID'].'", "balloon_'.$arResult['GRID_ID'].'_I_'.$arEvent['ID'].'", "/bitrix/components/bitrix/crm.'.strtolower($arEvent['ENTITY_TYPE']).'.show/card.ajax.php", "crm_balloon'.($arEvent['ENTITY_TYPE'] == 'LEAD' || $arEvent['ENTITY_TYPE'] == 'DEAL' || $arEvent['ENTITY_TYPE'] == 'QUOTE' ? '_no_photo': '_'.strtolower($arEvent['ENTITY_TYPE'])).'", true);</script>'
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:template.php

示例3: CheckFields

 private static function CheckFields($action, &$fields, $ID, $params = null)
 {
     global $DB;
     self::ClearErrors();
     if (!(is_array($fields) && count($fields) > 0)) {
         self::RegisterError(array('text' => 'Fields is not specified.'));
         return false;
     }
     if ($action == 'ADD') {
         // Validation
         if (!isset($fields['OWNER_ID'])) {
             self::RegisterError(array('text' => 'OWNER_ID is not assigned.'));
         }
         if (!isset($fields['OWNER_TYPE_ID'])) {
             self::RegisterError(array('text' => 'OWNER_TYPE_ID is not assigned.'));
         }
         if (!isset($fields['TYPE_ID'])) {
             self::RegisterError(array('text' => 'TYPE_ID is not assigned.'));
         } elseif (!CCrmActivityType::IsDefined($fields['TYPE_ID'])) {
             self::RegisterError(array('text' => 'TYPE_ID is not supported.'));
         }
         if (!isset($fields['SUBJECT'])) {
             self::RegisterError(array('text' => 'SUBJECT is not assigned.'));
         }
         //			if (!isset($fields['START_TIME'])) //is allowed for tasks
         //			{
         //				self::RegisterError(array('text' => 'START_TIME is not assigned.'));
         //			}
         if (!isset($fields['RESPONSIBLE_ID'])) {
             self::RegisterError(array('text' => 'RESPONSIBLE_ID is not assigned.'));
         }
         if (!isset($fields['NOTIFY_TYPE'])) {
             $fields['NOTIFY_TYPE'] = CCrmActivityNotifyType::None;
         }
         if ($fields['NOTIFY_TYPE'] == CCrmActivityNotifyType::None) {
             $fields['NOTIFY_VALUE'] = 0;
         } elseif (!isset($fields['NOTIFY_VALUE'])) {
             self::RegisterError(array('text' => 'NOTIFY_VALUE is not assigned.'));
         }
         if (isset($fields['COMPLETED'])) {
             $completed = strtoupper(strval($fields['COMPLETED']));
             if (!($completed == 'Y' || $completed == 'N')) {
                 $completed = intval($fields['COMPLETED']) > 0 ? 'Y' : 'N';
             }
             $fields['COMPLETED'] = $completed;
         } else {
             $fields['COMPLETED'] = 'N';
         }
         if (isset($fields['CREATED'])) {
             unset($fields['CREATED']);
         }
         if (isset($fields['LAST_UPDATED'])) {
             unset($fields['LAST_UPDATED']);
         }
         $fields['~CREATED'] = $fields['~LAST_UPDATED'] = $DB->CurrentTimeFunction();
         if (!isset($fields['AUTHOR_ID'])) {
             $currentUserId = CCrmPerms::GetCurrentUserID();
             $fields['AUTHOR_ID'] = $currentUserId > 0 ? $currentUserId : $fields['RESPONSIBLE_ID'];
         }
         $fields['EDITOR_ID'] = $fields['AUTHOR_ID'];
         if (!isset($fields['END_TIME']) && isset($fields['START_TIME'])) {
             $fields['END_TIME'] = $fields['START_TIME'];
         } elseif (!isset($fields['START_TIME']) && isset($fields['END_TIME'])) {
             $fields['START_TIME'] = $fields['END_TIME'];
         }
         //DEADLINE -->
         if (isset($fields['DEADLINE'])) {
             unset($fields['DEADLINE']);
         }
         $typeID = intval($fields['TYPE_ID']);
         if ($typeID === CCrmActivityType::Task && isset($fields['END_TIME'])) {
             $fields['DEADLINE'] = $fields['END_TIME'];
         } elseif ($typeID !== CCrmActivityType::Task && isset($fields['START_TIME'])) {
             $fields['DEADLINE'] = $fields['START_TIME'];
         }
         if (!isset($fields['DEADLINE'])) {
             $fields['~DEADLINE'] = CCrmDateTimeHelper::GetMaxDatabaseDate();
         }
         //<-- DEADLINE
         if (!isset($fields['ASSOCIATED_ENTITY_ID'])) {
             $fields['ASSOCIATED_ENTITY_ID'] = 0;
         }
         if (!isset($fields['PRIORITY'])) {
             $fields['PRIORITY'] = CCrmActivityPriority::Low;
         }
         if (!isset($fields['DIRECTION'])) {
             $fields['DIRECTION'] = CCrmActivityDirection::Undefined;
         }
         if (!isset($fields['DESCRIPTION_TYPE'])) {
             $fields['DESCRIPTION_TYPE'] = CCrmContentType::PlainText;
         }
         if (!isset($arFields['STORAGE_TYPE_ID'])) {
             $arFields['STORAGE_TYPE_ID'] = self::GetDefaultStorageTypeID();
         }
         if (!isset($arFields['PARENT_ID'])) {
             $arFields['PARENT_ID'] = 0;
         }
     } else {
         $prevFields = is_array($params) && isset($params['PREVIOUS_FIELDS']) && is_array($params['PREVIOUS_FIELDS']) ? $params['PREVIOUS_FIELDS'] : null;
         if (!is_array($prevFields) && !self::Exists($ID, false)) {
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:crm_activity.php

示例4: Add

 public function Add(&$arFields, $bUpdateSearch = true, $options = array())
 {
     global $DB;
     if (!is_array($options)) {
         $options = array();
     }
     $this->LAST_ERROR = '';
     $iUserId = CCrmSecurityHelper::GetCurrentUserID();
     if (isset($arFields['ID'])) {
         unset($arFields['ID']);
     }
     if (isset($arFields['DATE_CREATE'])) {
         unset($arFields['DATE_CREATE']);
     }
     $arFields['~DATE_CREATE'] = $DB->CurrentTimeFunction();
     $arFields['~DATE_MODIFY'] = $DB->CurrentTimeFunction();
     if (!isset($arFields['CREATED_BY_ID']) || (int) $arFields['CREATED_BY_ID'] <= 0) {
         $arFields['CREATED_BY_ID'] = $iUserId;
     }
     if (!isset($arFields['MODIFY_BY_ID']) || (int) $arFields['MODIFY_BY_ID'] <= 0) {
         $arFields['MODIFY_BY_ID'] = $iUserId;
     }
     if (isset($arFields['ASSIGNED_BY_ID']) && is_array($arFields['ASSIGNED_BY_ID'])) {
         $arFields['ASSIGNED_BY_ID'] = count($arFields['ASSIGNED_BY_ID']) > 0 ? intval($arFields['ASSIGNED_BY_ID'][0]) : $iUserId;
     }
     if (!isset($arFields['ASSIGNED_BY_ID']) || (int) $arFields['ASSIGNED_BY_ID'] <= 0) {
         $arFields['ASSIGNED_BY_ID'] = $iUserId;
     }
     // person type
     if (!isset($arFields['PERSON_TYPE_ID']) || intval($arFields['PERSON_TYPE_ID']) <= 0) {
         $arFields['PERSON_TYPE_ID'] = 0;
         $arPersonTypes = CCrmPaySystem::getPersonTypeIDs();
         if (isset($arPersonTypes['CONTACT']) && (!isset($arFields['COMPANY_ID']) || intval($arFields['COMPANY_ID']) <= 0)) {
             $arFields['PERSON_TYPE_ID'] = intval($arPersonTypes['CONTACT']);
         } else {
             if (isset($arPersonTypes['COMPANY']) && isset($arFields['COMPANY_ID']) && intval($arFields['COMPANY_ID']) > 0) {
                 $arFields['PERSON_TYPE_ID'] = intval($arPersonTypes['COMPANY']);
             }
         }
     }
     // storage type
     $storageTypeID = isset($arFields['STORAGE_TYPE_ID']) ? intval($arFields['STORAGE_TYPE_ID']) : CCrmQuoteStorageType::Undefined;
     if ($storageTypeID === CCrmQuoteStorageType::Undefined || !CCrmQuoteStorageType::IsDefined($storageTypeID)) {
         $storageTypeID = self::GetDefaultStorageTypeID();
     }
     $arFields['STORAGE_TYPE_ID'] = $storageTypeID;
     // storage elements
     $storageElementIDs = isset($arFields['STORAGE_ELEMENT_IDS']) && is_array($arFields['STORAGE_ELEMENT_IDS']) ? $arFields['STORAGE_ELEMENT_IDS'] : null;
     $arFields['STORAGE_ELEMENT_IDS'] = null;
     if ($storageElementIDs !== null) {
         $storageElementIDs = self::NormalizeStorageElementIDs($storageElementIDs);
         $arFields['STORAGE_ELEMENT_IDS'] = serialize($storageElementIDs);
     }
     if (!$this->CheckFields($arFields, false, $options)) {
         $result = false;
         $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
     } else {
         if (!isset($arFields['STATUS_ID'])) {
             $arFields['STATUS_ID'] = 'DRAFT';
         }
         $arAttr = array();
         if (!empty($arFields['STATUS_ID'])) {
             $arAttr['STATUS_ID'] = $arFields['STATUS_ID'];
         }
         if (!empty($arFields['OPENED'])) {
             $arAttr['OPENED'] = $arFields['OPENED'];
         }
         $sPermission = 'ADD';
         if (isset($arFields['PERMISSION'])) {
             if ($arFields['PERMISSION'] == 'IMPORT') {
                 $sPermission = 'IMPORT';
             }
             unset($arFields['PERMISSION']);
         }
         if ($this->bCheckPermission) {
             $arEntityAttr = self::BuildEntityAttr($iUserId, $arAttr);
             $userPerms = $iUserId == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($iUserId);
             $sEntityPerm = $userPerms->GetPermType('QUOTE', $sPermission, $arEntityAttr);
             if ($sEntityPerm == BX_CRM_PERM_NONE) {
                 $this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED');
                 $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
                 return false;
             }
             $assignedByID = intval($arFields['ASSIGNED_BY_ID']);
             if ($sEntityPerm == BX_CRM_PERM_SELF && $assignedByID != $iUserId) {
                 $arFields['ASSIGNED_BY_ID'] = $iUserId;
             }
             if ($sEntityPerm == BX_CRM_PERM_OPEN && $iUserId == $assignedByID) {
                 $arFields['OPENED'] = 'Y';
             }
         }
         $assignedByID = intval($arFields['ASSIGNED_BY_ID']);
         $arEntityAttr = self::BuildEntityAttr($assignedByID, $arAttr);
         $userPerms = $assignedByID == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($assignedByID);
         $sEntityPerm = $userPerms->GetPermType('QUOTE', $sPermission, $arEntityAttr);
         $this->PrepareEntityAttrs($arEntityAttr, $sEntityPerm);
         // Calculation of Account Data
         $accData = CCrmAccountingHelper::PrepareAccountingData(array('CURRENCY_ID' => isset($arFields['CURRENCY_ID']) ? $arFields['CURRENCY_ID'] : null, 'SUM' => isset($arFields['OPPORTUNITY']) ? $arFields['OPPORTUNITY'] : null, 'EXCH_RATE' => isset($arFields['EXCH_RATE']) ? $arFields['EXCH_RATE'] : null));
         if (is_array($accData)) {
             $arFields['ACCOUNT_CURRENCY_ID'] = $accData['ACCOUNT_CURRENCY_ID'];
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_quote.php

示例5: CCrmDeal

}
$CCrmDeal = new CCrmDeal();
if ($CCrmDeal->cPerms->HavePerm('DEAL', BX_CRM_PERM_NONE)) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
if (!CCrmCurrency::EnsureReady()) {
    ShowError(CCrmCurrency::GetLastError());
}
global $APPLICATION;
$arParams['PATH_TO_DEAL_LIST'] = CrmCheckPath('PATH_TO_DEAL_LIST', isset($arParams['PATH_TO_DEAL_LIST']) ? $arParams['PATH_TO_DEAL_LIST'] : '', '#SITE_DIR#crm/deal/');
$arResult['USE_AMCHARTS'] = $arParams['USE_AMCHARTS'] = true;
$arParams['GRID_ID_SUFFIX'] = '';
$arParams['DISABLE_COMPENSATION'] = !empty($arParams['DISABLE_COMPENSATION']) && $arParams['DISABLE_COMPENSATION'] == 'Y' ? 'Y' : 'N';
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arResult['CURRENT_USER_ID'] = CCrmPerms::GetCurrentUserID();
//ALLOW_FUNNEL_TYPE_CHANGE = 'Y' by default
$arParams['ALLOW_FUNNEL_TYPE_CHANGE'] = $arResult['ALLOW_FUNNEL_TYPE_CHANGE'] = !empty($arParams['ALLOW_FUNNEL_TYPE_CHANGE']) && $arParams['ALLOW_FUNNEL_TYPE_CHANGE'] == 'N' ? 'N' : 'Y';
$arParams['FUNNEL_TYPE'] = $arResult['FUNNEL_TYPE'] = $arParams['DISABLE_COMPENSATION'] === 'Y' ? 'CLASSICAL' : 'CUMULATIVE';
$arResult['FUNNEL_TYPE_VALUES'] = array(array('value' => 'CLASSICAL', 'text' => GetMessage('CRM_FUNNEL_TYPE_CLASSICAL')), array('value' => 'CUMULATIVE', 'text' => GetMessage('CRM_FUNNEL_TYPE_CUMULATIVE2')));
if ($arParams['ALLOW_FUNNEL_TYPE_CHANGE'] === 'Y') {
    $userFunnelType = CUserOptions::GetOption('crm.deal.funnel', 'funnel_type', '', $arResult['CURRENT_USER_ID']);
    if ($userFunnelType !== '') {
        $arParams['FUNNEL_TYPE'] = $arResult['FUNNEL_TYPE'] = $userFunnelType;
        $arParams['DISABLE_COMPENSATION'] = $userFunnelType === 'CLASSICAL' ? 'Y' : 'N';
    }
}
$arResult['GADGET'] = 'N';
if (isset($arParams['GADGET_ID']) && strlen($arParams['GADGET_ID']) > 0) {
    $arResult['GADGET'] = 'Y';
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例6: Add

 public function Add(array &$arFields, $bUpdateSearch = true, $arOptions = array())
 {
     global $DB;
     $this->LAST_ERROR = '';
     if (!is_array($arOptions)) {
         $arOptions = array();
     }
     if (isset($arOptions['CURRENT_USER'])) {
         $iUserId = intval($arOptions['CURRENT_USER']);
     } else {
         $iUserId = CCrmPerms::GetCurrentUserID();
     }
     if (isset($arFields['DATE_CREATE'])) {
         unset($arFields['DATE_CREATE']);
     }
     $arFields['~DATE_CREATE'] = $DB->CurrentTimeFunction();
     $arFields['~DATE_MODIFY'] = $DB->CurrentTimeFunction();
     if (!isset($arFields['CREATED_BY_ID']) || (int) $arFields['CREATED_BY_ID'] <= 0) {
         $arFields['CREATED_BY_ID'] = $iUserId;
     }
     if (!isset($arFields['MODIFY_BY_ID']) || (int) $arFields['MODIFY_BY_ID'] <= 0) {
         $arFields['MODIFY_BY_ID'] = $iUserId;
     }
     if (!isset($arFields['ASSIGNED_BY_ID']) || (int) $arFields['ASSIGNED_BY_ID'] <= 0) {
         $arFields['ASSIGNED_BY_ID'] = $iUserId;
     }
     if (!isset($arFields['OPPORTUNITY'])) {
         $arFields['OPPORTUNITY'] = 0.0;
     }
     if (!$this->CheckFields($arFields, false, $arOptions)) {
         $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
         return false;
     }
     if (isset($arFields['BIRTHDATE'])) {
         if ($arFields['BIRTHDATE'] !== '') {
             $birthDate = $arFields['BIRTHDATE'];
             $arFields['~BIRTHDATE'] = $DB->CharToDateFunction($birthDate, 'SHORT', false);
             $arFields['BIRTHDAY_SORT'] = \Bitrix\Crm\BirthdayReminder::prepareSorting($birthDate);
         } else {
             $arFields['BIRTHDAY_SORT'] = \Bitrix\Crm\BirthdayReminder::prepareSorting('');
         }
         unset($arFields['BIRTHDATE']);
     } else {
         $arFields['BIRTHDAY_SORT'] = \Bitrix\Crm\BirthdayReminder::prepareSorting('');
     }
     if (!isset($arFields['STATUS_ID']) || $arFields['STATUS_ID'] === '') {
         $arFields['STATUS_ID'] = 'NEW';
     }
     if (isset($arFields['DATE_CLOSED'])) {
         unset($arFields['DATE_CLOSED']);
     }
     self::EnsureStatusesLoaded();
     if (in_array($arFields['STATUS_ID'], self::$LEAD_STATUSES_BY_GROUP['FINISHED'])) {
         $arFields['~DATE_CLOSED'] = $DB->CurrentTimeFunction();
     }
     $arAttr = array();
     $arAttr['STATUS_ID'] = $arFields['STATUS_ID'];
     if (!empty($arFields['OPENED'])) {
         $arAttr['OPENED'] = $arFields['OPENED'];
     }
     $sPermission = 'ADD';
     if (isset($arFields['PERMISSION'])) {
         if ($arFields['PERMISSION'] == 'IMPORT') {
             $sPermission = 'IMPORT';
         }
         unset($arFields['PERMISSION']);
     }
     if ($this->bCheckPermission) {
         $arEntityAttr = self::BuildEntityAttr($iUserId, $arAttr);
         $userPerms = $iUserId == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($iUserId);
         $sEntityPerm = $userPerms->GetPermType('LEAD', $sPermission, $arEntityAttr);
         if ($sEntityPerm == BX_CRM_PERM_NONE) {
             $this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED');
             $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
             return false;
         }
         $assignedByID = intval($arFields['ASSIGNED_BY_ID']);
         if ($sEntityPerm == BX_CRM_PERM_SELF && $assignedByID != $iUserId) {
             $arFields['ASSIGNED_BY_ID'] = $iUserId;
         }
         if ($sEntityPerm == BX_CRM_PERM_OPEN && $iUserId == $assignedByID) {
             $arFields['OPENED'] = 'Y';
         }
     }
     $assignedByID = intval($arFields['ASSIGNED_BY_ID']);
     $arEntityAttr = self::BuildEntityAttr($assignedByID, $arAttr);
     $userPerms = $assignedByID == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($assignedByID);
     $sEntityPerm = $userPerms->GetPermType('LEAD', $sPermission, $arEntityAttr);
     $this->PrepareEntityAttrs($arEntityAttr, $sEntityPerm);
     // Calculation of Account Data
     $accData = CCrmAccountingHelper::PrepareAccountingData(array('CURRENCY_ID' => isset($arFields['CURRENCY_ID']) ? $arFields['CURRENCY_ID'] : null, 'SUM' => isset($arFields['OPPORTUNITY']) ? $arFields['OPPORTUNITY'] : null, 'EXCH_RATE' => isset($arFields['EXCH_RATE']) ? $arFields['EXCH_RATE'] : null));
     if (is_array($accData)) {
         $arFields['ACCOUNT_CURRENCY_ID'] = $accData['ACCOUNT_CURRENCY_ID'];
         $arFields['OPPORTUNITY_ACCOUNT'] = $accData['ACCOUNT_SUM'];
     }
     if (isset($arFields['NAME']) || isset($arFields['LAST_NAME'])) {
         $arFields['FULL_NAME'] = trim((isset($arFields['NAME']) ? $arFields['NAME'] : '') . ' ' . (isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : ''));
     }
     $beforeEvents = GetModuleEvents('crm', 'OnBeforeCrmLeadAdd');
     while ($arEvent = $beforeEvents->Fetch()) {
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:crm_lead.php

示例7: Add

 public function Add(array &$arFields, $bUpdateSearch = true, $options = array())
 {
     global $DB;
     if (!is_array($options)) {
         $options = array();
     }
     $this->LAST_ERROR = '';
     $iUserId = CCrmSecurityHelper::GetCurrentUserID();
     if (isset($arFields['ID'])) {
         unset($arFields['ID']);
     }
     if (isset($arFields['DATE_CREATE'])) {
         unset($arFields['DATE_CREATE']);
     }
     $arFields['~DATE_CREATE'] = $DB->CurrentTimeFunction();
     $arFields['~DATE_MODIFY'] = $DB->CurrentTimeFunction();
     if (!isset($arFields['CREATED_BY_ID']) || (int) $arFields['CREATED_BY_ID'] <= 0) {
         $arFields['CREATED_BY_ID'] = $iUserId;
     }
     if (!isset($arFields['MODIFY_BY_ID']) || (int) $arFields['MODIFY_BY_ID'] <= 0) {
         $arFields['MODIFY_BY_ID'] = $iUserId;
     }
     if (isset($arFields['ASSIGNED_BY_ID']) && is_array($arFields['ASSIGNED_BY_ID'])) {
         $arFields['ASSIGNED_BY_ID'] = count($arFields['ASSIGNED_BY_ID']) > 0 ? intval($arFields['ASSIGNED_BY_ID'][0]) : $iUserId;
     }
     if (!isset($arFields['ASSIGNED_BY_ID']) || (int) $arFields['ASSIGNED_BY_ID'] <= 0) {
         $arFields['ASSIGNED_BY_ID'] = $iUserId;
     }
     if (!$this->CheckFields($arFields, false, $options)) {
         $result = false;
         $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
     } else {
         if (!isset($arFields['STAGE_ID'])) {
             $arFields['STAGE_ID'] = 'NEW';
         }
         $arAttr = array();
         if (!empty($arFields['STAGE_ID'])) {
             $arAttr['STAGE_ID'] = $arFields['STAGE_ID'];
         }
         if (!empty($arFields['OPENED'])) {
             $arAttr['OPENED'] = $arFields['OPENED'];
         }
         $sPermission = 'ADD';
         if (isset($arFields['PERMISSION'])) {
             if ($arFields['PERMISSION'] == 'IMPORT') {
                 $sPermission = 'IMPORT';
             }
             unset($arFields['PERMISSION']);
         }
         if ($this->bCheckPermission) {
             $arEntityAttr = self::BuildEntityAttr($iUserId, $arAttr);
             $userPerms = $iUserId == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($iUserId);
             $sEntityPerm = $userPerms->GetPermType('DEAL', $sPermission, $arEntityAttr);
             if ($sEntityPerm == BX_CRM_PERM_NONE) {
                 $this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED');
                 $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
                 return false;
             }
             $assignedByID = intval($arFields['ASSIGNED_BY_ID']);
             if ($sEntityPerm == BX_CRM_PERM_SELF && $assignedByID != $iUserId) {
                 $arFields['ASSIGNED_BY_ID'] = $iUserId;
             }
             if ($sEntityPerm == BX_CRM_PERM_OPEN && $iUserId == $assignedByID) {
                 $arFields['OPENED'] = 'Y';
             }
         }
         $assignedByID = intval($arFields['ASSIGNED_BY_ID']);
         $arEntityAttr = self::BuildEntityAttr($assignedByID, $arAttr);
         $userPerms = $assignedByID == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($assignedByID);
         $sEntityPerm = $userPerms->GetPermType('DEAL', $sPermission, $arEntityAttr);
         $this->PrepareEntityAttrs($arEntityAttr, $sEntityPerm);
         // Calculation of Account Data
         $accData = CCrmAccountingHelper::PrepareAccountingData(array('CURRENCY_ID' => isset($arFields['CURRENCY_ID']) ? $arFields['CURRENCY_ID'] : null, 'SUM' => isset($arFields['OPPORTUNITY']) ? $arFields['OPPORTUNITY'] : null, 'EXCH_RATE' => isset($arFields['EXCH_RATE']) ? $arFields['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'] : null, 'SUM' => isset($arFields['TAX_VALUE']) ? $arFields['TAX_VALUE'] : null, 'EXCH_RATE' => isset($arFields['EXCH_RATE']) ? $arFields['EXCH_RATE'] : null));
         if (is_array($accData)) {
             $arFields['TAX_VALUE_ACCOUNT'] = $accData['ACCOUNT_SUM'];
         }
         $now = ConvertTimeStamp(time(), 'SHORT', SITE_ID);
         $arFields['~BEGINDATE'] = $DB->CharToDateFunction(isset($arFields['BEGINDATE']) && $arFields['BEGINDATE'] !== '' ? $arFields['BEGINDATE'] : $now, 'SHORT', false);
         if (isset($arFields['BEGINDATE'])) {
             $arFields['__BEGINDATE'] = $arFields['BEGINDATE'];
             unset($arFields['BEGINDATE']);
         }
         $isFinalStage = self::GetStageSemantics($arFields['STAGE_ID']) !== 'process';
         $enableCloseDateSync = \Bitrix\Crm\Settings\DealSettings::isCloseDateSyncEnabled();
         $arFields['CLOSED'] = $isFinalStage ? 'Y' : 'N';
         if ($enableCloseDateSync && $isFinalStage) {
             $arFields['CLOSEDATE'] = $now;
             $arFields['~CLOSEDATE'] = $DB->CharToDateFunction($now, 'SHORT', false);
         } elseif ($isFinalStage && (!isset($arFields['CLOSEDATE']) || $arFields['CLOSEDATE'] === '')) {
             $arFields['CLOSEDATE'] = $now;
             $arFields['~CLOSEDATE'] = $DB->CharToDateFunction($now, 'SHORT', false);
         } elseif (isset($arFields['CLOSEDATE']) && $arFields['CLOSEDATE'] !== '') {
             $arFields['~CLOSEDATE'] = $DB->CharToDateFunction($arFields['CLOSEDATE'], 'SHORT', false);
         }
         if (isset($arFields['CLOSEDATE'])) {
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:crm_deal.php

示例8: ob_get_clean

        CCrmViewHelper::RenderWidgetFilterPeriod(array('CONFIG' => $arResult['WIDGET_FILTER'], 'EDITOR_ID' => $periodEditorID, 'PARAM_ID' => $elementID, 'PARAM_NAME' => $filterID));
        $val = ob_get_clean();
        $arResult['FILTER'][$i]['type'] = 'custom';
        $arResult['FILTER'][$i]['enableWrapper'] = false;
        $arResult['FILTER'][$i]['value'] = $val;
        $filterFieldInfo = array('typeName' => 'WIDGET_PERIOD', 'id' => $filterID, 'params' => array('data' => array('paramName' => "{$filterID}", 'elementId' => $elementID), 'editor' => array('id' => $periodEditorID)));
        $filterFieldInfos[] = $filterFieldInfo;
    }
}
?>
<div class="crm-btn-panel"><span id="<?php 
echo htmlspecialcharsbx($settingButtonID);
?>
" class="crm-btn-panel-btn"></span></div>
<div class="crm-filter-wrap"><?php 
$counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentDealActivies);
$APPLICATION->IncludeComponent('bitrix:crm.interface.filter', 'flat', array('GRID_ID' => $quid, 'FILTER' => $arResult['FILTER'], 'FILTER_ROWS' => $arResult['FILTER_ROWS'], 'FILTER_FIELDS' => $arResult['FILTER_FIELDS'], 'FILTER_PRESETS' => $arResult['FILTER_PRESETS'], 'RENDER_FILTER_INTO_VIEW' => false, 'OPTIONS' => $arResult['OPTIONS'], 'ENABLE_PROVIDER' => true, 'NAVIGATION_BAR' => array('ITEMS' => array(array('icon' => 'table', 'id' => 'list', 'active' => false, 'counter' => $counter->GetValue(false), 'url' => $arResult['PATH_TO_LIST'], 'hint' => array('title' => GetMessage('CRM_WGT_LIST_HINT_TITLE'), 'content' => GetMessage('CRM_WGT_LIST_HINT_CONTENT'), 'disabling' => GetMessage('CRM_WGT_DISABLE_LIST_HINT'))), array('icon' => 'chart', 'id' => 'widget', 'active' => true, 'url' => $arResult['PATH_TO_WIDGET'])), 'BINDING' => array('category' => 'crm.navigation', 'name' => 'index', 'key' => strtolower($arResult['NAVIGATION_CONTEXT_ID'])))), $component, array('HIDE_ICONS' => true));
?>
</div><?php 
if ($arResult['NEED_FOR_REBUILD_DEAL_STATISTICS']) {
    ?>
<div id="rebuildDealStatsMsg" class="crm-view-message">
		<?php 
    echo GetMessage('CRM_WGT_REBUILD_DEAL_STATISTICS', array('#ID#' => 'rebuildDealStatsLink', '#URL#' => '#'));
    ?>
	</div><?php 
}
?>
<div class="<?php 
echo $className;
?>
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:template.php

示例9: array

        $filterFieldInfo = array('typeName' => 'USER', 'id' => $filterID, 'params' => array('data' => array('paramName' => "{$filterID}", 'elementId' => "{$prefix}_{$filterID}"), 'search' => array('paramName' => "{$filterID}_name", 'elementId' => "{$prefix}_{$filterID}_NAME")));
        $gridManagerCfg['filterFields'][] = $filterFieldInfo;
    }
}
$arResult['GRID_DATA'] = array();
foreach ($arResult['EVENT'] as $arEvent) {
    $arEvent['FILE_HTML'] = "";
    if (!empty($arEvent['FILES'])) {
        $arEvent['FILE_HTML'] = '<div class="event-detail-files"><label class="event-detail-files-title">' . GetMessage('CRM_EVENT_TABLE_FILES') . ':</label><div class="event-detail-files-list">';
        foreach ($arEvent['FILES'] as $key => $value) {
            $arEvent['FILE_HTML'] .= '<div class="event-detail-file"><span class="event-detail-file-number">' . $key . '.</span><span class="event-detail-file-info"><a href="' . htmlspecialcharsbx($value['PATH']) . '" target="_blank" class="event-detail-file-link">' . htmlspecialcharsbx($value['NAME']) . '</a><span class="event-detail-file-size">(' . htmlspecialcharsbx($value['SIZE']) . ')</span></span></div>';
        }
        $arEvent['FILE_HTML'] .= '</div></div>';
    }
    $arActions = array();
    if (CCrmPerms::IsAdmin() || $arEvent['CREATED_BY_ID'] == CCrmPerms::GetCurrentUserID() && $arEvent['EVENT_TYPE'] == 0) {
        $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_EVENT_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_EVENT_DELETE'), 'ONCLICK' => "BX.CrmEventListManager.items[\"{$managerID}\"].deleteItem(\"{$arEvent['ID']}\")");
    }
    $eventColor = '';
    if ($arEvent['EVENT_TYPE'] == '0') {
        $eventColor = 'color: #208c0b';
    } elseif ($arEvent['EVENT_TYPE'] == '2') {
        $eventColor = 'color: #9c8000';
    }
    $arColumns = array('CREATED_BY_FULL_NAME' => $arEvent['CREATED_BY_FULL_NAME'] == '' ? '' : '<a href="' . $arEvent['CREATED_BY_LINK'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arEvent['ID'] . '">' . $arEvent['CREATED_BY_FULL_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arEvent['CREATED_BY_ID'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arEvent['ID'] . '", "");</script>', 'EVENT_NAME' => '<span style="' . $eventColor . '">' . $arEvent['EVENT_NAME'] . '</span>', 'EVENT_DESC' => $arEvent['EVENT_DESC'] . $arEvent['FILE_HTML'], 'DATE_CREATE' => FormatDate('x', MakeTimeStamp($arEvent['DATE_CREATE']), time() + CTimeZone::GetOffset()));
    if ($arResult['EVENT_ENTITY_LINK'] == 'Y') {
        $arColumns['ENTITY_TYPE'] = !empty($arEvent['ENTITY_TYPE']) ? GetMessage('CRM_EVENT_ENTITY_TYPE_' . $arEvent['ENTITY_TYPE']) : '';
        $arColumns['ENTITY_TITLE'] = !empty($arEvent['ENTITY_TITLE']) ? '<a href="' . $arEvent['ENTITY_LINK'] . '" id="balloon_' . $arResult['GRID_ID'] . '_I_' . $arEvent['ID'] . '">' . $arEvent['ENTITY_TITLE'] . '</a>' . '<script type="text/javascript">BX.tooltip("' . $arEvent['ENTITY_TYPE'] . '_' . $arEvent['ENTITY_ID'] . '", "balloon_' . $arResult['GRID_ID'] . '_I_' . $arEvent['ID'] . '", "/bitrix/components/bitrix/crm.' . strtolower($arEvent['ENTITY_TYPE']) . '.show/card.ajax.php", "crm_balloon' . ($arEvent['ENTITY_TYPE'] == 'LEAD' || $arEvent['ENTITY_TYPE'] == 'DEAL' || $arEvent['ENTITY_TYPE'] == 'QUOTE' ? '_no_photo' : '_' . strtolower($arEvent['ENTITY_TYPE'])) . '", true);</script>' : '';
    } else {
        unset($arEvent['ENTITY_TYPE']);
        unset($arEvent['ENTITY_TITLE']);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:template.php

示例10: Add

 public function Add(array &$arFields, $bUpdateSearch = true, $options = array())
 {
     global $DB;
     if (!is_array($options)) {
         $options = array();
     }
     $this->LAST_ERROR = '';
     $iUserId = CCrmSecurityHelper::GetCurrentUserID();
     if (isset($arFields['ID'])) {
         unset($arFields['ID']);
     }
     if (isset($arFields['DATE_CREATE'])) {
         unset($arFields['DATE_CREATE']);
     }
     $arFields['~DATE_CREATE'] = $DB->CurrentTimeFunction();
     $arFields['~DATE_MODIFY'] = $DB->CurrentTimeFunction();
     if (!isset($arFields['CREATED_BY_ID']) || intval($arFields['CREATED_BY_ID']) <= 0) {
         $arFields['CREATED_BY_ID'] = $iUserId;
     }
     if (!isset($arFields['MODIFY_BY_ID']) || intval($arFields['MODIFY_BY_ID']) <= 0) {
         $arFields['MODIFY_BY_ID'] = $iUserId;
     }
     if (!isset($arFields['ASSIGNED_BY_ID']) || intval($arFields['ASSIGNED_BY_ID']) <= 0) {
         $arFields['ASSIGNED_BY_ID'] = $iUserId;
     }
     if (isset($arFields['REVENUE'])) {
         $arFields['REVENUE'] = floatval($arFields['REVENUE']);
     }
     if (!$this->CheckFields($arFields, false, $options)) {
         $result = false;
         $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
     } else {
         $arAttr = array();
         if (!empty($arFields['OPENED'])) {
             $arAttr['OPENED'] = $arFields['OPENED'];
         }
         $sPermission = 'ADD';
         if (isset($arFields['PERMISSION'])) {
             if ($arFields['PERMISSION'] == 'IMPORT') {
                 $sPermission = 'IMPORT';
             }
             unset($arFields['PERMISSION']);
         }
         if ($this->bCheckPermission) {
             $arEntityAttr = self::BuildEntityAttr($iUserId, $arAttr);
             $userPerms = $iUserId == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($iUserId);
             $sEntityPerm = $userPerms->GetPermType('COMPANY', $sPermission, $arEntityAttr);
             if ($sEntityPerm == BX_CRM_PERM_NONE) {
                 $this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED');
                 $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
                 return false;
             }
             $assignedByID = intval($arFields['ASSIGNED_BY_ID']);
             if ($sEntityPerm == BX_CRM_PERM_SELF && $assignedByID != $iUserId) {
                 $arFields['ASSIGNED_BY_ID'] = $iUserId;
             }
             if ($sEntityPerm == BX_CRM_PERM_OPEN && $iUserId == $assignedByID) {
                 $arFields['OPENED'] = 'Y';
             }
         }
         $assignedByID = intval($arFields['ASSIGNED_BY_ID']);
         $arEntityAttr = self::BuildEntityAttr($assignedByID, $arAttr);
         $userPerms = $assignedByID == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($assignedByID);
         $sEntityPerm = $userPerms->GetPermType('COMPANY', $sPermission, $arEntityAttr);
         $this->PrepareEntityAttrs($arEntityAttr, $sEntityPerm);
         if (isset($arFields['LOGO']) && is_array($arFields['LOGO']) && strlen(CFile::CheckImageFile($arFields['LOGO'])) === 0) {
             $arFields['LOGO']['MODULE_ID'] = 'crm';
             CFile::SaveForDB($arFields, 'LOGO', 'crm');
         }
         $beforeEvents = GetModuleEvents('crm', 'OnBeforeCrmCompanyAdd');
         while ($arEvent = $beforeEvents->Fetch()) {
             if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
                 if (isset($arFields['RESULT_MESSAGE'])) {
                     $this->LAST_ERROR = $arFields['RESULT_MESSAGE'];
                 } else {
                     $this->LAST_ERROR = GetMessage('CRM_COMPANY_CREATION_CANCELED', array('#NAME#' => $arEvent['TO_NAME']));
                     $arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
                 }
                 return false;
             }
         }
         $ID = intval($DB->Add('b_crm_company', $arFields, array(), 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__));
         $result = $arFields['ID'] = $ID;
         CCrmPerms::UpdateEntityAttr('COMPANY', $ID, $arEntityAttr);
         \Bitrix\Crm\Integrity\DuplicateOrganizationCriterion::register(CCrmOwnerType::Company, $ID, $arFields['TITLE']);
         CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => true));
         $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']);
             $emails = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($arFields['FM'], 'EMAIL');
             if (!empty($emails)) {
                 \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Company, $ID, 'EMAIL', $emails);
             }
             $phones = Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($arFields['FM'], 'PHONE');
             if (!empty($phones)) {
                 \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Company, $ID, 'PHONE', $phones);
             }
         }
         \Bitrix\Crm\Integrity\DuplicateEntityRanking::registerEntityStatistics(CCrmOwnerType::Company, $ID, $arFields);
//.........这里部分代码省略.........
开发者ID:konvita2,项目名称:portal,代码行数:101,代码来源:crm_company.php

示例11: findByPhoneNumber

 public static function findByPhoneNumber($number, $params = array())
 {
     if (!is_string($number)) {
         throw new \Bitrix\Main\ArgumentTypeException('number', 'string');
     }
     if ($number === '') {
         throw new \Bitrix\Main\ArgumentException('Is empty', 'number');
     }
     if (!is_array($params)) {
         $params = array();
     }
     $userID = isset($params['USER_ID']) ? intval($params['USER_ID']) : 0;
     if ($userID <= 0) {
         $userID = CCrmPerms::GetCurrentUserID();
     }
     $isAdmin = CCrmPerms::IsAdmin($userID);
     $userPermissions = CCrmPerms::GetUserPermissions($userID);
     $enableExtendedMode = isset($params['ENABLE_EXTENDED_MODE']) ? (bool) $params['ENABLE_EXTENDED_MODE'] : true;
     $contactFormID = isset($params['CONTACT_FORM_ID']) ? intval($params['CONTACT_FORM_ID']) : '';
     if ($contactFormID === '') {
         $contactFormID = CCrmContact::DEFAULT_FORM_ID;
     }
     $dups = array();
     $criterion = new \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion('PHONE', $number);
     $entityTypes = array(CCrmOwnerType::Contact, CCrmOwnerType::Company, CCrmOwnerType::Lead);
     foreach ($entityTypes as $entityType) {
         $duplicate = $criterion->find($entityType, 1);
         if ($duplicate !== null) {
             $dups[] = $duplicate;
         }
     }
     $entityByType = array();
     foreach ($dups as &$dup) {
         /** @var \Bitrix\Crm\Integrity\Duplicate $dup */
         $entities = $dup->getEntities();
         if (!(is_array($entities) && !empty($entities))) {
             continue;
         }
         //Each entity type limited by 50 items
         foreach ($entities as &$entity) {
             /** @var \Bitrix\Crm\Integrity\DuplicateEntity $entity */
             $entityTypeID = $entity->getEntityTypeID();
             $entityID = $entity->getEntityID();
             $fields = null;
             if ($entityTypeID === CCrmOwnerType::Contact) {
                 $dbEntity = CCrmContact::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO', 'POST', 'COMPANY_ID', 'COMPANY_TITLE', 'ASSIGNED_BY_ID'));
                 $entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
                 if (is_array($entityFields)) {
                     $formattedName = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($entityFields['HONORIFIC']) ? $entityFields['HONORIFIC'] : '', 'NAME' => isset($entityFields['NAME']) ? $entityFields['NAME'] : '', 'SECOND_NAME' => isset($entityFields['SECOND_NAME']) ? $entityFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($entityFields['LAST_NAME']) ? $entityFields['LAST_NAME'] : ''));
                     $fields = array('ID' => intval($entityFields['ID']), 'FORMATTED_NAME' => $formattedName, 'PHOTO' => isset($entityFields['PHOTO']) ? intval($entityFields['PHOTO']) : 0, 'COMPANY_ID' => isset($entityFields['COMPANY_ID']) ? intval($entityFields['COMPANY_ID']) : 0, 'COMPANY_TITLE' => isset($entityFields['COMPANY_TITLE']) ? $entityFields['COMPANY_TITLE'] : '', 'POST' => isset($entityFields['POST']) ? $entityFields['POST'] : '', 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmContact::CheckReadPermission($entityID, $userPermissions));
                     if ($fields['CAN_READ'] && $enableExtendedMode) {
                         $deals = array();
                         $dbDeal = CCrmDeal::GetListEx(array('BEGINDATE' => 'ASC'), array('=CONTACT_ID' => $entityID, 'CLOSED' => 'N', 'CHECK_PERMISSIONS' => $isAdmin ? 'N' : 'Y'), false, array('nTopCount' => 2), array('ID', 'TITLE', 'STAGE_ID'), array('PERMS' => $userPermissions));
                         if (is_object($dbDeal)) {
                             while ($dealFields = $dbDeal->Fetch()) {
                                 $dealID = intval($dealFields['ID']);
                                 //$dealFields['CAN_READ'] = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
                                 $dealFields['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $dealID);
                                 $deals[] = $dealFields;
                             }
                         }
                         $fields['DEALS'] =& $deals;
                         unset($deals);
                     }
                 }
             } elseif ($entityTypeID === CCrmOwnerType::Company) {
                 $dbEntity = CCrmCompany::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'LOGO', 'ASSIGNED_BY_ID'));
                 $entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
                 if (is_array($entityFields)) {
                     $fields = array('ID' => intval($entityFields['ID']), 'TITLE' => isset($entityFields['TITLE']) ? $entityFields['TITLE'] : '', 'LOGO' => isset($entityFields['LOGO']) ? intval($entityFields['LOGO']) : 0, 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmCompany::CheckReadPermission($entityID, $userPermissions));
                     if ($fields['CAN_READ'] && $enableExtendedMode) {
                         $deals = array();
                         $dbDeal = CCrmDeal::GetListEx(array('BEGINDATE' => 'ASC'), array('=COMPANY_ID' => $entityID, 'CLOSED' => 'N', 'CHECK_PERMISSIONS' => $isAdmin ? 'N' : 'Y'), false, array('nTopCount' => 2), array('ID', 'TITLE', 'STAGE_ID'), array('PERMS' => $userPermissions));
                         if (is_object($dbDeal)) {
                             while ($dealFields = $dbDeal->Fetch()) {
                                 $dealID = intval($dealFields['ID']);
                                 //$dealFields['CAN_READ'] = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
                                 $dealFields['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $dealID);
                                 $deals[] = $dealFields;
                             }
                         }
                         $fields['DEALS'] =& $deals;
                         unset($deals);
                     }
                 }
             } elseif ($entityTypeID === CCrmOwnerType::Lead) {
                 $dbEntity = CCrmLead::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'POST', 'COMPANY_TITLE', 'ASSIGNED_BY_ID'));
                 $entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
                 if (is_array($entityFields)) {
                     $formattedName = '';
                     if (!empty($entityFields['NAME']) || !empty($entityFields['SECOND_NAME']) || !empty($entityFields['LAST_NAME'])) {
                         $formattedName = CCrmLead::PrepareFormattedName(array('HONORIFIC' => isset($entityFields['HONORIFIC']) ? $entityFields['HONORIFIC'] : '', 'NAME' => isset($entityFields['NAME']) ? $entityFields['NAME'] : '', 'SECOND_NAME' => isset($entityFields['SECOND_NAME']) ? $entityFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($entityFields['LAST_NAME']) ? $entityFields['LAST_NAME'] : ''));
                     }
                     $fields = array('ID' => intval($entityFields['ID']), 'TITLE' => isset($entityFields['TITLE']) ? $entityFields['TITLE'] : '', 'FORMATTED_NAME' => $formattedName, 'COMPANY_TITLE' => isset($entityFields['COMPANY_TITLE']) ? $entityFields['COMPANY_TITLE'] : '', 'POST' => isset($entityFields['POST']) ? $entityFields['POST'] : '', 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmLead::CheckReadPermission($entityID, $userPermissions));
                 }
             }
             if (!is_array($fields)) {
                 continue;
             }
             if ($fields['CAN_READ'] && $enableExtendedMode) {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:sip_helper.php

示例12: Add

 public function Add($arFields, &$arRecalculated = false, $siteId = SITE_ID, $options = array())
 {
     /** @global \CDatabase $DB */
     global $DB;
     if (!CModule::IncludeModule('sale')) {
         return false;
     }
     if (!is_array($options)) {
         $options = array();
     }
     $bRecalculate = is_array($arRecalculated);
     $orderID = false;
     $tmpOrderId = intval($arFields['ID']) <= 0 ? 0 : $arFields['ID'];
     if (isset($arFields['ID'])) {
         unset($arFields['ID']);
     }
     $arPrevOrder = $tmpOrderId !== 0 ? CCrmInvoice::GetByID($tmpOrderId) : null;
     $userId = CCrmSecurityHelper::GetCurrentUserID();
     if (!isset($arFields['RESPONSIBLE_ID']) || (int) $arFields['RESPONSIBLE_ID'] <= 0) {
         if (is_array($arPrevOrder) && isset($arPrevOrder['RESPONSIBLE_ID']) && intval($arPrevOrder['RESPONSIBLE_ID']) > 0) {
             $arFields['RESPONSIBLE_ID'] = $arPrevOrder['RESPONSIBLE_ID'];
         } else {
             $arFields['RESPONSIBLE_ID'] = $userId;
         }
     }
     $orderStatus = '';
     if (isset($arFields['STATUS_ID'])) {
         $orderStatus = $arFields['STATUS_ID'];
         unset($arFields['STATUS_ID']);
     }
     // prepare entity permissions
     $arAttr = array();
     if (!empty($arFields['OPENED'])) {
         $arAttr['OPENED'] = $arFields['OPENED'];
     }
     $sPermission = $tmpOrderId > 0 ? 'WRITE' : 'ADD';
     if ($this->bCheckPermission) {
         $arEntityAttr = self::BuildEntityAttr($userId, $arAttr);
         $userPerms = $userId == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($userId);
         $sEntityPerm = $userPerms->GetPermType('INVOICE', $sPermission, $arEntityAttr);
         if ($sEntityPerm == BX_CRM_PERM_NONE) {
             $this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED');
             $GLOBALS['APPLICATION']->ThrowException($this->LAST_ERROR);
             return false;
         }
         $responsibleID = intval($arFields['RESPONSIBLE_ID']);
         if ($sEntityPerm == BX_CRM_PERM_SELF && $responsibleID != $userId) {
             $arFields['RESPONSIBLE_ID'] = $userId;
         }
         if ($sEntityPerm == BX_CRM_PERM_OPEN && $userId == $responsibleID) {
             $arFields['OPENED'] = 'Y';
         }
     }
     $responsibleID = intval($arFields['RESPONSIBLE_ID']);
     $arEntityAttr = self::BuildEntityAttr($responsibleID, $arAttr);
     $userPerms = $responsibleID == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($responsibleID);
     $sEntityPerm = $userPerms->GetPermType('INVOICE', $sPermission, $arEntityAttr);
     $this->PrepareEntityAttrs($arEntityAttr, $sEntityPerm);
     // date fields
     if ($tmpOrderId === 0) {
         $arFields['~DATE_BILL'] = $DB->CharToDateFunction(isset($arFields['DATE_BILL']) && $arFields['DATE_BILL'] !== '' ? $arFields['DATE_BILL'] : ConvertTimeStamp(time(), 'SHORT', SITE_ID), 'SHORT', false);
     } else {
         if (isset($arFields['DATE_BILL']) && $arFields['DATE_BILL'] !== '') {
             $arFields['~DATE_BILL'] = $DB->CharToDateFunction($arFields['DATE_BILL'], 'SHORT', false);
         }
     }
     unset($arFields['DATE_BILL']);
     if (isset($arFields['DATE_PAY_BEFORE']) && $arFields['DATE_PAY_BEFORE'] !== '') {
         $arFields['~DATE_PAY_BEFORE'] = $DB->CharToDateFunction($arFields['DATE_PAY_BEFORE'], 'SHORT', false);
     }
     unset($arFields['DATE_PAY_BEFORE']);
     if ($tmpOrderId !== 0 && !isset($arFields['PRODUCT_ROWS']) && !isset($arFields['INVOICE_PROPERTIES'])) {
         if (!is_array($arPrevOrder)) {
             return false;
         }
         $prevResponsibleID = isset($arPrevOrder['RESPONSIBLE_ID']) ? intval($arPrevOrder['RESPONSIBLE_ID']) : 0;
         $responsibleID = isset($arFields['RESPONSIBLE_ID']) ? intval($arFields['RESPONSIBLE_ID']) : 0;
         $prevStatusID = isset($arPrevOrder['STATUS_ID']) ? $arPrevOrder['STATUS_ID'] : '';
         // simple update order fields
         $CSaleOrder = new CSaleOrder();
         $orderID = $CSaleOrder->Update($tmpOrderId, $arFields);
         CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
         $GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $tmpOrderId, $arFields);
         $registerSonetEvent = isset($options['REGISTER_SONET_EVENT']) && $options['REGISTER_SONET_EVENT'] === true;
         if (is_int($orderID) && $orderID > 0) {
             if ($registerSonetEvent) {
                 $newDealID = isset($arFields['UF_DEAL_ID']) ? intval($arFields['UF_DEAL_ID']) : 0;
                 $oldDealID = isset($arPrevOrder['UF_DEAL_ID']) ? intval($arPrevOrder['UF_DEAL_ID']) : 0;
                 $newCompanyID = isset($arFields['UF_COMPANY_ID']) ? intval($arFields['UF_COMPANY_ID']) : 0;
                 $oldCompanyID = isset($arPrevOrder['UF_COMPANY_ID']) ? intval($arPrevOrder['UF_COMPANY_ID']) : 0;
                 $newContactID = isset($arFields['UF_CONTACT_ID']) ? intval($arFields['UF_CONTACT_ID']) : 0;
                 $oldContactID = isset($arPrevOrder['UF_CONTACT_ID']) ? intval($arPrevOrder['UF_CONTACT_ID']) : 0;
                 $parents = array();
                 $parentsChanged = $newDealID !== $oldDealID || $newCompanyID !== $oldCompanyID || $newContactID !== $oldContactID;
                 if ($parentsChanged) {
                     if ($newDealID > 0) {
                         $parents[] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Deal, 'ENTITY_ID' => $newDealID);
                     }
                     if ($newCompanyID > 0) {
                         $parents[] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $newCompanyID);
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:crm_invoice.php

示例13: ShowError

    ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED'));
    return;
}
if (!CCrmPerms::IsAccessEnabled()) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
$arResult['CAN_EDIT'] = $arResult['CAN_DELETE'] = true;
global $APPLICATION;
$curPageUrl = $APPLICATION->GetCurPage();
$arParams['PATH_TO_MAIL_TEMPLATE_LIST'] = CrmCheckPath('PATH_TO_MAIL_TEMPLATE_LIST', $arParams['PATH_TO_MAIL_TEMPLATE_LIST'], $curPageUrl);
$arParams['PATH_TO_MAIL_TEMPLATE_EDIT'] = CrmCheckPath('PATH_TO_MAIL_TEMPLATE_EDIT', $arParams['PATH_TO_MAIL_TEMPLATE_EDIT'], $curPageUrl . '?element_id=#element_id#&edit');
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$userID = isset($arParams['USER_ID']) ? intval($arParams['USER_ID']) : 0;
if ($userID <= 0) {
    $userID = CCrmPerms::GetCurrentUserID();
}
$arResult['USER_ID'] = $userID;
$arResult['GRID_ID'] = 'CRM_MAIL_TEMPLATE_LIST';
$arResult['FORM_ID'] = isset($arParams['FORM_ID']) ? $arParams['FORM_ID'] : '';
$arResult['TAB_ID'] = isset($arParams['TAB_ID']) ? $arParams['TAB_ID'] : '';
$arResult['HEADERS'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_ID'), 'sort' => 'ID', 'default' => false, 'editable' => false), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_TITLE'), 'sort' => 'TITLE', 'default' => true, 'editable' => true, 'params' => array('size' => 60)), array('id' => 'SORT', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_SORT'), 'sort' => 'SORT', 'default' => true, 'editable' => true), array('id' => 'ENTITY_TYPE_NAME', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_ENTITY_TYPE'), 'default' => true, 'editable' => false), array('id' => 'SCOPE_NAME', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_SCOPE'), 'default' => true, 'editable' => false), array('id' => 'IS_ACTIVE', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_IS_ACTIVE'), 'sort' => 'IS_ACTIVE', 'default' => true, 'editable' => true, 'type' => 'checkbox'), array('id' => 'OWNER_FORMATTED_NAME', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_OWNER'), 'default' => false, 'editable' => false), array('id' => 'CREATED', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_CREATED'), 'sort' => 'CREATED', 'default' => false, 'editable' => false), array('id' => 'LAST_UPDATED', 'name' => GetMessage('CRM_COLUMN_MAIL_TEMPLATE_LAST_UPDATED'), 'sort' => 'LAST_UPDATED', 'default' => false, 'editable' => false));
if (check_bitrix_sessid()) {
    if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action_button_' . $arResult['GRID_ID']])) {
        $action = $_POST['action_button_' . $arResult['GRID_ID']];
        if ($arResult['CAN_DELETE'] && $action === 'delete') {
            if ($_POST['action_all_rows_' . $arResult['GRID_ID']] == 'Y') {
                //Delete all user items
                $dbResult = CCrmMailTemplate::GetList(array(), array('=OWNER_ID' => $userID), false, false, array('TITLE'));
                while ($fields = $dbResult->Fetch()) {
                    if (!CCrmMailTemplate::Delete($fields['ID'])) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例14: Update

 public static function Update($ID, &$arFields, $options = null)
 {
     global $DB;
     self::ClearErrors();
     if (!is_array($options)) {
         $options = array();
     }
     if (!self::CheckFields('UPDATE', $arFields, $ID)) {
         return false;
     }
     if (isset($arFields['SCOPE']) && !CCrmMailTemplateScope::IsDefined($arFields['SCOPE'])) {
         $arFields['SCOPE'] = CCrmMailTemplateScope::Personal;
     }
     if (isset($arFields['CREATED'])) {
         unset($arFields['CREATED']);
     }
     if (isset($arFields['LAST_UPDATED'])) {
         unset($arFields['LAST_UPDATED']);
     }
     $arFields['~LAST_UPDATED'] = $DB->CurrentTimeFunction();
     if (isset($arFields['AUTHOR_ID'])) {
         unset($arFields['AUTHOR_ID']);
     }
     $currentUserID = isset($options['CURRENT_USER_ID']) ? intval($options['CURRENT_USER_ID']) : CCrmPerms::GetCurrentUserID();
     if (!isset($arFields['EDITOR_ID'])) {
         $arFields['EDITOR_ID'] = $currentUserID;
     }
     $arRecordBindings = array();
     if (isset($arFields['BODY'])) {
         $arRecordBindings['BODY'] = $arFields['BODY'];
     }
     $tableName = CCrmMailTemplate::TABLE_NAME;
     $sql = 'UPDATE ' . $tableName . ' SET ' . $DB->PrepareUpdate($tableName, $arFields) . ' WHERE ID = ' . $ID;
     if (!empty($arRecordBindings)) {
         $DB->QueryBind($sql, $arRecordBindings, false);
     } else {
         $DB->Query($sql, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
     }
     $rsEvents = GetModuleEvents('crm', 'OnMailTemplateUpdate');
     while ($arEvent = $rsEvents->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:44,代码来源:mail_template.php


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