OpenCart 🇺🇦

Схема

protected mixed validateForm ( )

Аргументы

Аргумент Возможный тип Описание
У метода нет аргументов

Описание

Метод пока еще не документирован.

Исходный код

if (!$this->user->hasPermission('modify', 'sale/coupon')) {
	$this->error['warning'] = $this->language->get('error_permission');
}

if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 128)) {
	$this->error['name'] = $this->language->get('error_name');
}

if ((utf8_strlen($this->request->post['code']) < 3) || (utf8_strlen($this->request->post['code']) > 10)) {
	$this->error['code'] = $this->language->get('error_code');
}

$coupon_info = $this->model_sale_coupon->getCouponByCode($this->request->post['code']);

if ($coupon_info) {
	if (!isset($this->request->get['coupon_id'])) {
		$this->error['warning'] = $this->language->get('error_exists');
	} elseif ($coupon_info['coupon_id'] != $this->request->get['coupon_id'])  {
		$this->error['warning'] = $this->language->get('error_exists');
	}
}

if (!$this->error) {
	return true;
} else {
	return false;
}