From 0616906b77098597d1f850b3b9fb27c0a7736b53 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 21 Apr 2017 10:10:37 -0400 Subject: [PATCH] Bug 18471 - Receiving order with unitprice greater than 1000 processing incorrectly Receiving orders process the comma as a decimal point Invoices are displaying incorrectly when formatting total Test Plan: 1. Open a basket 2. Place an order for an item with price > 1000, $4367.00 for example 3. Close basket 4. Receive order 5. Note on orderreceive.pl the price is populate as "4,367.00" 6. Receive/Save 7. Note the 'Actual Cost' is now $4.00, verify db contains 4 as well 8. Cancel receipt 9. Receive again, this time enter price as "4367" 10. Receive/save 11. Note actual cost is correct 12. Finish receiving 13. Note invoice reads total as $4.00 14. Check db. price in aqorders is correct but displaying incorrectly 15. Apply this patch 16. Repeat step2 1. 14, note errors are fixed Signed-off-by: Nicolas Legrand Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- acqui/finishreceive.pl | 3 +++ acqui/invoice.pl | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index e797963..5b8be31 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -33,6 +33,7 @@ use C4::Items; use C4::Search; use Koha::Acquisition::Bookseller; +use Koha::Number::Price; use List::MoreUtils qw/any/; @@ -58,6 +59,8 @@ my $bookfund = $input->param("bookfund"); my $order = GetOrder($ordernumber); my $new_ordernumber = $ordernumber; +$unitprice = Koha::Number::Price->new( $unitprice )->unformat(); + #need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME if ($quantityrec > $origquantityrec ) { my @received_items = (); diff --git a/acqui/invoice.pl b/acqui/invoice.pl index 66f3c58..339f261 100755 --- a/acqui/invoice.pl +++ b/acqui/invoice.pl @@ -124,8 +124,8 @@ my $total_tax_value = 0; foreach my $order (@$orders) { my $line = get_infos( $order, $bookseller); - $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{unitprice_tax_excluded} * $line->{quantity} )->format; - $line->{total_tax_included} = Koha::Number::Price->new( $line->{unitprice_tax_included} * $line->{quantity} )->format; + $line->{total_tax_excluded} = $line->{unitprice_tax_excluded} * $line->{quantity}; + $line->{total_tax_included} = $line->{unitprice_tax_included} * $line->{quantity}; $line->{tax_value} = $line->{tax_value_on_receiving}; $line->{tax_rate} = $line->{tax_rate_on_receiving}; -- 2.9.3