Merge pull request #1733 from amitsharma322/gli-2984

Fixed: rating should not be a required field, as ratings are not applicable to all hotels.
This commit is contained in:
Rohit Jain
2026-06-12 19:47:58 +05:30
committed by GitHub
3 changed files with 4 additions and 8 deletions

View File

@@ -51,7 +51,7 @@ class HotelBranchInformation extends ObjectModel
'fields' => array(
'id_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'email' => array('type' => self::TYPE_STRING,'validate' => 'isEmail', 'size' => 255, 'required' => true),
'rating' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'rating' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'check_in' => array('type' => self::TYPE_STRING, 'required' => true),
'check_out' => array('type' => self::TYPE_STRING, 'required' => true),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
@@ -1160,7 +1160,7 @@ class HotelBranchInformation extends ObjectModel
{
// set additional hotel address and restriction fields validations here
if (isset($this->webservice_validation) && $this->webservice_validation) {
if ($this->rating < 1 || $this->rating > 5) {
if ($this->rating && ($this->rating < 1 || $this->rating > 5)) {
$message = Tools::displayError('Rating must be between 1 and 5.');
} elseif (!strtotime($this->check_in)) {
$message = Tools::displayError('Check In time is invalid.');

View File

@@ -391,10 +391,6 @@ class AdminAddHotelController extends ModuleAdminController
$this->errors[] = $this->l('Check Out time must be before Check In time.');
}
if (!$rating) {
$this->errors[] = $this->l('Rating is required field.');
}
if (!$address = trim($address)) {
$this->errors[] = $this->l('Address is required field.');
}

View File

@@ -214,11 +214,11 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3 required" for="hotel_country">{l s='Rating :' mod='hotelreservationsystem'}</label>
<label class="control-label col-sm-3 " for="hotel_country">{l s='Rating :' mod='hotelreservationsystem'}</label>
<div class="col-sm-6">
<div style="width: 195px;">
<select class="form-control" name="hotel_rating" id="hotel_rating" value="">
<option value="">{l s='No star' mod='hotelreservationsystem'}</option>
<option value="0">{l s='No star' mod='hotelreservationsystem'}</option>
<option value="1" {if (isset($smarty.post.hotel_rating) && $smarty.post.hotel_rating == '1') || isset($edit) && $hotel_info['rating'] == '1'}selected{/if}>*</option>
<option value="2" {if (isset($smarty.post.hotel_rating) && $smarty.post.hotel_rating == '2') || isset($edit) && $hotel_info['rating'] == '2'}selected{/if}>**</option>
<option value="3" {if (isset($smarty.post.hotel_rating) && $smarty.post.hotel_rating == '3') || isset($edit) && $hotel_info['rating'] == '3'}selected{/if}>***</option>