From d1890533c8796873149338831c5de13d5b19cb9e 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 --- 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 3ce7e1e133..db0c66bdc7 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 7911662d7e..818eb2852e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -227,7 +227,7 @@