From 401595beeff2e3696382e060752f39ead65a4837 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 15 Aug 2024 12:21:51 +0530 Subject: [PATCH] Fixed: issue occurs while deleting booking line. If there is no refund requests in the booking is created. --- classes/order/OrderReturnDetail.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/classes/order/OrderReturnDetail.php b/classes/order/OrderReturnDetail.php index fbff7a45e..5251ff559 100644 --- a/classes/order/OrderReturnDetail.php +++ b/classes/order/OrderReturnDetail.php @@ -70,12 +70,13 @@ public static function getReturnDetailByIdBookingDetail($idHtlBooking) public static function deleteReturnDetailByIdBookingDetail($idOrder, $idHtlBooking) { - $objOrderReturnDetail = OrderReturnDetail::getReturnDetailByIdBookingDetail($idHtlBooking); - if ($objOrderReturnDetail->delete()) { - $objOrderReturn = new OrderReturn(); - if (empty($objOrderReturn->getOrderRefundRequestedBookings($idOrder, $objOrderReturnDetail->id_order_return, true))) { - $objOrderReturn = new OrderReturn($objOrderReturnDetail->id_order_return); - $objOrderReturn->delete(); + if (Validate::isLoadedObject($objOrderReturnDetail = OrderReturnDetail::getReturnDetailByIdBookingDetail($idHtlBooking))) { + if ($objOrderReturnDetail->delete()) { + $objOrderReturn = new OrderReturn(); + if (empty($objOrderReturn->getOrderRefundRequestedBookings($idOrder, $objOrderReturnDetail->id_order_return, true))) { + $objOrderReturn = new OrderReturn($objOrderReturnDetail->id_order_return); + $objOrderReturn->delete(); + } } } }