From fb84631208f89296f30953626ff2b488d1f76bcc 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 | 38 ++++++++++++++++--- mainpage.pl | 13 +++++-- 2 files changed, 42 insertions(+), 9 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..360ac1579c1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -186,7 +186,7 @@
[%# 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 && ( pendingsuggestions || 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('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && pending_biblio_tickets && CAN_user_editcatalogue_edit_catalogue ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs || new_curbside_pickups.count || ( holds_with_cancellation_requests && CAN_user_circulate_circulate_remaining_permissions ) || self_registered_count %] + [% 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 && ( pendingsuggestions || 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('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && pending_biblio_tickets && CAN_user_editcatalogue_edit_catalogue ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs || new_curbside_pickups.count || ( holds_with_cancellation_requests && CAN_user_circulate_circulate_remaining_permissions ) || self_registered_count || ( holds_to_pull && CAN_user_circulate_circulate_remaining_permissions ) %]
[% IF pending_article_requests %]
@@ -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 %] @@ -265,6 +284,13 @@
[% END %] + [% IF holds_to_pull && CAN_user_circulate_circulate_remaining_permissions %] +
+ New holds to pull: + [% holds_to_pull | html %] +
+ [% END %] + [% IF new_curbside_pickups.count %]
New curbside pickups: diff --git a/mainpage.pl b/mainpage.pl index 21a1ad3c445..64aeb6b2e1a 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -37,6 +37,8 @@ use Koha::Suggestions; use Koha::BackgroundJobs; use Koha::CurbsidePickups; use Koha::Tickets; +use Koha::Token; +use Koha::Holds; my $query = CGI->new; @@ -102,9 +104,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 ) : (), @@ -130,6 +134,7 @@ unless ( $logged_in_user->has_permission( { parameters => 'manage_background_job $template->param( holds_with_cancellation_requests => Koha::Holds->waiting->filter_by_has_cancellation_requests->count ); +my $holds_to_pull = Koha::Holds->search( found => undef )->count; if ( C4::Context->preference('CurbsidePickup') ) { $template->param( @@ -157,9 +162,11 @@ $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, + holds_to_pull => $holds_to_pull, ); output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5