From 8ebc176663eac9767012d0925e51aaeb7c5f832c Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 23 Feb 2024 08:59:30 +0100 Subject: [PATCH] Bug 36155: Improve perfs of suggestion.pl when there are many budgets Page suggestion/suggestion.pl calls CanUserUseBudget() in a loop, will must use a uniq Koha::Patron object of the logged in user. When there are many budgets and funds this takes some time. Test plan : Compare performance with and without patch with many budgets and funds (see test plan of Bug 35921) --- suggestion/suggestion.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 39521c6495..fb639fcbec 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -548,7 +548,7 @@ $template->param( patron_reason_loop => $patron_reason_loop ); my $sugg_budget_loop = []; my $sugg_budgets = GetBudgetHierarchy(); foreach my $r ( @{$sugg_budgets} ) { - next unless ( CanUserUseBudget( $borrowernumber, $r, $userflags ) ); + next unless ( CanUserUseBudget( $librarian->unblessed, $r, $userflags ) ); my $selected = ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0; push @{$sugg_budget_loop}, { -- 2.43.0