Bugzilla – Attachment 128243 Details for
Bug 29628
Purchase suggestion link on staff main page should always show, even if logged in branch has 0 suggestions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29628: (follow-up) fix for rare edge case
Bug-29628-follow-up-fix-for-rare-edge-case.patch (text/plain), 9.74 KB, created by
David Nind
on 2021-12-04 04:38:06 UTC
(
hide
)
Description:
Bug 29628: (follow-up) fix for rare edge case
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-12-04 04:38:06 UTC
Size:
9.74 KB
patch
obsolete
>From 4daeaf55968af0139ec4b715b86a970487cc4adf Mon Sep 17 00:00:00 2001 >From: Andreas Roussos <a.roussos@dataly.gr> >Date: Fri, 3 Dec 2021 15:23:20 +0100 >Subject: [PATCH] Bug 29628: (follow-up) fix for rare edge case > >When the number of pending suggestions in the currently selected branch >is equal to the number of pending suggestions across all branches, the >`all_pendingsuggestions` template parameter is equal to 0. This results >in the "Suggestions pending approval:" block not being printed at all. > >This follow-up patch fixes that. > >Also fixed is the display of pending suggestions in Home > Acquisitions. > >Test plan: >1) Apply this patch. >2) Create two Library branches; submit two suggestions in each one. >3) Visit the Home page, and also visit Home > Acquisitions: you should > only see "${BRANCH_CODE}: 2" suggestions pending approval, regardless > of the branch you have selected using the 'Set library' menu option. >4) Delete both suggestions from the 1st branch, and set your library > to be the 1st branch. >5) Visit the same pages: this time "${BRANCH_CODE}: 0 / All libraries: 2" > is displayed. >6) Set your library to be the 2nd branch, and visit the same two pages: > this time "${BRANCH_CODE}: 2" is displayed. > >Signed-off-by: David Nind <david@davidnind.com> >--- > acqui/acqui-home.pl | 7 ++++--- > .../intranet-tmpl/prog/en/modules/acqui/acqui-home.tt | 10 +++++----- > .../intranet-tmpl/prog/en/modules/intranet-main.tt | 10 +++++----- > mainpage.pl | 7 ++++--- > 4 files changed, 18 insertions(+), 16 deletions(-) > >diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl >index 3010c6a3a3..6ee6fe0d0f 100755 >--- a/acqui/acqui-home.pl >+++ b/acqui/acqui-home.pl >@@ -51,14 +51,15 @@ my $status = $query->param('status') || "ASKED"; > # both to template > if( C4::Context->only_my_library ){ > my $local_pendingsuggestions_count = Koha::Suggestions->search({ status => "ASKED", branchcode => C4::Context->userenv()->{'branch'} })->count(); >- $template->param( suggestions_count => $local_pendingsuggestions_count ); >+ $template->param( local_suggestions_count => $local_pendingsuggestions_count ); > } else { > my $pendingsuggestions = Koha::Suggestions->search({ status => "ASKED" }); > my $local_pendingsuggestions_count = $pendingsuggestions->search({ 'me.branchcode' => C4::Context->userenv()->{'branch'} })->count(); > my $pendingsuggestions_count = $pendingsuggestions->count(); > $template->param( >- all_pendingsuggestions => $pendingsuggestions_count != $local_pendingsuggestions_count ? $pendingsuggestions_count : 0, >- suggestions_count => $local_pendingsuggestions_count >+ suggestions_counts_differ => $pendingsuggestions_count != $local_pendingsuggestions_count ? 1 : 0, >+ all_suggestions_count => $pendingsuggestions_count, >+ local_suggestions_count => $local_pendingsuggestions_count > ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >index 02f0bbac29..6663f1e0c3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >@@ -41,7 +41,7 @@ > [% END %] > [% END %] > <div class="row"> >- [% IF ( suggestion && suggestions_count ) %] >+ [% IF ( all_suggestions_count ) %] > <div class="col-sm-6"> > [% ELSE %] > <div class="col-sm-12"> >@@ -58,7 +58,7 @@ > </div> > </div> > >-[% IF ( CAN_user_suggestions_suggestions_manage && suggestion && suggestions_count ) %] >+[% IF ( CAN_user_suggestions_suggestions_manage && all_suggestions_count ) %] > <div class="col-sm-6"> > <div id="acqui_acqui_home_suggestions"> > <fieldset> >@@ -66,12 +66,12 @@ > <p> > Manage suggestions: > <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=[% Branches.GetLoggedInBranchcode | url %]#ASKED"> >- <span id="pendingsuggestions" class="pending-number-link">[% Branches.GetLoggedInBranchname | html %]: [% suggestions_count | html %]</span> >+ <span id="local_suggestions_count" class="pending-number-link">[% Branches.GetLoggedInBranchname | html %]: [% local_suggestions_count | html %]</span> > </a> >- [% IF (all_pendingsuggestions > 0) %] >+ [% IF (suggestions_counts_differ) %] > / > <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=__ANY__#ASKED"> >- <span id="all_pendingsuggestions" class="pending-number-link">All libraries: [% all_pendingsuggestions | html %]</span> >+ <span id="all_suggestions_count" class="pending-number-link">All libraries: [% all_suggestions_count | html %]</span> > </a> > [% END %] > </p> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index 6978be0f68..fd001e1ff8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -165,7 +165,7 @@ > <div class="row"> > <div class="col-sm-12"> > [%# Following statement must be in one line for translatability %] >- [% IF ( CAN_user_tools_moderate_comments && pendingcomments ) || ( CAN_user_tools_moderate_tags && pendingtags ) || ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) || ( CAN_user_suggestions_suggestions_manage && all_pendingsuggestions ) || ( CAN_user_borrowers_edit_borrowers && pending_discharge_requests ) || pending_article_requests || ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs %] >+ [% IF ( CAN_user_tools_moderate_comments && pendingcomments ) || ( CAN_user_tools_moderate_tags && pendingtags ) || ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) || ( CAN_user_suggestions_suggestions_manage && all_suggestions_count ) || ( CAN_user_borrowers_edit_borrowers && pending_discharge_requests ) || pending_article_requests || ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs %] > <div id="area-pending"> > [% IF pending_article_requests %] > <div class="pending-info" id="article_requests_pending"> >@@ -175,17 +175,17 @@ > </div> > [% END %] > >- [% IF ( CAN_user_suggestions_suggestions_manage && all_pendingsuggestions ) %] >+ [% IF ( CAN_user_suggestions_suggestions_manage && all_suggestions_count ) %] > <div class="pending-info" id="suggestions_pending"> > > Suggestions pending approval: > <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=[% Branches.GetLoggedInBranchcode | url %]#ASKED"> >- <span id="pendingsuggestions" class="pending-number-link">[% Branches.GetLoggedInBranchname | html %]: [% pendingsuggestions | html %]</span> >+ <span id="local_suggestions_count" class="pending-number-link">[% Branches.GetLoggedInBranchname | html %]: [% local_suggestions_count | html %]</span> > </a> >- [% IF (all_pendingsuggestions > 0) %] >+ [% IF (suggestions_counts_differ) %] > / > <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=__ANY__#ASKED"> >- <span id="all_pendingsuggestions" class="pending-number-link">All libraries: [% all_pendingsuggestions | html %]</span> >+ <span id="all_suggestions_count" class="pending-number-link">All libraries: [% all_suggestions_count | html %]</span> > </a> > [% END %] > </div> >diff --git a/mainpage.pl b/mainpage.pl >index 6972d39871..5f3b3b10bc 100755 >--- a/mainpage.pl >+++ b/mainpage.pl >@@ -81,14 +81,15 @@ my $pendingtags = get_count_by_tag_status(0); > > if( C4::Context->only_my_library ){ > my $local_pendingsuggestions_count = Koha::Suggestions->search({ status => "ASKED", branchcode => C4::Context->userenv()->{'branch'} })->count(); >- $template->param( pendingsuggestions => $local_pendingsuggestions_count ); >+ $template->param( local_suggestions_count => $local_pendingsuggestions_count ); > } else { > my $pendingsuggestions = Koha::Suggestions->search({ status => "ASKED" }); > my $local_pendingsuggestions_count = $pendingsuggestions->search({ 'me.branchcode' => C4::Context->userenv()->{'branch'} })->count(); > my $pendingsuggestions_count = $pendingsuggestions->count(); > $template->param( >- all_pendingsuggestions => $pendingsuggestions_count != $local_pendingsuggestions_count ? $pendingsuggestions_count : 0, >- pendingsuggestions => $local_pendingsuggestions_count >+ suggestions_counts_differ => $pendingsuggestions_count != $local_pendingsuggestions_count ? 1 : 0, >+ all_suggestions_count => $pendingsuggestions_count, >+ local_suggestions_count => $local_pendingsuggestions_count > ); > } > >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29628
:
128188
|
128220
|
128242
| 128243