• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/discountcoupon.php
  • Класс: BitrixCatalogDiscountCouponTable
  • Вызов: DiscountCouponTable::setUserID
static function setUserID(&$result, $data, $keys)
{
	static $currentUserID = false;
	if ($currentUserID === false)
	{
		global $USER;
		$currentUserID = (isset($USER) && $USER instanceof CUser ? (int)$USER->getID() : null);
	}
	foreach ($keys as &$oneKey)
	{
		$setField = true;
		if (array_key_exists($oneKey, $data))
			$setField = ($data[$oneKey] !== null && (int)$data[$oneKey] <= 0);

		if ($setField)
			$result[$oneKey] = $currentUserID;
	}
	unset($oneKey);
}