From 8f256790fea12ed50ca9dff275edbcb8b78a19e8 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 Signed-off-by: Joy Nelson (cherry picked from commit de309a26746523de2e39e285727d691b0b10392c) Signed-off-by: Lucas Gass --- .../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 4875e8f3e2..fbf5947e0f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -737,8 +737,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