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


PHP CCrmPerms::GetEntityAttr方法代码示例

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


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

示例1: array

$arResult['TYPE'] = $arParams['TYPE'];
$arResult['BUTTONS'] = array();
$arFields = array();
$arParams['ELEMENT_ID'] = intval($arParams['ELEMENT_ID']);
if ($arParams['TYPE'] == 'list') {
    $bRead = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'READ');
    $bExport = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'EXPORT');
    $bImport = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'IMPORT');
    $bAdd = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'ADD');
    $bWrite = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'WRITE');
    $bDelete = false;
} else {
    $arFields = CCrmInvoice::GetByID($arParams['ELEMENT_ID']);
    $arEntityAttr[$arParams['ELEMENT_ID']] = array();
    if ($arFields !== false) {
        $arEntityAttr = $CrmPerms->GetEntityAttr('INVOICE', array($arParams['ELEMENT_ID']));
    }
    $bRead = $arFields !== false;
    $bExport = false;
    $bImport = false;
    $bAdd = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'ADD');
    $bWrite = $CrmPerms->CheckEnityAccess('INVOICE', 'WRITE', $arEntityAttr[$arParams['ELEMENT_ID']]);
    $bDelete = $CrmPerms->CheckEnityAccess('INVOICE', 'DELETE', $arEntityAttr[$arParams['ELEMENT_ID']]);
}
if (!$bRead && !$bAdd && !$bWrite) {
    return false;
}
if ($arParams['TYPE'] === 'list') {
    if ($bAdd) {
        $arResult['BUTTONS'][] = array('TEXT' => GetMessage('INVOICE_ADD'), 'TITLE' => GetMessage('INVOICE_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_INVOICE_EDIT'], array('invoice_id' => 0)), 'HIGHLIGHT' => true);
    }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例2: array

 $res = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'LEAD', 'ELEMENT_ID' => $arResult['LEAD_ID']));
 while ($ar = $res->Fetch()) {
     if ($sExportType == '') {
         $arFmList[$ar['ELEMENT_ID']][$ar['COMPLEX_ID']][] = CCrmFieldMulti::GetTemplateByComplex($ar['COMPLEX_ID'], $ar['VALUE']);
     } else {
         $arFmList[$ar['ELEMENT_ID']][$ar['COMPLEX_ID']][] = $ar['VALUE'];
     }
     $arResult['LEAD'][$ar['ELEMENT_ID']]['~' . $ar['COMPLEX_ID']][] = $ar['VALUE'];
 }
 foreach ($arFmList as $elementId => $arFM) {
     foreach ($arFM as $complexId => $arComplexName) {
         $arResult['LEAD'][$elementId][$complexId] = implode(', ', $arComplexName);
     }
 }
 // checkig access for operation
 $arLeadAttr = CCrmPerms::GetEntityAttr('LEAD', $arResult['LEAD_ID']);
 foreach ($arResult['LEAD_ID'] as $iLeadId) {
     if ($arResult['LEAD'][$iLeadId]['EDIT']) {
         $arResult['LEAD'][$iLeadId]['EDIT'] = $CCrmPerms->CheckEnityAccess('LEAD', 'WRITE', $arLeadAttr[$iLeadId]);
     }
     if ($arResult['LEAD'][$iLeadId]['DELETE']) {
         $arResult['LEAD'][$iLeadId]['DELETE'] = $CCrmPerms->CheckEnityAccess('LEAD', 'DELETE', $arLeadAttr[$iLeadId]);
     }
     $arResult['LEAD'][$iLeadId]['BIZPROC_LIST'] = array();
     foreach ($arBPData as $arBP) {
         if (!CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $userID, array('crm', 'CCrmDocumentLead', 'LEAD_' . $arResult['LEAD'][$iLeadId]['ID']), array('UserGroups' => $CCrmBizProc->arCurrentUserGroups, 'DocumentStates' => $arDocumentStates, 'WorkflowTemplateId' => $arBP['ID'], 'CreatedBy' => $arResult['LEAD'][$iLeadId]['~ASSIGNED_BY'], 'UserIsAdmin' => $isAdmin, 'CRMEntityAttr' => $arLeadAttr[$iLeadId]))) {
             continue;
         }
         $arBP['PATH_TO_BIZPROC_START'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_SHOW'], array('lead_id' => $arResult['LEAD'][$iLeadId]['ID'])), array('workflow_template_id' => $arBP['ID'], 'bizproc_start' => 1, 'sessid' => $arResult['SESSION_ID'], 'CRM_LEAD_SHOW_V12_active_tab' => 'tab_bizproc', 'back_url' => $arParams['PATH_TO_LEAD_LIST']));
         $arResult['LEAD'][$iLeadId]['BIZPROC_LIST'][] = $arBP;
     }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例3: BuildSearchCard

 public static function BuildSearchCard($arQuote, $bReindex = false)
 {
     $arStatuses = array();
     $arSite = array();
     $sEntityType = 'QUOTE';
     $sTitle = 'TITLE';
     $sNumber = 'QUOTE_NUMBER';
     $arSearchableFields = array('DATE_CREATE' => GetMessage('CRM_QUOTE_SEARCH_FIELD_DATE_CREATE'), 'STATUS_ID' => GetMessage('CRM_QUOTE_SEARCH_FIELD_STATUS_ID'), 'BEGINDATE' => GetMessage('CRM_QUOTE_SEARCH_FIELD_BEGINDATE'), 'CLOSEDATE' => GetMessage('CRM_QUOTE_SEARCH_FIELD_CLOSEDATE'), 'OPPORTUNITY' => GetMessage('CRM_QUOTE_SEARCH_FIELD_OPPORTUNITY'), 'COMMENTS' => GetMessage('CRM_QUOTE_SEARCH_FIELD_COMMENTS'), 'CLIENT_TITLE' => GetMessage('CRM_QUOTE_SEARCH_FIELD_CLIENT_TITLE'), 'CLIENT_ADDR' => GetMessage('CRM_QUOTE_SEARCH_FIELD_CLIENT_ADDR'), 'CLIENT_CONTACT' => GetMessage('CRM_QUOTE_SEARCH_FIELD_CLIENT_CONTACT'), 'CLIENT_EMAIL' => GetMessage('CRM_QUOTE_SEARCH_FIELD_CLIENT_EMAIL'), 'CLIENT_PHONE' => GetMessage('CRM_QUOTE_SEARCH_FIELD_CLIENT_PHONE'), 'CLIENT_TP_ID' => GetMessage('CRM_QUOTE_SEARCH_FIELD_TP_ID'), 'CLIENT_TPA_ID' => GetMessage('CRM_QUOTE_SEARCH_FIELD_TPA_ID'));
     $sBody = $arQuote[$sNumber] . ', ' . $arQuote[$sTitle] . "\n";
     $arField2status = array('STATUS_ID' => 'QUOTE_STATUS');
     $site = new CSite();
     foreach (array_keys($arSearchableFields) as $k) {
         if (!isset($arQuote[$k])) {
             continue;
         }
         $v = $arQuote[$k];
         if ($k === 'COMMENTS') {
             $v = CSearch::KillTags($v);
         }
         $v = trim($v);
         if ($k === 'DATE_CREATE' || $k === 'BEGINDATE' || $k === 'CLOSEDATE') {
             $dateFormatShort = $site->GetDateFormat('SHORT');
             if (!CheckDateTime($v, $dateFormatShort)) {
                 $v = ConvertTimeStamp(strtotime($v), 'SHORT');
             }
             if (CheckDateTime($v, $dateFormatShort)) {
                 $v = FormatDate('SHORT', MakeTimeStamp($v, $dateFormatShort));
             } else {
                 $v = null;
             }
         }
         if (isset($arField2status[$k])) {
             if (!isset($arStatuses[$k])) {
                 $arStatuses[$k] = CCrmStatus::GetStatusList($arField2status[$k]);
             }
             $v = $arStatuses[$k][$v];
         }
         if ($k === 'OPPORTUNITY') {
             $v = number_format(doubleval($v), 2, '.', '');
         }
         if (!empty($v) && (!is_numeric($v) || $k === 'OPPORTUNITY') && $v != 'N' && $v != 'Y') {
             $sBody .= $arSearchableFields[$k] . ": {$v}\n";
         }
     }
     if (isset($arQuote['ASSIGNED_BY_NAME']) && !empty($arQuote['ASSIGNED_BY_NAME']) || isset($arQuote['ASSIGNED_BY_LAST_NAME']) && !empty($arQuote['ASSIGNED_BY_LAST_NAME']) || isset($arQuote['ASSIGNED_BY_SECOND_NAME']) && !empty($arQuote['ASSIGNED_BY_SECOND_NAME'])) {
         $responsibleInfo = CUser::FormatName($site->GetNameFormat(null, $arQuote['LID']), array('LOGIN' => '', 'NAME' => isset($arQuote['ASSIGNED_BY_NAME']) ? $arQuote['ASSIGNED_BY_NAME'] : '', 'LAST_NAME' => isset($arQuote['ASSIGNED_BY_LAST_NAME']) ? $arQuote['ASSIGNED_BY_LAST_NAME'] : '', 'SECOND_NAME' => isset($arQuote['ASSIGNED_BY_SECOND_NAME']) ? $arQuote['ASSIGNED_BY_SECOND_NAME'] : ''), false, false);
         if (isset($arQuote['ASSIGNED_BY_EMAIL']) && !empty($arQuote['ASSIGNED_BY_EMAIL'])) {
             $responsibleInfo .= ', ' . $arQuote['ASSIGNED_BY_EMAIL'];
         }
         if (isset($arQuote['ASSIGNED_BY_WORK_POSITION']) && !empty($arQuote['ASSIGNED_BY_WORK_POSITION'])) {
             $responsibleInfo .= ', ' . $arQuote['ASSIGNED_BY_WORK_POSITION'];
         }
         if (!empty($responsibleInfo) && !is_numeric($responsibleInfo) && $responsibleInfo != 'N' && $responsibleInfo != 'Y') {
             $sBody .= GetMessage('CRM_QUOTE_SEARCH_FIELD_ASSIGNED_BY_INFO') . ": {$responsibleInfo}\n";
         }
     }
     $sDetailURL = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_' . strtolower($sEntityType) . '_show'), array(strtolower($sEntityType) . '_id' => $arQuote['ID']));
     $_arAttr = CCrmPerms::GetEntityAttr($sEntityType, $arQuote['ID']);
     if (empty($arSite)) {
         $by = "sort";
         $order = "asc";
         $rsSite = $site->GetList($by, $order);
         while ($_arSite = $rsSite->Fetch()) {
             $arSite[] = $_arSite['ID'];
         }
     }
     unset($site);
     $sattr_d = '';
     $sattr_s = '';
     $sattr_u = '';
     $sattr_o = '';
     $sattr2 = '';
     $arAttr = array();
     if (!isset($_arAttr[$arQuote['ID']])) {
         $_arAttr[$arQuote['ID']] = array();
     }
     $arAttr[] = $sEntityType;
     // for perm X
     foreach ($_arAttr[$arQuote['ID']] as $_s) {
         if ($_s[0] == 'U') {
             $sattr_u = $_s;
         } else {
             if ($_s[0] == 'D') {
                 $sattr_d = $_s;
             } else {
                 if ($_s[0] == 'S') {
                     $sattr_s = $_s;
                 } else {
                     if ($_s[0] == 'O') {
                         $sattr_o = $_s;
                     }
                 }
             }
         }
         $arAttr[] = $sEntityType . '_' . $_s;
     }
     $sattr = $sEntityType . '_' . $sattr_u;
     if (!empty($sattr_d)) {
         $sattr .= '_' . $sattr_d;
         $arAttr[] = $sattr;
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_quote.php

示例4: foreach

if (isset($arResult['QUOTE_ID']) && !empty($arResult['QUOTE_ID'])) {
    // try to load product rows
    $arProductRows = CCrmQuote::LoadProductRows(array_keys($arResult['QUOTE_ID']));
    foreach ($arProductRows as $arProductRow) {
        $ownerID = $arProductRow['OWNER_ID'];
        if (!isset($arResult['QUOTE'][$ownerID])) {
            continue;
        }
        $arEntity =& $arResult['QUOTE'][$ownerID];
        if (!isset($arEntity['PRODUCT_ROWS'])) {
            $arEntity['PRODUCT_ROWS'] = array();
        }
        $arEntity['PRODUCT_ROWS'][] = $arProductRow;
    }
    // checkig access for operation
    $arQuoteAttr = CCrmPerms::GetEntityAttr('QUOTE', $arResult['QUOTE_ID']);
    foreach ($arResult['QUOTE_ID'] as $iQuoteId) {
        $arResult['QUOTE'][$iQuoteId]['EDIT'] = $CCrmPerms->CheckEnityAccess('QUOTE', 'WRITE', $arQuoteAttr[$iQuoteId]);
        $arResult['QUOTE'][$iQuoteId]['DELETE'] = $CCrmPerms->CheckEnityAccess('QUOTE', 'DELETE', $arQuoteAttr[$iQuoteId]);
        /*---bizproc---$arResult['QUOTE'][$iQuoteId]['BIZPROC_LIST'] = array();
        		foreach ($arBPData as $arBP)
        		{
        			if (!CBPDocument::CanUserOperateDocument(
        				CBPCanUserOperateOperation::StartWorkflow,
        				$userID,
        				array('crm', 'CCrmDocumentQuote', 'QUOTE_'.$arResult['QUOTE'][$iQuoteId]['ID']),
        				array(
        					'UserGroups' => $CCrmBizProc->arCurrentUserGroups,
        					'DocumentStates' => $arDocumentStates,
        					'WorkflowTemplateId' => $arBP['ID'],
        					'CreatedBy' => $arResult['QUOTE'][$iQuoteId]['ASSIGNED_BY'],
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例5: intval

 $arResult['ENTITY_ID'] = intval($arParams['ENTITY_ID']);
 $arResult['ENTITY_TITLE'] = GetMessage('CRM_EVENT_DEFAULT_TITLE');
 $arResult['EVENT_TYPE'] = $arParams['EVENT_TYPE'];
 $arResult['FREEZE_EVENT_ID'] = isset($arParams['FREEZE_EVENT_ID']) ? strtoupper($arParams['FREEZE_EVENT_ID']) : '';
 if ($arParams['EVENT_TYPE'] === 'PHONE') {
     $arResult['PHONE_GROUPS'] = array();
 }
 switch ($arParams['ENTITY_TYPE']) {
     case 'LEAD':
         $dbRes = CCrmLead::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $arResult['ENTITY_ID']));
         if ($arRes = $dbRes->Fetch()) {
             $arResult['ENTITY_TITLE'] = $arRes['TITLE'];
             $arResult['STATUS_ID'] = $arRes['STATUS_ID'];
             $arResult['ENTITY_CONVERTED'] = $arRes['STATUS_ID'] == 'CONVERTED' ? 'Y' : 'N';
         }
         $arEntityAttr = $CCrmPerms->GetEntityAttr('LEAD', $arResult['ENTITY_ID']);
         if ($CCrmPerms->CheckEnityAccess('LEAD', 'WRITE', $arEntityAttr[$arResult['ENTITY_ID']])) {
             $arResult['STATUS_LIST'] = array();
             $arResult['STATUS_LIST_EX'] = CCrmStatus::GetStatusList('STATUS');
             foreach ($arResult['STATUS_LIST_EX'] as $key => $value) {
                 if ($key == 'CONVERTED') {
                     continue;
                 }
                 if ($CCrmPerms->GetPermType('LEAD', 'WRITE', array('STATUS_ID' . $key)) > BX_CRM_PERM_NONE) {
                     $arResult['STATUS_LIST']['REFERENCE'][] = $value;
                     $arResult['STATUS_LIST']['REFERENCE_ID'][] = $key;
                 }
             }
             $arResult['PHONE_GROUPS'][] = array('PHONES' => __CrmEventGetPhones('LEAD', $arResult['ENTITY_ID']));
         }
         break;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例6: _buildEntityCard

 protected static function _buildEntityCard($arEntity, $sTitle, $ENTITY_TYPE, $arOptions = null)
 {
     static $arEntityGroup = array();
     static $arStatuses = array();
     static $arSite = array();
     $sBody = $arEntity[$sTitle] . "\n";
     $arField2status = array('STATUS_ID' => 'STATUS', 'SOURCE_ID' => 'SOURCE', 'CURRENCY_ID' => 'CURRENCY', 'PRODUCT_ID' => 'PRODUCT', 'TYPE_ID' => 'CONTACT_TYPE', 'STAGE_ID' => 'DEAL_STAGE', 'EVENT_ID' => 'EVENT_TYPE', 'COMPANY_TYPE' => 'COMPANY_TYPE', 'EMPLOYEES' => 'EMPLOYEES', 'INDUSTRY' => 'INDUSTRY');
     foreach ($arEntity as $_k => $_v) {
         if ($_k == $sTitle || strpos($_k, '_BY_') !== false || strpos($_k, 'DATE_') === 0 || strpos($_k, 'UF_') === 0) {
             continue;
         }
         if ($ENTITY_TYPE === 'CONTACT' && ($_k === 'NAME' || $_k === 'SECOND_NAME' || $_k === 'LAST_NAME')) {
             //Already added as title
             continue;
         }
         if (is_array($_v)) {
             continue;
         }
         if ($_k === 'COMMENTS') {
             $_v = CSearch::KillTags($_v);
         }
         $_v = trim($_v);
         if (isset($arField2status[$_k])) {
             if (!isset($arStatuses[$_k])) {
                 $arStatuses[$_k] = CCrmStatus::GetStatusList($arField2status[$_k]);
             }
             $_v = $arStatuses[$_k][$_v];
         }
         if (!empty($_v) && !is_numeric($_v) && $_v != 'N' && $_v != 'Y') {
             $sBody .= self::$arMess[$ENTITY_TYPE]['CRM_FIELD_' . $_k] . ": {$_v}\n";
         }
     }
     if ($ENTITY_TYPE === 'CONTACT' || $ENTITY_TYPE === 'COMPANY' || $ENTITY_TYPE === 'LEAD') {
         $multiFields = is_array($arOptions) && isset($arOptions['FM']) ? $arOptions['FM'] : null;
         if (is_array($multiFields)) {
             foreach ($multiFields as $typeID => $multiFieldItems) {
                 if ($typeID === 'PHONE') {
                     $sBody .= GetMessage('CRM_PHONES') . ': ' . implode(', ', $multiFieldItems) . "\n";
                 } elseif ($typeID === 'EMAIL') {
                     $sBody .= GetMessage('CRM_EMAILS') . ': ' . implode(', ', $multiFieldItems) . "\n";
                 }
             }
         }
     }
     $sDetailURL = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_' . strtolower($ENTITY_TYPE) . '_show'), array(strtolower($ENTITY_TYPE) . '_id' => $arEntity['ID']));
     $_arAttr = CCrmPerms::GetEntityAttr($ENTITY_TYPE, $arEntity['ID']);
     if (empty($arSite)) {
         $by = "sort";
         $order = "asc";
         $rsSite = CSite::GetList($by, $order);
         while ($_arSite = $rsSite->Fetch()) {
             $arSite[] = $_arSite['ID'];
         }
     }
     $sattr_d = '';
     $sattr_s = '';
     $sattr_u = '';
     $sattr_o = '';
     $arAttr = array();
     if (!isset($_arAttr[$arEntity['ID']])) {
         $_arAttr[$arEntity['ID']] = array();
     }
     $arAttr[] = $ENTITY_TYPE;
     // for perm X
     foreach ($_arAttr[$arEntity['ID']] as $_s) {
         if (preg_match('/^U/', $_s)) {
             $sattr_u = $_s;
         } elseif (preg_match('/^D/', $_s)) {
             $sattr_d = $_s;
         } elseif (preg_match('/^S/', $_s)) {
             $sattr_s = $_s;
         } elseif (preg_match('/^O/', $_s)) {
             $sattr_o = $_s;
         }
         $arAttr[] = "{$ENTITY_TYPE}_{$_s}";
     }
     if (!empty($sattr_s)) {
         $arAttr[] = "{$ENTITY_TYPE}_{$sattr_s}";
         // for perm X in status
         if (!empty($sattr_u)) {
             $arAttr[] = "{$ENTITY_TYPE}_{$sattr_u}_{$sattr_s}";
         }
         if (!empty($sattr_d)) {
             $arAttr[] = "{$ENTITY_TYPE}_{$sattr_d}_{$sattr_s}";
         }
         if (!empty($sattr_o)) {
             $arAttr[] = "{$ENTITY_TYPE}_{$sattr_o}_{$sattr_s}";
         }
     }
     $arSitePath = array();
     foreach ($arSite as $sSite) {
         $arSitePath[$sSite] = $sDetailURL;
     }
     $arResult = array('LAST_MODIFIED' => $arEntity['DATE_MODIFY'], 'DATE_FROM' => $arEntity['DATE_CREATE'], 'TITLE' => GetMessage('CRM_' . $ENTITY_TYPE) . ': ' . $arEntity[$sTitle], 'PARAM1' => $ENTITY_TYPE, 'PARAM2' => $arEntity['ID'], 'SITE_ID' => $arSitePath, 'PERMISSIONS' => $arAttr, 'BODY' => $sBody, 'TAGS' => 'crm,' . strtolower($ENTITY_TYPE) . ',' . GetMessage('CRM_' . $ENTITY_TYPE));
     if (self::$bReIndex) {
         $arResult['ID'] = $ENTITY_TYPE . '.' . $arEntity['ID'];
     }
     return $arResult;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:99,代码来源:crm_search.php

示例7: BuildSearchCard

 public static function BuildSearchCard($arInvoice, $bReindex = false)
 {
     $arStatuses = array();
     $arSite = array();
     $sEntityType = 'INVOICE';
     $sTitle = 'ORDER_TOPIC';
     $sNumber = 'ACCOUNT_NUMBER';
     $arSearchableFields = array('STATUS_ID' => GetMessage('CRM_INVOICE_SEARCH_FIELD_STATUS_ID'), 'DATE_BILL' => GetMessage('CRM_INVOICE_SEARCH_FIELD_DATE_BILL'), 'DATE_PAY_BEFORE' => GetMessage('CRM_INVOICE_SEARCH_FIELD_DATE_PAY_BEFORE'), 'PRICE' => GetMessage('CRM_INVOICE_SEARCH_FIELD_PRICE'), 'PAY_VOUCHER_NUM' => GetMessage('CRM_INVOICE_SEARCH_FIELD_PAY_VOUCHER_NUM'), 'USER_DESCRIPTION' => GetMessage('CRM_INVOICE_SEARCH_FIELD_USER_DESCRIPTION'), 'COMMENTS' => GetMessage('CRM_INVOICE_SEARCH_FIELD_COMMENTS'), 'REASON_MARKED' => GetMessage('CRM_INVOICE_SEARCH_FIELD_REASON_MARKED'));
     $sBody = $arInvoice[$sNumber] . ', ' . $arInvoice[$sTitle] . "\n";
     $arField2status = array('STATUS_ID' => 'INVOICE_STATUS');
     $site = new CSite();
     foreach (array_keys($arSearchableFields) as $k) {
         if (!isset($arInvoice[$k])) {
             continue;
         }
         $v = $arInvoice[$k];
         if ($k === 'COMMENTS' || $k === 'USER_DESCRIPTION') {
             $v = CSearch::KillTags($v);
         }
         $v = trim($v);
         if ($k === 'DATE_BILL' || $k === 'DATE_PAY_BEFORE') {
             $dateFormatShort = $site->GetDateFormat('SHORT');
             if (!CheckDateTime($v, $dateFormatShort)) {
                 $v = ConvertTimeStamp(strtotime($v), 'SHORT');
             }
             if (CheckDateTime($v, $dateFormatShort)) {
                 $v = FormatDate('SHORT', MakeTimeStamp($v, $dateFormatShort));
             } else {
                 $v = null;
             }
         }
         if (isset($arField2status[$k])) {
             if (!isset($arStatuses[$k])) {
                 $arStatuses[$k] = CCrmStatus::GetStatusList($arField2status[$k]);
             }
             $v = $arStatuses[$k][$v];
         }
         if (!empty($v) && (!is_numeric($v) || $k === 'PRICE') && $v != 'N' && $v != 'Y') {
             $sBody .= $arSearchableFields[$k] . ": {$v}\n";
         }
     }
     if (isset($arInvoice['RESPONSIBLE_NAME']) && !empty($arInvoice['RESPONSIBLE_NAME']) || isset($arInvoice['RESPONSIBLE_LAST_NAME']) && !empty($arInvoice['RESPONSIBLE_LAST_NAME']) || isset($arInvoice['RESPONSIBLE_SECOND_NAME']) && !empty($arInvoice['RESPONSIBLE_SECOND_NAME'])) {
         $responsibleInfo = CUser::FormatName($site->GetNameFormat(null, $arInvoice['LID']), array('LOGIN' => '', 'NAME' => isset($arInvoice['RESPONSIBLE_NAME']) ? $arInvoice['RESPONSIBLE_NAME'] : '', 'LAST_NAME' => isset($arInvoice['RESPONSIBLE_LAST_NAME']) ? $arInvoice['RESPONSIBLE_LAST_NAME'] : '', 'SECOND_NAME' => isset($arInvoice['RESPONSIBLE_SECOND_NAME']) ? $arInvoice['RESPONSIBLE_SECOND_NAME'] : ''), false, false);
         if (isset($arInvoice['RESPONSIBLE_EMAIL']) && !empty($arInvoice['RESPONSIBLE_EMAIL'])) {
             $responsibleInfo .= ', ' . $arInvoice['RESPONSIBLE_EMAIL'];
         }
         if (isset($arInvoice['RESPONSIBLE_WORK_POSITION']) && !empty($arInvoice['RESPONSIBLE_WORK_POSITION'])) {
             $responsibleInfo .= ', ' . $arInvoice['RESPONSIBLE_WORK_POSITION'];
         }
         if (!empty($responsibleInfo) && !is_numeric($responsibleInfo) && $responsibleInfo != 'N' && $responsibleInfo != 'Y') {
             $sBody .= GetMessage('CRM_INVOICE_SEARCH_FIELD_RESPONSIBLE_INFO') . ": {$responsibleInfo}\n";
         }
     }
     if (intval($arInvoice['PERSON_TYPE_ID']) > 0) {
         $arSearchableProperties = self::_getAllowedPropertiesInfo();
         $arSearchableProperties = $arSearchableProperties[$arInvoice['PERSON_TYPE_ID']];
         $arInvoiceProps = self::GetProperties($arInvoice['ID'], $arInvoice['PERSON_TYPE_ID']);
         foreach ($arInvoiceProps as $prop) {
             $propCode = $prop['FIELDS']['CODE'];
             if (array_key_exists($propCode, $arSearchableProperties)) {
                 $v = $prop['VALUE'];
                 if (!empty($v) && !is_numeric($v) && $v != 'N' && $v != 'Y') {
                     $sBody .= $arSearchableProperties[$propCode] . ": {$v}\n";
                 }
             }
         }
     }
     $sDetailURL = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_' . strtolower($sEntityType) . '_show'), array(strtolower($sEntityType) . '_id' => $arInvoice['ID']));
     $_arAttr = CCrmPerms::GetEntityAttr($sEntityType, $arInvoice['ID']);
     if (empty($arSite)) {
         $by = "sort";
         $order = "asc";
         $rsSite = $site->GetList($by, $order);
         while ($_arSite = $rsSite->Fetch()) {
             $arSite[] = $_arSite['ID'];
         }
     }
     unset($site);
     $sattr_d = '';
     $sattr_s = '';
     $sattr_u = '';
     $sattr_o = '';
     $sattr2 = '';
     $arAttr = array();
     if (!isset($_arAttr[$arInvoice['ID']])) {
         $_arAttr[$arInvoice['ID']] = array();
     }
     $arAttr[] = $sEntityType;
     // for perm X
     foreach ($_arAttr[$arInvoice['ID']] as $_s) {
         if ($_s[0] == 'U') {
             $sattr_u = $_s;
         } else {
             if ($_s[0] == 'D') {
                 $sattr_d = $_s;
             } else {
                 if ($_s[0] == 'S') {
                     $sattr_s = $_s;
                 } else {
                     if ($_s[0] == 'O') {
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:crm_invoice.php

示例8: unset

    }
    if (array_key_exists('QUOTE_LINK_HTML', $arInvoice)) {
        unset($arInvoice['QUOTE_LINK_HTML']);
    }
}
unset($arInvoice);
$CCrmUserType->ListAddEnumFieldsValue($arResult, $arResult['INVOICE'], $arResult['INVOICE_UF'], $sExportType != '' ? ', ' : '<br />', $sExportType != '', array('FILE_URL_TEMPLATE' => '/bitrix/components/bitrix/crm.invoice.show/show_file.php?ownerId=#owner_id#&fieldName=#field_name#&fileId=#file_id#'));
$arResult['TOOLBAR_LABEL_TEXT'] = GetMessage('CRM_INVOICE_LIST_TB_LABEL_TEXT', array('#num#' => $totalPaidNumber, '#sum#' => CCrmCurrency::MoneyToString(round($totalPaidSum, 2), $totalPaidCurrencyId)));
$arResult['ROWS_COUNT'] = $obRes->SelectedRowsCount();
$arResult['DB_LIST'] = $obRes;
$arResult['DB_FILTER'] = $arFilter;
if (isset($arResult['INVOICE_ID']) && !empty($arResult['INVOICE_ID'])) {
    // try to load product rows
    $arProductRows = array();
    // checkig access for operation
    $arInvoiceAttr = CCrmPerms::GetEntityAttr('INVOICE', $arResult['INVOICE_ID']);
    foreach ($arResult['INVOICE_ID'] as $iInvoiceId) {
        $arResult['INVOICE'][$iInvoiceId]['EDIT'] = $CCrmPerms->CheckEnityAccess('INVOICE', 'WRITE', $arInvoiceAttr[$iInvoiceId]);
        $arResult['INVOICE'][$iInvoiceId]['DELETE'] = $CCrmPerms->CheckEnityAccess('INVOICE', 'DELETE', $arInvoiceAttr[$iInvoiceId]);
    }
}
if ($sExportType == '') {
    $arResult['NEED_FOR_REBUILD_INVOICE_ATTRS'] = false;
    if (!$bInternal && CCrmPerms::IsAdmin() && COption::GetOptionString('crm', '~CRM_REBUILD_INVOICE_ATTR', 'N') === 'Y') {
        $arResult['PATH_TO_PRM_LIST'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_perm_list'));
        $arResult['NEED_FOR_REBUILD_INVOICE_ATTRS'] = true;
    }
    $this->IncludeComponentTemplate();
    include_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/components/bitrix/crm.invoice/include/nav.php';
    return $arResult['ROWS_COUNT'];
} else {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


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