- Модуль: support
- Путь к файлу: ~/bitrix/modules/support/classes/general/coupons.php
- Класс: CSupportSuperCoupon
- Вызов: CSupportSuperCoupon::__CheckFields
static function __CheckFields($arFields)
{
$aMsg = array();
if (is_set($arFields, "ACTIVE_FROM") && CheckDateTime($arFields['ACTIVE_FROM'], 'DD.MM.YYYY') &&
is_set($arFields, "ACTIVE_TO") && CheckDateTime($arFields['ACTIVE_TO'], 'DD.MM.YYYY'))
{
$dateElementsFrom = explode(".", $arFields["ACTIVE_FROM"]);
$_activeFrom = mktime(0,0,0, $dateElementsFrom[1], $dateElementsFrom[0], $dateElementsFrom[2]);
$dateElementsTo = explode(".", $arFields["ACTIVE_TO"]);
$_activeTo = mktime(0,0,0, $dateElementsTo[1], $dateElementsTo[0], $dateElementsTo[2]);
if ($_activeTo <= $_activeFrom)
$aMsg[] = array("id"=>"ACTIVE_TO", "text"=>GetMessage("SUP_ST_ERR_DATE_INTERVAL"));
}
if(is_set($arFields, "ACTIVE") && !in_array($arFields['ACTIVE'], Array('Y','N')))
{
$aMsg[] = array("id"=>"ACTIVE", "text"=>GetMessage("SUP_ST_ERR_ACTIVE"));
}
if(is_set($arFields, "SLA_ID") && intval($arFields['SLA_ID']) == 0)
{
$aMsg[] = array("id"=>"SLA_ID", "text"=>GetMessage("SUP_ST_ERR_SLA_ID"));
}
if(!empty($aMsg))
{
$e = new CAdminException($aMsg);
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
}
return true;
}