From 59dca922a4ef692a9063ea977bbf3fca3c77adf5 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 18 May 2024 10:51:14 +0530 Subject: [PATCH] Fixed:When we set Order status as cancelled the rooms are set is_refunded=1 in the htl_booking_detail table instead of is_cancelled = 1 --- .../hotelreservationsystem/classes/HotelBookingDetail.php | 4 ++-- modules/hotelreservationsystem/hotelreservationsystem.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 047e1de46..e7abb8d20 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -1975,10 +1975,10 @@ class HotelBookingDetail extends ObjectModel * * @return [boolean] [true if updated otherwise false] */ - public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1) + public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1, $is_cancelled = 0) { $table = 'htl_booking_detail'; - $data = array('is_refunded' => (int) $is_refunded); + $data = array('is_refunded' => (int) $is_refunded, 'is_cancelled' => (int) $is_cancelled); if ($id_rooms) { foreach ($id_rooms as $key_rm => $val_rm) { diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index bf6473245..bbb1018b5 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -484,7 +484,11 @@ class HotelReservationSystem extends Module // Make rooms available for booking if order status is cancelled, refunded or error if (in_array($params['newOrderStatus']->id, $objHtlBkDtl->getOrderStatusToFreeBookedRoom())) { - if (!$objHtlBkDtl->updateOrderRefundStatus($params['id_order'])) { + $isCancalled = 0; + if ($params['newOrderStatus']->id == Configuration::get('PS_OS_CANCELED')) { + $isCancalled = 1; + } + if (!$objHtlBkDtl->updateOrderRefundStatus($params['id_order'], false, false, array(), 1, $isCancalled)) { $this->context->controller->errors[] = $this->l('Error while making booked rooms available, attached with this order. Please try again !!'); } }