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

@@ -143,12 +143,25 @@ class AdminHotelBedTypesController extends ModuleAdminController
return;
}
if (!trim(Tools::getValue('width'))) {
$this->errors[] = $this->l('Field Width is required');
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
$objDefaultLanguage = Language::getLanguage((int) $defaultLangId);
$languages = Language::getLanguages(false);
if (!trim(Tools::getValue('name_'.$defaultLangId))) {
$this->errors[] = $this->l('Bed type name is required at least in ').$objDefaultLanguage['name'];
} else {
foreach ($languages as $lang) {
if (trim(Tools::getValue('name_'.$lang['id_lang'])) && !Validate::isGenericName(Tools::getValue('name_'.$lang['id_lang']))) {
$this->errors[] = $this->l('Invalid bed type name in ').$lang['name'];
}
}
}
if (!trim(Tools::getValue('length'))) {
$this->errors[] = $this->l('Field Length is required');
if (!(float) Tools::getValue('width')) {
$this->errors[] = $this->l('The width field is required');
}
if (!(float) Tools::getValue('length')) {
$this->errors[] = $this->l('The length field is required');
}
return parent::processSave();

View File

@@ -510,6 +510,7 @@ class HotelReservationSystem extends Module
'htl_room_type_global_demand_advance_option',
'htl_order_refund_rules',
'htl_settings_link',
'htl_bed_type'
);
//If Admin update new language when we do entry in module all lang tables.
HotelHelper::updateLangTables($newIdLang, $langTables);