From 8b8b5061b49953e876a145ed22a971858b7842c1 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 17 Jan 2018 19:50:31 +0000 Subject: [PATCH] Bug 20014: Preselect item budget based on id not code To test: 1 - Have the same fund code in two budgets 2 - Have budget code defined in MarcItemFieldsToOrder 3 - Stage a file with some order items as defined above 4 - Inspect the fuinds drop down in the item, notice two lines are marked selected 5 - Apply patch 6 - Repeat 7 - Only one field should be selected, with a preference for active budget Signed-off-by: Katrin Fischer Signed-off-by: Chris Cormack Signed-off-by: Nick Clemens (cherry picked from commit d1890533c8796873149338831c5de13d5b19cb9e) Signed-off-by: Martin Renvoize (cherry picked from commit 41b67901d2a6f46452d590916a0cb57f29a69496) Signed-off-by: Fridolin Somers (cherry picked from commit bff9e80adfa7692963a564c5c35c507d81e1f34b) Signed-off-by: Fridolin Somers --- acqui/addorderiso2709.pl | 9 ++++++++- .../prog/en/modules/acqui/addorderiso2709.tt | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 22f35bdd24..7acff423bf 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -544,6 +544,13 @@ sub import_biblios_list { my $item_copyno = $iteminfos->{copyno}; my $item_quantity = $iteminfos->{quantity} || 1; my $item_budget_code = $iteminfos->{budget_code}; + my $item_budget_id; + if ( $iteminfos->{budget_code} ) { + my $item_budget = GetBudgetByCode( $iteminfos->{budget_code} ); + if ( $item_budget ) { + $item_budget_id = $item_budget->{budget_id}; + } + } my $item_price = $iteminfos->{price}; my $item_replacement_price = $iteminfos->{replacementprice}; my $item_callnumber = $iteminfos->{itemcallnumber}; @@ -564,7 +571,7 @@ sub import_biblios_list { 'uri' => $item_uri, 'copyno' => $item_copyno, 'quantity' => $item_quantity, - 'budget_code' => $item_budget_code || $budget_code, + 'budget_id' => $item_budget_id || $budget_id, 'itemprice' => $item_price || $price, 'replacementprice' => $item_replacement_price, 'itemcallnumber' => $item_callnumber, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index fe420c405b..107b408a13 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -385,7 +385,7 @@