Bug 29607: Store the discount amount correctly when importing and order from a file
authorChristophe TORIN <christophe.torin@univ-rennes2.fr>
Wed, 1 Jun 2022 12:14:38 +0000 (14:14 +0200)
committerLucas Gass <lucas@bywatersolutions.com>
Tue, 12 Jul 2022 16:00:49 +0000 (16:00 +0000)
commita5f31c6e2ecc9c85558d57c3f26c6cdedaa68912
tree8363d6468d476c746af689bcf98f4af4b7a4a83f
parentf3603ab9dcc34823906fa8e2f8a2071479c6d124
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.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f72b8cbd3eb77ded61e08714b68969f7cacc8224)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
acqui/addorderiso2709.pl