From e52eaa7c9b4bcc36c507d455ed3124199507b4ad Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 8 Jun 2022 16:05:30 +0000 Subject: [PATCH] Bug 30849: show pending modifications by branch To test: 1. Add some borrower modifications from the OPAC from patrons that belong to some different libraries. 2. On the staff client mainpage (mainpage.pl) you should see a link 'Patrons requesting modifications:' but no way of knowing if they are patrons from your logged in branch or not 3. Apply patch, restart_all 4. Try step 2 again and now you should see something like 'Patrons requesting modifications: Centerville: 1 / All libraries: 2'; 5. Turn on IndependentBranchesPatronModifications. 6. Log in as a superlibrarian, you should see branch specific and All libraries requests. 7. Log in as a non-superlibrarian, you should only see requests for your branch. 8. Trying and and fulfilling some modifcations and make sure the numbers on mainpage.pl are always correct. Signed-off-by: Sally --- .../prog/en/modules/intranet-main.tt | 29 +++++++++++++++---- mainpage.pl | 10 +++++-- 2 files changed, 31 insertions(+), 8 deletions(-) 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 fe5e0597aaa..740713c5640 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -224,11 +224,30 @@ [% END %] - [% IF ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) %] -
- Patrons requesting modifications: - [% pending_borrower_modifications | html %] -
+ [% IF CAN_user_borrowers_edit_borrowers && pending_borrower_modifications %] + [% IF Koha.Preference('IndependentBranchesPatronModifications') && !CAN_user_superlibrarian %] + [% IF pending_local_borrowermods %] + + [% END %] + [% ELSE %] + + [% END %] [% END %] [% IF CAN_user_borrowers_edit_borrowers && pending_discharge_requests %] diff --git a/mainpage.pl b/mainpage.pl index 21a1ad3c445..f6b7fe9dbb6 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -37,6 +37,7 @@ use Koha::Suggestions; use Koha::BackgroundJobs; use Koha::CurbsidePickups; use Koha::Tickets; +use Koha::Token; my $query = CGI->new; @@ -102,9 +103,11 @@ if ( C4::Context->only_my_library ) { ); } -my $pending_borrower_modifications = Koha::Patron::Modifications->pending_count($branch); -my $pending_discharge_requests = Koha::Patron::Discharge::count( { pending => 1 } ); -my $pending_article_requests = Koha::ArticleRequests->search_limited( +my $pending_borrower_modifications = Koha::Patron::Modifications->pending_count($branch); +my $local_pendingmodifications_count = Koha::Patron::Modifications->pending_count( C4::Context->userenv()->{'branch'} ); + +my $pending_discharge_requests = Koha::Patron::Discharge::count( { pending => 1 } ); +my $pending_article_requests = Koha::ArticleRequests->search_limited( { status => Koha::ArticleRequest::Status::Requested, $branch ? ( 'me.branchcode' => $branch ) : (), @@ -157,6 +160,7 @@ $template->param( pendingcomments => $pendingcomments, pendingtags => $pendingtags, pending_borrower_modifications => $pending_borrower_modifications, + pending_local_borrowermods => $local_pendingmodifications_count, pending_discharge_requests => $pending_discharge_requests, pending_article_requests => $pending_article_requests, pending_problem_reports => $pending_problem_reports, -- 2.39.5