Bugzilla – Attachment 143703 Details for
Bug 32167
When adding an order from a a staged file without item fields we only add price if there is a vendor discount
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32167: (bug 14860 follow-up) Populate price fields even if no discount on vendor
Bug-32167-bug-14860-follow-up-Populate-price-field.patch (text/plain), 3.39 KB, created by
Nick Clemens (kidclamp)
on 2022-11-10 19:30:00 UTC
(
hide
)
Description:
Bug 32167: (bug 14860 follow-up) Populate price fields even if no discount on vendor
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-11-10 19:30:00 UTC
Size:
3.39 KB
patch
obsolete
>From f6002ae5fc86aee6fa66c435f237abd48ca17a3e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 10 Nov 2022 19:24:25 +0000 >Subject: [PATCH] Bug 32167: (bug 14860 follow-up) Populate price fields even > if no discount on vendor > >On bug 14860 an 'else' was removed, assuming the price fields were set before discount, >this was incorrect. This patch renames the variable and always set the price, only discounting >ecost if a discount, but setting the values even if not > >To test: > 0 - Have a vendor with a discount of 0% specified (no discount) > 1 - Export a record from your Koha > 2 - Stage the record for import and match on biblionumber > 3 - Add to a basket in acq from the staged file > 4 - Select the title, and set order price to $10 and do not fill the discount field > 5 - Add the order - note $0 order line > 6 - Repeat with another vendor with a 10% discount and confirm that is correct > 7 - Apply patch > 8 - Repeat 2-4 > 9 - Add the order and confirm $10 price >10 - Repeat with discounted vendor, confirm prices are set discounted correctly > >https://bugs.koha-community.org/show_bug.cgi?id=14680 >--- > acqui/addorderiso2709.pl | 18 +++++++----------- > 1 file changed, 7 insertions(+), 11 deletions(-) > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index b65663d862..01a6fe644e 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -275,12 +275,10 @@ if ($op eq ""){ > $price = Koha::Number::Price->new($price)->unformat; > $orderinfo{tax_rate_on_ordering} = $bookseller->tax_rate; > $orderinfo{tax_rate_on_receiving} = $bookseller->tax_rate; >- my $c = $c_discount ? $c_discount : $bookseller->discount; >- $orderinfo{discount} = $c; >- if ( $c ) { >- $orderinfo{ecost} = $price * ( 1 - $c / 100 ); >- $orderinfo{rrp} = $price; >- } >+ my $order_discount = $c_discount ? $c_discount : $bookseller->discount; >+ $orderinfo{discount} = $order_discount; >+ $orderinfo{rrp} = $price; >+ $orderinfo{ecost} = $order_discount ? $price * ( 1 - $c / 100 ) : $price; > $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate; > $orderinfo{unitprice} = $orderinfo{ecost}; > } else { >@@ -324,12 +322,10 @@ if ($op eq ""){ > $c_price = Koha::Number::Price->new($c_price)->unformat; > $orderinfo{tax_rate_on_ordering} = $bookseller->tax_rate; > $orderinfo{tax_rate_on_receiving} = $bookseller->tax_rate; >- my $c = $c_discount ? $c_discount : $bookseller->discount; >+ my $order_discount = $c_discount ? $c_discount : $bookseller->discount; > $orderinfo{discount} = $c; >- if ( $c ) { >- $orderinfo{ecost} = $c_price * ( 1 - $c / 100 ); >- $orderinfo{rrp} = $c_price; >- } >+ $orderinfo{rrp} = $c_price; >+ $orderinfo{ecost} = $order_discount ? $c_price * ( 1 - $c / 100 ) : $c_price; > $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate; > $orderinfo{unitprice} = $orderinfo{ecost}; > } else { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32167
:
143703
|
143704
|
144077
|
144162
|
144208
|
144212