From 53d25dc0a8bbc40d7033f3e258ed338c42019320 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 24 Oct 2024 13:01:29 +0530 Subject: [PATCH 01/14] Fixed: Price is calculated and saved incorrectly when admin tries to update booking not having any service/demands in the back-office --- controllers/admin/AdminOrdersController.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 6dfcdaced..1e467e15d 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -4886,10 +4886,6 @@ class AdminOrdersControllerCore extends AdminController $order->total_products_wt += (float)$diff_price_tax_incl; $order->total_products_wt = $order->total_products_wt > 0 ? $order->total_products_wt : 0; - $order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); - $res &= $order->update(); } @@ -5043,7 +5039,6 @@ class AdminOrdersControllerCore extends AdminController )) { // update extra demands total prices if dates are changes (price calc method for each day) if ($extraDemands) { - $order = new Order($id_order); foreach ($extraDemands as $demand) { if (isset($demand['extra_demands']) && $demand['extra_demands']) { foreach ($demand['extra_demands'] as $rDemand) { @@ -5072,19 +5067,13 @@ class AdminOrdersControllerCore extends AdminController } } } - // change order total save - $order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); - $order->save(); } if (isset($orderServiceProducts) && is_array($orderServiceProducts) && count($orderServiceProducts) ) { - $order = new Order((int) $id_order); foreach ($orderServiceProducts as $orderServiceProduct) { if (isset($orderServiceProduct['additional_services']) && is_array($orderServiceProduct['additional_services']) @@ -5140,13 +5129,15 @@ class AdminOrdersControllerCore extends AdminController } } - $order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); - $order->save(); } } + $order = new Order((int) $id_order); + $order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); + $order->save(); + if (is_array(Tools::getValue('product_quantity'))) { $view = $this->createTemplate('_customized_data.tpl')->fetch(); } else { From 3a291feb1392dcf9af0746ae007fea526ea6b80d Mon Sep 17 00:00:00 2001 From: Aman deep sharma Date: Thu, 16 Jan 2025 20:31:43 +0530 Subject: [PATCH 02/14] [Fixed]: Order invoice does not get updated --- .../orders/modals/_edit_room_tab_content.tpl | 9 + controllers/admin/AdminOrdersController.php | 207 +++++++++--------- 2 files changed, 115 insertions(+), 101 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl index 1bb98114b..7df2e26b9 100644 --- a/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_edit_room_tab_content.tpl @@ -127,6 +127,15 @@ + {if sizeof($invoices_collection)} -
+