From d576b9428f24c1af5d89c75d6a35d982fe25aba6 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 5 Feb 2025 18:58:10 +0000 Subject: [PATCH] Bug 39044: Pass budgets to template This simply copies the fetch of budgets from the acqui/histsearch.pl script. We should in the future make this a template or other method to avoid code duplication, but we should fix the functionality first. To test: 1 - Go to Acqusitions 2 - See the dropdown "Fund: All funds" in the order search section 3 - Click it 4 - Feel disappointed 5 - Apply patch and restart all 6 - Reload and click the dropdown 7 - Options! Feel warm and fuzzy --- acqui/acqui-home.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index af1034d3093..b2cd9d8f2c1 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -129,9 +129,20 @@ $filters->{from_placed_on} = my $from_placed_on = dt_from_string; $filters->{to_placed_on} = my $to_placed_on = dt_from_string; $filters->{from_placed_on}->set_time_zone('floating')->subtract( years => 1 ); +my $budgetperiods = C4::Budgets::GetBudgetPeriods; +my $bp_loop = $budgetperiods; +for my $bp ( @{$budgetperiods} ) { + my $hierarchy = C4::Budgets::GetBudgetHierarchy( $$bp{budget_period_id}, undef, undef, 1 ); + for my $budget ( @{$hierarchy} ) { + $$budget{budget_display_name} = sprintf( "%s", ">" x $$budget{depth} . $$budget{budget_name} ); + } + $$bp{hierarchy} = $hierarchy; +} + $template->param( type => 'intranet', loop_budget => \@budget_loop, + bp_loop => $bp_loop, total => $total, totspent => $totspent, totordered => $totordered, -- 2.39.5