OpenCart 🇺🇦

Схема

protected mixed validateDelete ( )

Аргументы

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

Описание

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

Исходный код

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

$this->load->model('setting/store');
$this->load->model('sale/order');

foreach ($this->request->post['selected'] as $currency_id) {
	$currency_info = $this->model_localisation_currency->getCurrency($currency_id);

	if ($currency_info) {
		if ($this->config->get('config_currency') == $currency_info['code']) {
			$this->error['warning'] = $this->language->get('error_default');
		}

		$store_total = $this->model_setting_store->getTotalStoresByCurrency($currency_info['code']);

		if ($store_total) {
			$this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);
		}					
	}

	$order_total = $this->model_sale_order->getTotalOrdersByCurrencyId($currency_id);

	if ($order_total) {
		$this->error['warning'] = sprintf($this->language->get('error_order'), $order_total);
	}					
}

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