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


PHP CCrmStatus::Add方法代码示例

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


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

示例1: installDefault

 public static function installDefault()
 {
     $items = array();
     $langIDs = self::getAllLangIDs();
     foreach ($langIDs as $langID) {
         IncludeModuleLangFile(__FILE__, $langID);
         $s = trim(GetMessage('CRM_HONORIFIC_DEFAULT'));
         if ($s === '' || $s === '-') {
             //Skip stub
             continue;
         }
         $slugs = explode('|', $s);
         $slugCount = count($slugs);
         for ($i = 0; $i < $slugCount; $i++) {
             $ary = explode(';', $slugs[$i]);
             $count = count($ary);
             if ($count >= 2) {
                 $name = trim($ary[1]);
                 $statusID = trim($ary[0]);
             } else {
                 $name = trim($ary[0]);
                 $statusID = '';
             }
             if ($statusID === '') {
                 $statusID = 'HNR_' . strtoupper($langID) . '_' . ($i + 1);
             }
             if ($name === '' || isset($items[$statusID])) {
                 continue;
             }
             $items[$statusID] = array('STATUS_ID' => $statusID, 'NAME' => $name, 'SORT' => ($i + 1) * 10, 'SYSTEM' => 'N');
         }
     }
     $statusEntity = new \CCrmStatus('HONORIFIC');
     $presentItems = \CCrmStatus::GetStatusList('HONORIFIC');
     foreach ($items as $item) {
         if (!isset($presentItems[$item['STATUS_ID']])) {
             $statusEntity->Add($item);
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:40,代码来源:honorific.php

示例2: LocalComponentCausedUpdater

 public static function LocalComponentCausedUpdater()
 {
     global $stackCacheManager;
     $bResult = true;
     $errMsg = array();
     // at first, check last update version
     if (COption::GetOptionString('crm', '~CRM_QUOTE_14_1_11', 'N') === 'Y') {
         return $bResult;
     }
     try {
         // Copy perms from deals to quotes
         $CCrmRole = new CCrmRole();
         $dbRoles = $CCrmRole->GetList();
         while ($arRole = $dbRoles->Fetch()) {
             $arPerms = $CCrmRole->GetRolePerms($arRole['ID']);
             if (!isset($arPerms['QUOTE']) && is_array($arPerms['DEAL'])) {
                 foreach ($arPerms['DEAL'] as $key => $value) {
                     if (isset($value['-'])) {
                         $arPerms['QUOTE'][$key]['-'] = $value['-'];
                     } else {
                         $arPerms['QUOTE'][$key]['-'] = null;
                     }
                 }
             }
             $arFields = array('RELATION' => $arPerms);
             $CCrmRole->Update($arRole['ID'], $arFields);
         }
         // Create default quote status list (if not exists)
         $arStatus = CCrmStatus::GetStatus('QUOTE_STATUS');
         if (empty($arStatus)) {
             $CCrmStatus = new CCrmStatus('QUOTE_STATUS');
             $arAdd = array(array('NAME' => GetMessage('CRM_QUOTE_STATUS_DRAFT'), 'STATUS_ID' => 'DRAFT', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_SENT'), 'STATUS_ID' => 'SENT', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_RECEIVED'), 'STATUS_ID' => 'RECEIVED', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_APPROVED'), 'STATUS_ID' => 'APPROVED', 'SORT' => 40, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_UNANSWERED'), 'STATUS_ID' => 'UNANSWERED', 'SORT' => 50, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_DECLAINED'), 'STATUS_ID' => 'DECLAINED', 'SORT' => 60, 'SYSTEM' => 'Y'));
             foreach ($arAdd as $ar) {
                 $CCrmStatus->Add($ar);
             }
             $stackCacheManager->Clear('b_crm_status', 'QUOTE_STATUS');
         }
         unset($arStatus);
     } catch (Exception $e) {
         $errMsg[] = $e->getMessage();
     }
     if (empty($errMsg)) {
         COption::SetOptionString('crm', '~CRM_QUOTE_14_1_11', 'Y');
     } else {
         $errString = implode('<br>', $errMsg);
         ShowError($errString);
         $bResult = false;
     }
     return $bResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:50,代码来源:crm_quote.php

示例3: CCrmStatus

 if (!$CCrmStatus) {
     $CCrmStatus = new CCrmStatus($entityId);
 }
 foreach ($arFields as $id => $arField) {
     $arField['SORT'] = (int) $arField['SORT'];
     if ($arField['SORT'] <= $iPrevSort) {
         $arField['SORT'] = $iPrevSort + 10;
     }
     $iPrevSort = $arField['SORT'];
     if (substr($id, 0, 1) == 'n') {
         if (trim($arField['VALUE']) == "") {
             continue;
         }
         $arAdd['NAME'] = trim($arField['VALUE']);
         $arAdd['SORT'] = $arField['SORT'];
         $CCrmStatus->Add($arAdd);
     } else {
         if (!isset($arField['VALUE']) || trim($arField['VALUE']) == "") {
             $arCurrentData = $CCrmStatus->GetStatusById($id);
             if ($arCurrentData['SYSTEM'] == 'N') {
                 $CCrmStatus->Delete($id);
             } else {
                 $arUpdate['NAME'] = trim($arCurrentData['NAME_INIT']);
                 $CCrmStatus->Update($id, $arUpdate);
             }
         } else {
             $arCurrentData = $CCrmStatus->GetStatusById($id);
             if (trim($arField['VALUE']) != $arCurrentData['NAME'] || intval($arField['SORT']) != $arCurrentData['SORT']) {
                 $arUpdate['NAME'] = trim($arField['VALUE']);
                 $arUpdate['SORT'] = $arField['SORT'];
                 $CCrmStatus->Update($id, $arUpdate);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例4: innerAdd

 protected function innerAdd(&$fields, &$errors, array $params = null)
 {
     if (!CCrmStatus::CheckCreatePermission()) {
         $errors[] = 'Access denied.';
         return false;
     }
     $entityID = isset($fields['ENTITY_ID']) ? $fields['ENTITY_ID'] : '';
     $statusID = isset($fields['STATUS_ID']) ? $fields['STATUS_ID'] : '';
     if ($entityID === '' || $statusID === '') {
         if ($entityID === '') {
             $errors[] = 'The field ENTITY_ID is required.';
         }
         if ($statusID === '') {
             $errors[] = 'The field STATUS_ID is required.';
         }
         return false;
     }
     $entityTypes = self::prepareEntityTypes();
     if (!isset($entityTypes[$entityID])) {
         $errors[] = 'Specified entity type is not supported.';
         return false;
     }
     $fields['SYSTEM'] = 'N';
     $entity = new CCrmStatus($entityID);
     $result = $entity->Add($fields, true);
     if ($result === false) {
         $errors[] = $entity->GetLastError();
     }
     return $result;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:30,代码来源:restservice.php


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