From 9588f6eb875b95258f7274dc9ea80256dfe46d29 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 6 Mar 2014 10:40:50 +0100 Subject: [PATCH] Bug 11733: gist can be multi-valued The gist syspref should always be treated as multi-value. In basketgroup.pl, parcel.pl and invoice.pl it is treated as single-value. The invoice.pl script will be fixed by bug 10613. If the pref contains several values, the first one is the default one (according to the syspref description). Test plan: basketgroup.pl: create a vendor with List prices don't include tax and invoice prices include tax. add 1 basket with 1+ order(s) receive them and check that the total amount on the basket page is the same as on the basketgroup page Verify this is right for other vendor configurations. On parcel.pl, this patch only removes dead code. The $gst variable is not used. --- acqui/basketgroup.pl | 11 ++++++----- acqui/parcel.pl | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index cdb392d..b81bdf8 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -77,10 +77,6 @@ sub BasketTotal { my @orders = GetOrders($basketno); for my $order (@orders){ $total = $total + ( $order->{ecost} * $order->{quantity} ); - if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{gstrate} // C4::Context->preference("gist") )) { - my $gst = $bookseller->{gstrate} // C4::Context->preference("gist"); - $total = $total * ( $gst / 100 +1); - } } $total .= " " . ($bookseller->{invoiceprice} // 0); return $total; @@ -230,7 +226,12 @@ sub printbasketgrouppdf{ -type => 'application/pdf', -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf' ); - my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{gstrate} // C4::Context->preference("gist")) || die "pdf generation failed"; + my $gstrate = $bookseller->{gstrate}; + unless ( defined $gstrate ) { + ( $gstrate ) = split /\|/, C4::Context->preference("gist"); + } + + my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $gstrate) || die "pdf generation failed"; print $pdf; } diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 557030c..0ba0282 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -146,7 +146,6 @@ unless( $invoiceid and $invoice->{invoiceid} ) { my $booksellerid = $invoice->{booksellerid}; my $bookseller = GetBookSellerFromId($booksellerid); -my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; my $datereceived = C4::Dates->new(); my $cfstr = "%.2f"; # currency format string -- could get this from currency table. -- 2.0.0.rc2