• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/product/subscribemanager.php
  • Класс: BitrixCatalogProductSubscribeManager
  • Вызов: SubscribeManager::validateFields
private function validateFields()
{
	foreach($this->fields as $fieldId => $fieldValue)
	{
		switch($fieldId)
		{
			case 'DATE_TO':
				if(!($fieldValue instanceof DateTime) ||
					($fieldValue instanceof DateTime && $fieldValue->getTimestamp() < time()))
				{
					$this->errorCollection->add(array(new Error(Loc::getMessage('ERROR_VALIDATE_FIELDS',
						array('#FIELD#' => $fieldId)), self::ERROR_VALIDATE_FIELDS)));
				}
				break;
			case 'USER_CONTACT':
				$currentContactType = $this->contactTypes[$this->fields['CONTACT_TYPE']];
				if(!preg_match($currentContactType['RULE'], $fieldValue))
				{
					$this->errorCollection->add(array(new Error(Loc::getMessage('ERROR_VALIDATE_FIELDS',
						array('#FIELD#' => $fieldId)), self::ERROR_VALIDATE_FIELDS)));
				}
				break;
		}
	}
}