Added missing validations in the back office

This commit is contained in:
vishalsingh.qlo325
2025-06-04 13:34:59 +05:30
parent 5da60bb913
commit 800ec6d645
6 changed files with 50 additions and 8 deletions

View File

@@ -401,8 +401,20 @@ class AdminLocalizationControllerCore extends AdminController
public function beforeUpdateOptions()
{
$lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT'));
if (!trim(Tools::getValue('PS_WEIGHT_UNIT'))) {
$this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Weight unit'));
}
if (!trim(Tools::getValue('PS_DISTANCE_UNIT'))) {
$this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Distance unit'));
}
if (!trim(Tools::getValue('PS_DIMENSION_UNIT'))) {
$this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Dimension unit'));
}
if (!trim(Tools::getValue('PS_VOLUME_UNIT'))) {
$this->errors[] = sprintf(Tools::displayError('field %s is required.'), $this->l('Volume unit'));
}
$lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT'));
if (!$lang->active) {
$lang->active = 1;
$lang->save();