- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/merger/entitymerger.php
- Класс: Bitrix\Crm\Merger\EntityMerger
- Вызов: EntityMerger::doesFieldHaveValue
static function doesFieldHaveValue(
array $fieldInfo,
array $fields,
string $fieldId,
bool $skipEmpty
): bool
{
$hasValue = isset($fields[$fieldId]);
if(!$skipEmpty)
{
$type = ($fieldInfo['TYPE'] ?? 'string');
$fieldValue = $fields[$fieldId] ?? '';
if (!$hasValue = ($hasValue && static::isFieldNotEmpty($fieldInfo, $fields, $fieldId)))
{
return $hasValue;
}
if (in_array($type, ['string', 'char', 'datetime', 'crm_status', 'crm_currency'], true))
{
$hasValue = ($hasValue && $fieldValue !== '');
}
elseif ($type === 'double')
{
$hasValue = ($hasValue && (float)$fieldValue !== 0.0);
}
elseif ($type === 'integer' || $type === 'user')
{
$hasValue = ($hasValue && (int)$fieldValue !== 0);
}
}
return $hasValue;
}