...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice_invoice.php
- Класс: \CCrmInvoiceRestService
- Вызов: CCrmInvoiceRestService::filterFields
static function filterFields($fields, $method, $keepUserFields = true) { $result = array(); if (!is_array($fields) || count($fields) === 0) return $result; if (!in_array($method, array('get', 'add', 'update', 'list'), true)) return $result; $bTaxMode = CCrmTax::isTaxMode(); $fieldsInfo = self::getFieldsInfo(); $allowedFields = array(); foreach ($fieldsInfo as $fName => $fInfo) { if ($fInfo[$method] === true) { if ($fName !== 'PR_LOCATION') { $allowedFields[] = $fName; } else { if ($bTaxMode) $allowedFields[] = $fName; } } } unset($fName, $fInfo); // user fields if ($keepUserFields) { $userFields = CCrmInvoice::GetUserFields(); foreach(array_keys($userFields) as $fieldName) $allowedFields[] = $fieldName; unset($userFields); } foreach ($fields as $fName => $fValue) { if ($fName !== 'INVOICE_PROPERTIES' && $fName !== 'PRODUCT_ROWS' && in_array($fName, $allowedFields)) $result[$fName] = CCrmInvoiceRestUtil::convertValue($method, $fieldsInfo[$fName]['type'], $fValue); } if (isset($fields['INVOICE_PROPERTIES']) && is_array($fields['INVOICE_PROPERTIES']) && in_array('INVOICE_PROPERTIES', $allowedFields, true)) { $props = array(); foreach ($fields['INVOICE_PROPERTIES'] as $k => $v) { if (!is_array($v) /*&& preg_match('/^[A-Za-z0-9_\-]+$/',strval($k))*/) { $props[$k] = $v; } } if (count($props) > 0) $result['INVOICE_PROPERTIES'] = $props; unset($props, $k, $v); } if (isset($fields['PRODUCT_ROWS']) && is_array($fields['PRODUCT_ROWS']) && in_array('PRODUCT_ROWS', $allowedFields)) { $products = array(); foreach ($fields['PRODUCT_ROWS'] as $productRow) { $row = array(); foreach ($productRow as $k => $v) { if (in_array('PRODUCT_ROWS.[].'.$k, $allowedFields, true)) $row[$k] = CCrmInvoiceRestUtil::convertValue($method, $fieldsInfo['PRODUCT_ROWS.[].'.$k]['type'], $v); } if (count($row) > 0) { $row['CUSTOMIZED'] = 'Y'; // don't update price from catalog $products[] = $row; } } if (count($products) > 0) $result['PRODUCT_ROWS'] = $products; unset($products, $productRow, $k, $v, $row); } unset($fieldsInfo); return $result; }