From ef69833ccce76a2cfd6f49061251ac1c7dc6510c Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 10 Jul 2025 13:53:51 +0200 Subject: [PATCH 1/2] PreorderBilling: Fixed rounding of totals --- .../PreorderBillingInvoiceController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/application/PreorderBillingInvoice/PreorderBillingInvoiceController.php b/application/PreorderBillingInvoice/PreorderBillingInvoiceController.php index 010967c34..89a5fd72d 100644 --- a/application/PreorderBillingInvoice/PreorderBillingInvoiceController.php +++ b/application/PreorderBillingInvoice/PreorderBillingInvoiceController.php @@ -377,8 +377,8 @@ class PreorderBillingInvoiceController extends mfBaseController { $position_data["article_number"] = $bill->article_number; $position_data["product_name"] = $bill->product_name; $position_data["article_info"] = $bill->product_info; - $position_data["total"] = round($price, 2); - $position_data["total_gross"] = round($price_gross, 2); + $position_data["total"] = $price; + $position_data["total_gross"] = $price_gross; $position_data["vatrate"] = $bill->vatrate; $position_data["billing_id"] = $bill->id; $position_data["fibu_cost_account"] = $bill->fibu_cost_account; @@ -527,6 +527,10 @@ class PreorderBillingInvoiceController extends mfBaseController { $total_net += $position->price_total; $total_gross += $position->price_gross; + $position->price_total = round($position->price_total, 2); + $position->price_gross = round($position->price_gross, 2); + + if (!$position->save()) { $invoice->rollbackTransaction(); die("Error saving Invoiceposition"); From be94e29d088b6a5997d238bddca0d025e7c0a5f9 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 10 Jul 2025 14:55:48 +0200 Subject: [PATCH 2/2] removing PStatusNotifyLog entry when updateing Order Date --- application/Preorder/PreorderController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/application/Preorder/PreorderController.php b/application/Preorder/PreorderController.php index 758ea3e5a..f1e1b3af4 100644 --- a/application/Preorder/PreorderController.php +++ b/application/Preorder/PreorderController.php @@ -1167,6 +1167,8 @@ class PreorderController extends mfBaseController { return false; } + + $orderdate_ts = Layout::dateToInt($order_date); $preorder->order_date = $orderdate_ts; if(!$preorder->save()) { @@ -1174,6 +1176,13 @@ class PreorderController extends mfBaseController { return false; } + if($preorder->status->code < 500 || !$preorder->adb_wohneinheit->enduser_setup_invoice_date) { + // remove from 300-custom-new-order log if exitisting, so the email will be sent again + foreach(PreorderStatusnotificationLog::search(["preorder_id" => $preorder->id, "email_type" => "300-custom-new-order"]) as $psnl) { + $psnl->delete(); + } + } + return ["message" => "Orderdate saved successfully", "preorder_id" => $preorder_id, "order_date" => $order_date]; }