Bugzilla – Attachment 135538 Details for
Bug 29607
addorderiso2709: The stored discount when importing an order from a file is invalid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29607: Store the discount amount correctly when importing and order from a file
Bug-29607-Store-the-discount-amount-correctly-when.patch (text/plain), 4.68 KB, created by
Jonathan Druart
on 2022-06-01 12:16:13 UTC
(
hide
)
Description:
Bug 29607: Store the discount amount correctly when importing and order from a file
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-06-01 12:16:13 UTC
Size:
4.68 KB
patch
obsolete
>From a0fd94cfdf8e6d82354bdbe25aec0a0654ca2434 Mon Sep 17 00:00:00 2001 >From: Christophe TORIN <christophe.torin@univ-rennes2.fr> >Date: Wed, 1 Jun 2022 14:14:38 +0200 >Subject: [PATCH] Bug 29607: Store the discount amount correctly when importing > and order from a file > >This bug fixes how the discount amount for an order is stored, when an order is added to a basket using "From staged MARC records". > >Test plan: >1. Export a record (without the items) (Tools > Catalog > Export data). >2. Delete the record from the catalog (including any items). >3. Stage the record for import (Tools > Catalog > Stage MARC records for import). >4. Create a new vendor with a discount of 25%. (Or select and existing vendor that has a discount). (Acquisitions > New vendor) >5. Create a new basket for the vendor. (Acquisitions > Manage orders > search for vendors > New > Basket). >6. Add to the basket using "From a staged file": > . select "Add orders" next to the staged file > . select the record to add to the order > . enter a price > . leave the discount field blank > . select a fund > . select "Save" > ==> The order is created! >7. Modify the order - note that the discount is showing on the form as .25% instead of 25%, also note that the discount amount is calculated correctly. >8. Check what is recorded in the database: > . koha-mysql kohadev > . select * from aqorders; > ==> discount field for the basket item shows as 0.2500 >9. Change the discount to 25%. Run step 8 again - discount amount will be correctly shown as 25.0000 >10. Apply the patch. >11. Repeat steps 1-9 - discount amount is shown and calculated correctly. >12. Test modifying the discount amount - should be calculated and shown correctly. >13. Sign off! > >See additional comments in the bug description. >--- > acqui/addorderiso2709.pl | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index 658adb03da4..dd90a398fb6 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -162,7 +162,6 @@ if ($op eq ""){ > my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1; > my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id; > my $c_discount = shift ( @discount); >- $c_discount = $c_discount / 100 if $c_discount > 1; > my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || ''; > my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || ''; > my $c_replacement_price = shift( @orderreplacementprices ); >@@ -275,13 +274,13 @@ if ($op eq ""){ > $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR"; > $price = Koha::Number::Price->new($price)->unformat; > $orderinfo{tax_rate} = $bookseller->tax_rate; >- my $c = $c_discount ? $c_discount : $bookseller->discount / 100; >+ my $c = $c_discount ? $c_discount : $bookseller->discount; > $orderinfo{discount} = $c; > if ( $c_discount ) { > $orderinfo{ecost} = $price; >- $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); >+ $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c / 100 ); > } else { >- $orderinfo{ecost} = $price * ( 1 - $c ); >+ $orderinfo{ecost} = $price * ( 1 - $c / 100 ); > $orderinfo{rrp} = $price; > } > $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate; >@@ -336,13 +335,13 @@ if ($op eq ""){ > $c_price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR"; > $c_price = Koha::Number::Price->new($c_price)->unformat; > $orderinfo{tax_rate} = $bookseller->tax_rate; >- my $c = $c_discount ? $c_discount : $bookseller->discount / 100; >+ my $c = $c_discount ? $c_discount : $bookseller->discount; > $orderinfo{discount} = $c; > if ( $c_discount ) { > $orderinfo{ecost} = $c_price; >- $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); >+ $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c / 100 ); > } else { >- $orderinfo{ecost} = $c_price * ( 1 - $c ); >+ $orderinfo{ecost} = $c_price * ( 1 - $c / 100 ); > $orderinfo{rrp} = $c_price; > } > $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate; >-- >2.25.1
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 29607
:
128127
|
135538
|
135561
|
135728