From 42524ed6ba44e3b7f6b8f6fe1aa7eb443314b2d9 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 12 Nov 2021 17:15:20 +0000 Subject: [PATCH] Bug 28627: Calculate unitprice if not set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On bug 23376 the developer was too clever by half. Instead of passing values to the template we moved to simply passing the order object. The calculations that populated the unitprice, however, were simply dropped. This patch restores the behaviour of setting unitprice to the estimated cost by default. We do this conditionally in the template To test: 1 - Create a basket and adding items to it. Set the 'Vendor price' to '20', do not add an 'Actual cost' 2 - Close the basket 3 - Select 'Receive shipment' 4 - Set a value for vendor invoice 5 - Receive the order you created 6 - Observe 'Actual cost' is = 0.00 7 - Apply patch 8 - Refresh the order receival page, and confirm the 'Actual cost' = 20.00 9 - Cancel receipt - reopen basket - edit order - add an actual cost - close 10 - Receive the order again 11 - Confirm the actual price is used 12 - Repeat this whole plan, but ensure the vendor has a different value for Invoice prices: Include tax Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 4755db8a1dfc6fcf856d55369ea102b3571f1625) Signed-off-by: Fridolin Somers --- .../intranet-tmpl/prog/en/modules/acqui/orderreceive.tt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 7921ad8673..b8704630f9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -344,9 +344,11 @@
  • [% IF (invoiceincgst) %] - (tax inclusive) + [% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_included : order.ecost_tax_included %] + (tax inclusive) [% ELSE %] - (tax exclusive) + [% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_excluded : order.ecost_tax_excluded %] + (tax exclusive) [% END %]
  • -- 2.39.5