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 <katrin.fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2018-01-17 19:50:31 +00:00
parent 7dab4cd903
commit d1890533c8
2 changed files with 9 additions and 2 deletions

View file

@ -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,

View file

@ -227,7 +227,7 @@
<li><label for="budget_code_item_[% item.item_id | html %]">budget_code</label><select id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% item.biblio_count | html %]">
<option value="">Select a fund</option>
[% FOREACH budget_loo IN budget_loop %]
[% IF ( budget_loo.b_code ) == ( item.budget_code ) %]<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
[% IF ( budget_loo.b_id ) == ( item.budget_id ) %]<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
[% ELSE %]<option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
[% END %]
[% END %]