[Koha-bugs] [Bug 29628] Purchase suggestion link on staff main page should always show, even if logged in branch has 0 suggestions

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Dec 10 15:32:33 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29628

Andreas Roussos <a.roussos at dataly.gr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |a.roussos at dataly.gr

--- Comment #10 from Andreas Roussos <a.roussos at dataly.gr> ---
(In reply to Lucas Gass from comment #8)
> (In reply to Katrin Fischer from comment #6)
> > Hi Lucas, can you please check if this is a duplicate to bug 29571?
> 
> Katrin, looks like a duplicate to me. I will close this one but I am curious
> if Bug 29571 needs Andreas's follow-up. I am unable to reproduce the edge
> case.
Hi Lucas -- by all means, please feel free to close this bug ;-)

Jonathan's fix in Bug 29571 is much shorter/cleaner than my follow-up
patch here, and also deals with the edge case I described.

FWIW, the edge case would manifest after applying the initial patch
submitted for this bug, since in the template file
koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt

178     [% IF ( CAN_user_suggestions_suggestions_manage && pendingsuggestions )
%]

was changed to

178     [% IF ( CAN_user_suggestions_suggestions_manage &&
all_pendingsuggestions ) %]

In mainpage.pl, the template parameter `all_pendingsuggestions` would
be equal to 0 if the number of pending suggestions in the currently
selected branch is equal to the number of pending suggestions across
all branches (see line 90 below):

 86     my $pendingsuggestions = Koha::Suggestions->search({ status => "ASKED"
});
 87     my $local_pendingsuggestions_count = $pendingsuggestions->search({
'me.branchcode' => C4::Context->userenv()->{'branch'} })->count();
 88     my $pendingsuggestions_count = $pendingsuggestions->count();
 89     $template->param(
 90         all_pendingsuggestions => $pendingsuggestions_count !=
$local_pendingsuggestions_count ? $pendingsuggestions_count : 0,
 91         pendingsuggestions => $local_pendingsuggestions_count
 92     );

Thus, the condition inside the template [% IF %] block would be false
and the "Suggestions pending approval:" text would not appear at all.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list