...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
- Класс: \CCrmRestProxyBase
- Вызов: CCrmRestProxyBase::tryExternalizeProductPropertyField
protected function tryExternalizeProductPropertyField(&$fields, &$fieldsInfo, $fieldName) { if(!is_array($fields) || !isset($fields[$fieldName])) { return; } $info = $fieldsInfo[$fieldName] ?? null; $value = $fields[$fieldName] ?? null; if(!$info) { unset($fields[$fieldName]); return; } $attrs = $info['ATTRIBUTES'] ?? array(); $isMultiple = in_array(CCrmFieldInfoAttr::Multiple, $attrs, true); $isDynamic = in_array(CCrmFieldInfoAttr::Dynamic, $attrs, true); $fieldType = $info['TYPE'] ?? ''; $propertyType = $info['PROPERTY_TYPE'] ?? ''; $userType = $info['USER_TYPE'] ?? ''; if($fieldType === 'product_property' && $propertyType === 'S' && $userType === 'Date') { if (self::isIndexedArray($value)) { $fields[$fieldName] = array(); foreach($value as $valueElement) { if (isset($valueElement['VALUE_ID']) && isset($valueElement['VALUE'])) { $fields[$fieldName][] = array( 'valueId' => $valueElement['VALUE_ID'], 'value' => CRestUtil::ConvertDate($valueElement['VALUE']) ); } } } else { if (isset($value['VALUE_ID']) && isset($value['VALUE'])) { $fields[$fieldName] = array( 'valueId' => $value['VALUE_ID'], 'value' => CRestUtil::ConvertDate($value['VALUE']) ); } else { $fields[$fieldName] = null; } } } elseif($fieldType === 'product_property' && $propertyType === 'S' && $userType === 'DateTime') { if (self::isIndexedArray($value)) { $fields[$fieldName] = array(); foreach($value as $valueElement) { if (isset($valueElement['VALUE_ID']) && isset($valueElement['VALUE'])) { $fields[$fieldName][] = array( 'valueId' => $valueElement['VALUE_ID'], 'value' => CRestUtil::ConvertDateTime($valueElement['VALUE']) ); } } } else { if (isset($value['VALUE_ID']) && isset($value['VALUE'])) { $fields[$fieldName] = array( 'valueId' => $value['VALUE_ID'], 'value' => CRestUtil::ConvertDateTime($value['VALUE']) ); } else { $fields[$fieldName] = null; } } } elseif($fieldType === 'product_property' && $propertyType === 'F' && empty($userType)) { $this->tryExternalizeProductFileField($fields, $fieldName, $isMultiple, $isDynamic); } else { if (self::isIndexedArray($value)) { $fields[$fieldName] = array(); foreach($value as $valueElement) { if (isset($valueElement['VALUE_ID']) && isset($valueElement['VALUE'])) { $fields[$fieldName][] = array( 'valueId' => $valueElement['VALUE_ID'], 'value' => $valueElement['VALUE'] ); } } } else { if (isset($value['VALUE_ID']) && isset($value['VALUE'])) { $fields[$fieldName] = array( 'valueId' => $value['VALUE_ID'], 'value' => $value['VALUE'] ); } else { $fields[$fieldName] = null; } } } }