From 42c8019b4dc29211a76f82b6c95855e5601a6345 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Nov 2014 16:44:27 +0100 Subject: [PATCH] Bug 13321: use the populate_with_prices where needed Now we need to calculate the prices (ecost, rrp, unitprice) and tax (tax_rate, tax_value) when the price is set for an order. This only appends in the 3 files impacted by this patch. addorder*.pl on ordering finishreceive.pl on receiving Signed-off-by: Laurence Rault Signed-off-by: Francois Charbonnier Signed-off-by: Sonia Bouis Signed-off-by: Sonia Bouis Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- acqui/addorder.pl | 8 ++++++++ acqui/addorderiso2709.pl | 12 ++++++++++++ acqui/finishreceive.pl | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/acqui/addorder.pl b/acqui/addorder.pl index c35b8514e5..81064ff599 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -268,6 +268,14 @@ 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, + } + ); + # if we already have $ordernumber, then it's an ordermodif my $order = Koha::Acquisition::Order->new($orderinfo); if ( $orderinfo->{ordernumber} ) { diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index e4250515ff..9a7739c3b2 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -233,6 +233,18 @@ if ($op eq ""){ # remove uncertainprice flag if we have found a price in the MARC record $orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; + + %orderinfo = %{ + C4::Acquisition::populate_order_with_prices( + { + order => \%orderinfo, + booksellerid => $booksellerid, + ordering => 1, + receiving => 1, + } + ) + }; + my $order = Koha::Acquisition::Order->new( \%orderinfo )->insert; # 4th, add items if applicable diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 0a628877f1..53a7412a41 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -103,6 +103,14 @@ if ($quantityrec > $origquantityrec ) { } } + $order = C4::Acquisition::populate_order_with_prices( + { + order => $order, + booksellerid => $booksellerid, + receiving => 1 + } + ); + # save the quantity received. if ( $quantityrec > 0 ) { ( $datereceived, $new_ordernumber ) = ModReceiveOrder( -- 2.39.5