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

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Nick Clemens 2025-02-05 18:58:10 +00:00 committed by Katrin Fischer
parent 58ec1ed304
commit c5f598d874
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -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->{to_placed_on} = my $to_placed_on = dt_from_string;
$filters->{from_placed_on}->set_time_zone('floating')->subtract( years => 1 ); $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( $template->param(
type => 'intranet', type => 'intranet',
loop_budget => \@budget_loop, loop_budget => \@budget_loop,
bp_loop => $bp_loop,
total => $total, total => $total,
totspent => $totspent, totspent => $totspent,
totordered => $totordered, totordered => $totordered,