• Модуль: biconnector
  • Путь к файлу: ~/bitrix/modules/biconnector/lib/integration/crm/activity.php
  • Класс: BitrixBIConnectorIntegrationCrmActivity
  • Вызов: Activity::mapDictionarytoSqlCase
static function mapDictionarytoSqlCase($dictionary, $helper)
{
	krsort($dictionary);

	$dictionaryForSql = [];
	foreach ($dictionary as $id => $value)
	{
		if ($id)
		{
			array_unshift(
				$dictionaryForSql,
				'when #FIELD_NAME# = '' . $helper->forSql($id) . '' then '' . $helper->forSql($value) . '''
			);
		}
		else
		{
			array_push(
				$dictionaryForSql,
				'when #FIELD_NAME# is null or #FIELD_NAME# = '' then '' . $helper->forSql($value) . '''
			);
		}
	}
	$dictionarySql = 'case ' . implode("n", $dictionaryForSql) . ' else null end';

	return $dictionarySql;
}