Bug 19425: Adding orders from order file with multiple budgets per record triggers...
authorKyle M Hall <kyle@bywatersolutions.com>
Fri, 6 Oct 2017 13:47:26 +0000 (09:47 -0400)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 25 Oct 2017 08:34:02 +0000 (10:34 +0200)
commitd1475051bae13621bf2b56b68443e375bc2e1ea7
tree1ff4413902ed070d3ba43cbe48af48ffca491e25
parent4d22af870d1051d963cab31169a7f536864e56b0
Bug 19425: Adding orders from order file with multiple budgets per record triggers error

If you import an order file ( using MarcItemFieldsToOrder ) that has a different budget for each item to be ordered, you will get an error and a partially created basket. This is because Koha attempts to add the item to each order *for each budget*. This is clearly incorrect. Instead, we should be grouping items by budget and for each budget only adding those items that have a matching budget.

Test plan:
1) Do not apply this patch
2) Download the provided MARC record
3) Add the branchcode 'ALD' to your server
4) Add the ccode 'ACOL' to your server
5) Add the budget codes 'adultay' and 'branchay' to your server
6) Stage the order file
7) Create a basket, import the order file
8) No we have 3 records, 2 of them have 2 items each with different budget codes
9) Attempt to import, note the error
10) Apply this patch
11) Repeat steps 6-8, note the order completes and results in 5 order lines being added to the basket!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Christopher Kellermeyer <ckellermeyer@altadenalibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
First step of test plan amended (not apply instead of apply).

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0dc722c5183bdd162eba6992a4d38a1a9d28f285)
acqui/addorderiso2709.pl