From d47ba89d01548eed6fdfdbd1621f256d90485b95 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 13 Dec 2012 14:26:54 +0100 Subject: [PATCH] Bug 9280: FIX price calculation adding an order from a staged file Test plan: Add an order from a staged file containing a price value (010$d for UNIMARC user). Check this patch with 2 different vendors (listprice=1 and listprice=0). Check the calculated price (depending discount and gstrate). Signed-off-by: mathieu saby --- acqui/addorderiso2709.pl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 4942571..0e0670f 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -189,7 +189,7 @@ if ($op eq ""){ SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); } # 3rd add order - my $patron = C4::Members->GetMember( borrowernumber => $loggedinuser ); + my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser ); my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} ); # get quantity in the MARC record (1 if none) my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1; @@ -222,12 +222,8 @@ if ($op eq ""){ my $basket = GetBasket( $orderinfo{basketno} ); my $bookseller = GetBookSellerFromId( $basket->{booksellerid} ); $orderinfo{gstrate} = $bookseller->{gstrate}; - if ( $bookseller->{listincgst} ) { - $orderinfo{ecost} = $price; - } else { - $orderinfo{ecost} = $price * ( 1 + $orderinfo{gstrate} ); - } - $orderinfo{rrp} = ( $orderinfo{ecost} * 100 ) / ( 100 - $bookseller->{discount} ); + $orderinfo{rrp} = $price; + $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $bookseller->{discount} / 100 ); $orderinfo{listprice} = $orderinfo{rrp}; $orderinfo{unitprice} = $orderinfo{ecost}; $orderinfo{total} = $orderinfo{ecost}; -- 1.7.10.4