Added: New restrictions to the admin while updating the booking from the back office

This commit is contained in:
vishalsingh.qlo325
2025-01-22 16:11:53 +05:30
parent 950b37ed1c
commit c22186b8db
3 changed files with 10 additions and 2 deletions

View File

@@ -37,7 +37,7 @@
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
{dateFormat date=$data.date_from}
{else}
<input type="text" class="form-control edit_product_date_from" readonly/>
<input type="text" class="form-control edit_product_date_from" readonly {if isset($data.id_status) && ($data.id_status != HotelBookingDetail::STATUS_ALLOTED)}disabled{/if}/>
<div class="input-group-addon"><i class="icon-calendar"></i></div>
{/if}
</div>
@@ -49,7 +49,7 @@
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
{dateFormat date=$data.date_to}
{else}
<input type="text" class="form-control edit_product_date_to" readonly/>
<input type="text" class="form-control edit_product_date_to" readonly {if isset($data.id_status) && ($data.id_status != HotelBookingDetail::STATUS_CHECKED_OUT)}disabled{/if}/>
<div class="input-group-addon"><i class="icon-calendar"></i></div>
{/if}
</div>

View File

@@ -7172,6 +7172,10 @@ class AdminOrdersControllerCore extends AdminController
|| (strtotime($statusDate) > strtotime($dateTo))
) {
$this->errors[] = Tools::displayError('Date should be between booking from date and to date.');
} else if (date('Y-m-d', strtotime($objHotelBookingDetail->check_out)) != date('Y-m-d', strtotime($objHotelBookingDetail->date_to))
&& ($booked = $objHotelBookingDetail->chechRoomBooked($objHotelBookingDetail->id_room, $objHotelBookingDetail->check_out, $objHotelBookingDetail->date_to))
) {
$this->errors[] = Tools::displayError('You cannot update this room\'s booking status as a new booking has been created for this room. Please change the room to update the status.');
}
}
if ($newStatus == HotelBookingDetail::STATUS_CHECKED_OUT) {

View File

@@ -1427,6 +1427,10 @@ class HotelBookingDetail extends ObjectModel
pSQL($date_to).'\' AND date_to >= \''.pSQL($date_to).'\') OR (date_from < \''.pSQL($date_from).
'\' AND date_to > \''.pSQL($date_to).'\'))';
if ($this->id) {
$sql .= ' AND `id` !='.(int) $this->id;
}
return Db::getInstance()->getRow($sql);
}