Beispiel #1
0
 public static function GetList($arOrder = array("ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array(), $arOptions = array())
 {
     global $USER;
     if (!CModule::IncludeModule('sale')) {
         return false;
     }
     if (!is_array($arGroupBy)) {
         if (is_array($arSelectFields) && (count($arSelectFields) === 0 || in_array('*', $arSelectFields))) {
             if (count($arSelectFields) === 0) {
                 $arSelectFields[] = '*';
             }
             if (!in_array('UF_QUOTE_ID', $arSelectFields)) {
                 $arSelectFields[] = 'UF_QUOTE_ID';
             }
             if (!in_array('UF_DEAL_ID', $arSelectFields)) {
                 $arSelectFields[] = 'UF_DEAL_ID';
             }
             if (!in_array('UF_COMPANY_ID', $arSelectFields)) {
                 $arSelectFields[] = 'UF_COMPANY_ID';
             }
             if (!in_array('UF_CONTACT_ID', $arSelectFields)) {
                 $arSelectFields[] = 'UF_CONTACT_ID';
             }
             $arSelectedUserFields = array_keys(self::GetUserFields());
             if (is_array($arSelectedUserFields) && !empty($arSelectedUserFields)) {
                 $arSelectFields = array_merge($arSelectFields, $arSelectedUserFields);
             }
             unset($arSelectedUserFields);
         }
     }
     // permissions
     if (isset($arFilter['CUSTOM_SUBQUERY'])) {
         unset($arFilter['CUSTOM_SUBQUERY']);
     }
     if (!(is_object($USER) && $USER->IsAdmin()) && (!array_key_exists('CHECK_PERMISSIONS', $arFilter) || $arFilter['CHECK_PERMISSIONS'] !== 'N')) {
         $arFilter['CUSTOM_SUBQUERY'] = array('CCrmInvoice', '__callbackPermissionsWhereCondition');
         $arPermType = array();
         if (!isset($arFilter['PERMISSION'])) {
             $arPermType = array('READ');
         } else {
             $arPermType = is_array($arFilter['PERMISSION']) ? $arFilter['PERMISSION'] : array($arFilter['PERMISSION']);
         }
         self::$arCurrentPermType = $arPermType;
     }
     $result = CSaleOrder::getList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelectFields, $arOptions);
     self::$arCurrentPermType = null;
     return $result;
 }