From 73eb5fb6c5a93a7f43148039344f420b4ca2b2e9 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 30 Sep 2024 15:42:27 +0530 Subject: [PATCH 1/2] Fixed: Price for the auto-added services added to room, if room is added with auto-added services and then auto added services are removed from back-office and then' Go on payment page to process the payment' on order-opc page in fornt-office. --- .../classes/HotelRoomTypeFeaturePricing.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index e55e75be1..fd1ef9d93 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -750,12 +750,9 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $id_room )) { $selectedServices = array_shift($roomServicesServices); + $totalPrice['total_price_tax_incl'] += $selectedServices['total_price_tax_incl']; + $totalPrice['total_price_tax_excl'] += $selectedServices['total_price_tax_excl']; } - } - - if (isset($selectedServices)) { - $totalPrice['total_price_tax_incl'] += $selectedServices['total_price_tax_incl']; - $totalPrice['total_price_tax_excl'] += $selectedServices['total_price_tax_excl']; } else { if ($servicesWithTax = RoomTypeServiceProduct::getAutoAddServices( $id_product, From 99b6c846fe9ccf1ceaf3a546cc53574275891122 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 30 Sep 2024 20:02:09 +0530 Subject: [PATCH 2/2] Fixed: Payment received double times if admin changes the currency just before booking in back-office --- classes/order/OrderInvoice.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/classes/order/OrderInvoice.php b/classes/order/OrderInvoice.php index 509d77d3b..925239b1c 100644 --- a/classes/order/OrderInvoice.php +++ b/classes/order/OrderInvoice.php @@ -1011,12 +1011,24 @@ class OrderInvoiceCore extends ObjectModel { $cache_id = 'order_invoice_paid_'.(int)$this->id; if (!Cache::isStored($cache_id)) { + $objOrder = new Order($this->id_order); $amount = 0; + $payments = OrderPaymentDetail::getByInvoiceId($this->id); foreach ($payments as $payment) { /** @var OrderPayment $payment */ - $amount += ($payment['amount'] / $payment['conversion_rate']); + if ($payment['id_currency'] == $objOrder->id_currency) { + $amount += $payment['amount']; + } else { + $amountConverted = Tools::convertPrice($payment['amount'], $payment['id_currency'], false); + if ($objOrder->id_currency == Configuration::get('PS_CURRENCY_DEFAULT')) { + $amount += $amountConverted; + } else { + $amount += Tools::convertPrice($amountConverted, $objOrder->id_currency, true); + } + } } + Cache::store($cache_id, $amount); return $amount; }