From 77ada9271d34c40dccd44054381fb1d6a3affeed Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Tue, 5 Sep 2023 13:48:36 +0000 Subject: [PATCH] Bug 34717: Fix budget selection This patch replaces GetBudgetByCode with GetBudget to allow budget population to happen correctly Test plan: Needs to be tested using the file attached as it includes the field mappings Needs to be tested in KTD as the mappings match a budget created in the KTD sample data (sandboxes run on KTD so are suitable for this) 1) In system preferences, search for MarcFieldsToOrder 2) Paste the following into the syspref: price: 975$p quantity: 975$q budget_code: 975$h 3) Save the syspref 4) In Acquistions, choose a vendor and go into a basket 5) Click Add to basket 6) Select From a new file 7) Use the file attached to this bug 8) Click Upload file 9) At the bottom, click Stage for import 10) When the import is complete, click Add staged files to basket 11) Tick the box next to the record name 12) Observe that under fund, you are being asked to select a fund 13) Apply patch 14) restart_all 15) Refresh the page 16) Observe that the budget has now defaulted to Fund 1_2 as per the mappings in the marc file --- acqui/addorderiso2709.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 250d9c2bb3..97fd06a8a4 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -41,7 +41,7 @@ use C4::Biblio qw( TransformHtmlToXml ); use C4::Items qw( PrepareItemrecordDisplay AddItemFromMarc ); -use C4::Budgets qw( GetBudget GetBudgets GetBudgetHierarchy CanUserUseBudget GetBudgetByCode ); +use C4::Budgets qw( GetBudget GetBudgets GetBudgetHierarchy CanUserUseBudget ); use C4::Suggestions; # GetSuggestion use C4::Members; @@ -508,7 +508,7 @@ sub import_biblios_list { my $sort2 = $infos->{sort2}; my $budget_id; if($budget_code) { - my $biblio_budget = GetBudgetByCode($budget_code); + my $biblio_budget = GetBudget($budget_code); if($biblio_budget) { $budget_id = $biblio_budget->{budget_id}; } @@ -534,7 +534,7 @@ sub import_biblios_list { my $item_budget_code = $iteminfos->{budget_code}; my $item_budget_id; if ( $iteminfos->{budget_code} ) { - my $item_budget = GetBudgetByCode( $iteminfos->{budget_code} ); + my $item_budget = GetBudget( $iteminfos->{budget_code} ); if ( $item_budget ) { $item_budget_id = $item_budget->{budget_id}; } -- 2.37.1 (Apple Git-137.1)