From 37a6859acaaa725e96496757e58ab9922430fdde Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Fri, 8 Dec 2017 11:58:15 +1300 Subject: [PATCH] Bug 19780 - Updating the invoice costs after updating of the actual value post receiving of the order This invoice will update the invoice values if the order actual price value is modified after the order has been received. Test plan: 1. Create an order with the vendor price: 10.00 and actual price of 12.00 2. Close the order and receive the shipment. Change the actual price in the receival page to 14.00 3. View the invoices and notice that 14.00 is the value displayed 4. Go back to the order and click on the order line to modify the order. Change the actual price to 15.00 5. View the invoice now and notice that 14.00 is still the value being displayed 6. Apply patch 7. Repeat steps 1,2,3,4 and 5 and notice that 15.00 is the value displayed in the invoice 8. Now repeat steps 1. View the aqorders database table and notice after step 1 is completed the order has unitprice:12.00 and unitprice_tax_included and unitprice_tax_excluded values of NULL 9. Now before closing the order modify it and set the actual price to 14.00 10. Check the aqorders table again and notice that the unitprice is 14.00 and the unitprice_tax_included and unitprice_tax_excluded both equal NULL. This means the unitprice_tax_included and unitprice_tax_excluded values are not being updated before the order has been receieved by they are being correctly updated if the order has been received and the actual price is changed. Sponsored-by: Horowhenua Distircit Council --- acqui/addorder.pl | 27 +++++++++++++++------- acqui/neworderempty.pl | 7 ++++++ .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 2 +- .../prog/en/modules/acqui/neworderempty.tt | 3 +++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/acqui/addorder.pl b/acqui/addorder.pl index c102779..3f4bf3a 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -132,7 +132,7 @@ use C4::Output; use Koha::Acquisition::Currencies; use Koha::Acquisition::Orders; use C4::Barcodes; - +use Data::Dumper; ### "-------------------- addorder.pl ----------" # FIXME: This needs to do actual error checking and possibly return user to the same form, @@ -268,13 +268,24 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq ''; - $orderinfo = C4::Acquisition::populate_order_with_prices( - { - order => $orderinfo, - booksellerid => $orderinfo->{booksellerid}, - ordering => 1, - } - ); + my $modify = $input->param('modify'); + if ($orderinfo->{ordernumber} && !$modify) { + $orderinfo = C4::Acquisition::populate_order_with_prices( + { + order => $orderinfo, + booksellerid => $orderinfo->{booksellerid}, + receiving => 1, + } + ); + } elsif ( $modify ) { + $orderinfo = C4::Acquisition::populate_order_with_prices( + { + order => $orderinfo, + booksellerid => $orderinfo->{booksellerid}, + ordering => 1, + } + ); + } # if we already have $ordernumber, then it's an ordermodif my $order = Koha::Acquisition::Order->new($orderinfo); diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index ab92985..854b71e 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -106,6 +106,7 @@ my $close = $input->param('close'); my $uncertainprice = $input->param('uncertainprice'); my $import_batch_id = $input->param('import_batch_id'); # if this is filled, we come from a staged file, and we will return here after saving the order ! my $subscriptionid = $input->param('subscriptionid'); +my $modify = $input->param('modifying'); my $data; my $new = 'no'; @@ -300,6 +301,12 @@ my $quantity = $input->param('rr_quantity_to_order') ? $data->{'quantity'}; $quantity //= 0; +if ($modify) { + $template->param( + modify => $modify + ); +} + $template->param( existing => $biblionumber, ordernumber => $ordernumber, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 08aa656..ff1c1bf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -646,7 +646,7 @@ [% IF ( active ) %] [% UNLESS ( closedate ) %] - Modify + Modify [% UNLESS (books_loo.order_received) %]
Transfer diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index faa2db4..d37ce34 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -641,6 +641,9 @@ $(document).ready(function()
+ [% IF (modify) %] + + [% END %] [% IF (suggestionid) %] Cancel -- 2.1.4