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
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 !!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user