From 86628133b00f5600582a66e30ec65be6b7a3140c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 19 May 2023 10:44:33 +0000 Subject: [PATCH] Bug 33783: (bug 8179 follow-up) Populate actual cost with ecost during receiving if not set This restores behavior prior to 8179 to use the estimated cost when receiving if the actual cost is not set To test: 1 - Add some orders to a basket, do not set actual cost field 2 - Close basket, receive orders 3 - Note actual cost field is blank 4 - Cancel receipt 5 - Apply patch 6 - Receive again 7 - Note actual cost is populated 8 - Complete receipt and confirm actual cost correctly saved --- .../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 b2ab673a26..5de480ccc7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -1135,12 +1135,14 @@ if(invoiceincgst == "1") { rrp_txt = Number(row.rrp_tax_included).format_price()+' '+ADJ_TAX_INC.format(active_currency)+""; ecost_txt = Number(row.ecost_tax_included).format_price()+' '+TAX_INC+""; - $("#unitprice").val(row.unit_price_tax_included); + var init_unitprice = row.unit_price_tax_included > 0 ? row.unit_price_tax_included : row.ecost_tax_included + $("#unitprice").val(init_unitprice); $("#unitprice_hint").html(TAX_INC); } else { rrp_txt = Number(row.rrp_tax_excluded).format_price()+' '+ADJ_TAX_EXC.format(active_currency)+""; ecost_txt = Number(row.ecost_tax_excluded).format_price()+' '+TAX_EXC+""; - $("#unitprice").val(row.unit_price_tax_excluded); + var init_unitprice = row.unit_price_tax_excluded > 0 ? row.unit_price_tax_excluded : row.ecost_tax_excluded + $("#unitprice").val(init_unitprice); $("#unitprice_hint").html(TAX_EXC); } $("#rrp").html(rrp_txt); -- 2.30.2