From e28f9861a94dc0428832cc15511d97cb9c51cfad Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 15 Dec 2019 12:32:34 +0100 Subject: [PATCH] Bug 24242: Display funds that the logged in user can access - suggestions The design of this script is pretty bad and any modifications is a challenge. Here we are trying to display to display the funds available for the logged in user. I did not understand previous code, as we are doing a limit using CanUserUseBudget, I do not think it makes sense to retrieve funds for a given library. Also, I am wondering if the dropdown list in the filters has ever been populated: budgetid_loop in the template *never* appeared in the history of suggestion.pl (??) Test plan: Search for suggestions Add/edit suggestions => The funds in the dropdown list should be the ones the logged in user can use. Signed-off-by: hc Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- .../prog/en/modules/suggestion/suggestion.tt | 4 ++-- suggestion/suggestion.pl | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 30ab2b46b9..38e5410bd0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -745,8 +745,8 @@ [% ELSE %] [% END %] - [% FOREACH budgetid_loo IN budgetid_loop %] - [% IF ( budgetid_loo.selected ) %] [% ELSE %][% END %] + [% FOREACH budgetsloo IN budgetsloop %] + [% IF ( budgetsloo.selected ) %][% ELSE %][% END %] [% END %]
  • diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index ef153ba88b..8c3056e807 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -351,14 +351,7 @@ my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG"); $template->param(patron_reason_loop=>$patron_reason_loop); #Budgets management -my $budgets = []; -if ($branchfilter) { - my $searchbudgets = { budget_branchcode => $branchfilter }; - $budgets = GetBudgets($searchbudgets); -} else { - $budgets = GetBudgets(undef); -} - +my $budgets = GetBudgets; my @budgets_loop; foreach my $budget ( @{$budgets} ) { next unless (CanUserUseBudget($borrowernumber, $budget, $userflags)); -- 2.39.5