Автозамены регионов
This commit is contained in:
@@ -270,6 +270,17 @@ class ControllerLocalisationZone extends Controller {
|
||||
$data['error_slug'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['contact_email'])) {
|
||||
$data['error_contact_email'] = $this->error['contact_email'];
|
||||
} else {
|
||||
$data['error_contact_email'] = '';
|
||||
}
|
||||
|
||||
foreach (array('gorod', 'gorodu', 'gorodom', 'strana', 'stranu', 'stranoi', 'strane', 'strany') as $replacement_field) {
|
||||
$key = 'replacement_' . $replacement_field;
|
||||
$data['error_' . $key] = isset($this->error[$key]) ? $this->error[$key] : '';
|
||||
}
|
||||
|
||||
$url = '';
|
||||
|
||||
if (isset($this->request->get['sort'])) {
|
||||
@@ -340,6 +351,42 @@ class ControllerLocalisationZone extends Controller {
|
||||
$data['slug'] = '';
|
||||
}
|
||||
|
||||
foreach (array('telephone', 'email', 'address', 'geocode', 'fax', 'open', 'comment') as $contact_field) {
|
||||
$key = 'contact_' . $contact_field;
|
||||
|
||||
if (isset($this->request->post[$key])) {
|
||||
$data[$key] = $this->request->post[$key];
|
||||
} elseif (!empty($zone_info)) {
|
||||
$data[$key] = $zone_info[$key];
|
||||
} else {
|
||||
$data[$key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array('gorod', 'gorodu', 'gorodom', 'strana', 'stranu', 'stranoi', 'strane', 'strany') as $replacement_field) {
|
||||
$key = 'replacement_' . $replacement_field;
|
||||
|
||||
if (isset($this->request->post[$key])) {
|
||||
$data[$key] = $this->request->post[$key];
|
||||
} elseif (!empty($zone_info)) {
|
||||
$data[$key] = $zone_info[$key];
|
||||
} else {
|
||||
$data[$key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$data['replacement_fields'] = array();
|
||||
|
||||
foreach (array('gorod', 'gorodu', 'gorodom', 'strana', 'stranu', 'stranoi', 'strane', 'strany') as $replacement_field) {
|
||||
$key = 'replacement_' . $replacement_field;
|
||||
$data['replacement_fields'][] = array(
|
||||
'name' => $key,
|
||||
'label' => $this->language->get('entry_' . $key),
|
||||
'value' => $data[$key],
|
||||
'error' => $data['error_' . $key]
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($this->request->post['country_id'])) {
|
||||
$data['country_id'] = $this->request->post['country_id'];
|
||||
} elseif (!empty($zone_info)) {
|
||||
@@ -378,6 +425,18 @@ class ControllerLocalisationZone extends Controller {
|
||||
$this->error['slug'] = $this->language->get('error_slug_exists');
|
||||
}
|
||||
|
||||
if ($this->request->post['contact_email'] !== '' && !filter_var($this->request->post['contact_email'], FILTER_VALIDATE_EMAIL)) {
|
||||
$this->error['contact_email'] = $this->language->get('error_contact_email');
|
||||
}
|
||||
|
||||
foreach (array('gorod', 'gorodu', 'gorodom', 'strana', 'stranu', 'stranoi', 'strane', 'strany') as $replacement_field) {
|
||||
$key = 'replacement_' . $replacement_field;
|
||||
|
||||
if ((utf8_strlen(trim($this->request->post[$key])) < 1) || (utf8_strlen($this->request->post[$key]) > 128)) {
|
||||
$this->error[$key] = $this->language->get('error_replacement');
|
||||
}
|
||||
}
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user