- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/compatible/compatible.php
- Класс: BitrixSaleCompatibleOrderQueryLocation
- Вызов: OrderQueryLocation::addLocationRuntimeField
public function addLocationRuntimeField($fieldName, $ref = false)
{
if((string) $fieldName == '')
return false;
$this->registerRuntimeField(
'LOCATION',
array(
'data_type' => 'BitrixSaleLocationLocationTable',
'reference' => array(
'=this.'.$fieldName => 'ref.CODE'
),
'join_type' => 'left'
)
);
$fieldType = "CHAR";
/** @var DBConnection $connection */
$connection = Application::getConnection();
if ($connection instanceof DBMssqlConnection)
{
$fieldType = "VARCHAR";
}
elseif($connection instanceof DBOracleConnection)
{
$fieldType = "VARCHAR2";
}
$this->registerRuntimeField(
'PROXY_'.$fieldName.'_LINK',
array(
'data_type' => 'string',
'expression' => array(
"CASE WHEN %s = 'LOCATION' THEN CAST(%s AS ".$fieldType."(500)) ELSE %s END",
($ref !== false ? $ref.'.' : '').'TYPE',
'LOCATION.ID',
$fieldName
)
)
);
$this->addAliases(array(
$fieldName.'_ORIG' => $fieldName,
'PROXY_'.$fieldName => 'PROXY_'.$fieldName.'_LINK'
));
$this->locationFieldMap[$fieldName] = true;
}