From a2831b69f53065938d2c19cad7e5b888c67fb7a9 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). --- acqui/addorderiso2709.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 4942571..1427c2f 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; @@ -223,11 +223,12 @@ if ($op eq ""){ my $bookseller = GetBookSellerFromId( $basket->{booksellerid} ); $orderinfo{gstrate} = $bookseller->{gstrate}; if ( $bookseller->{listincgst} ) { - $orderinfo{ecost} = $price; + $orderinfo{rrp} = $price; + $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $bookseller->{discount} ); } else { - $orderinfo{ecost} = $price * ( 1 + $orderinfo{gstrate} ); + $orderinfo{rrp} = $price / ( 1 + $orderinfo{gstrate} ); + $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $bookseller->{discount} ); } - $orderinfo{rrp} = ( $orderinfo{ecost} * 100 ) / ( 100 - $bookseller->{discount} ); $orderinfo{listprice} = $orderinfo{rrp}; $orderinfo{unitprice} = $orderinfo{ecost}; $orderinfo{total} = $orderinfo{ecost}; -- 1.7.10.4