Bugzilla – Attachment 67866 Details for
Bug 19425
Adding orders from order file with multiple budgets per record triggers error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19425 - Adding orders from order file with multiple budgets per record triggers error
Bug-19425---Adding-orders-from-order-file-with-mul.patch (text/plain), 2.35 KB, created by
Kyle M Hall (khall)
on 2017-10-10 11:32:19 UTC
(
hide
)
Description:
Bug 19425 - Adding orders from order file with multiple budgets per record triggers error
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-10-10 11:32:19 UTC
Size:
2.35 KB
patch
obsolete
>From 9916694ed0e2eedf6044c85dacdbf1c2f2967923 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 6 Oct 2017 09:47:26 -0400 >Subject: [PATCH] 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) 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> >--- > acqui/addorderiso2709.pl | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index 1aeaf3c..0c7bdce 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -245,6 +245,8 @@ if ($op eq ""){ > for (my $i = 0; $i < $count; $i++) { > $budget_hash->{$budget_codes[$i]}->{quantity} += 1; > $budget_hash->{$budget_codes[$i]}->{price} = $itemprices[$i]; >+ $budget_hash->{$budget_codes[$i]}->{itemnumbers} //= []; >+ push( $budget_hash->{$budget_codes[$i]}->{itemnumbers}, $itemnumbers[$i] ); > } > > # Create orderlines from MarcItemFieldsToOrder >@@ -306,7 +308,7 @@ if ($op eq ""){ > }; > > my $order = Koha::Acquisition::Order->new( \%orderinfo )->store; >- $order->add_item( $_ ) for @itemnumbers; >+ $order->add_item( $_ ) for @{ $budget_hash->{$budget_id}->{itemnumbers} }; > } > } > } else { >-- >2.10.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 19425
:
67715
|
67716
|
67866
|
68047
|
68048
|
68049
|
68050