From a5f5017d83367f8088700feb8653d8d14412b144 Mon Sep 17 00:00:00 2001 From: jeremy breuillard Date: Fri, 22 Oct 2021 15:13:36 +0000 Subject: [PATCH] Bug 35028: Add pre-registrations alert on staff interface main page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test plan: 1. Create patron category SELFREG 2. Enable PatronSelfRegistration and set PatronSelfRegistrationDefaultCategory to SELFREG 3. Go to OPAC, logout if needed, and create a new account. Remember the value you set for home library. 4. Go to staff interface, set the current library to the one you set in step 3. 5. Go to the staff interface main page. You should see at the bottom a message saying "Pre-registered patron(s) from: All libraries: 1 / : 1" (numbers can vary if you already had self-registered patrons) 6. Click on both links and verify that it shows the correct patrons (or redirect to the patron detail page if there is only one) 7. Set the current library to another one (one that doesn't have self-registered patrons) 8. Go to the staff interface main page. You should see at the bottom a message saying "Pre-registered patron(s) from: All libraries: 1" (numbers can vary if you already had self-registered patrons) 9. Click on the link and verify that it shows the correct patrons (or redirect to the patron detail page if there is only one) Co-authored-by: Fridolin Somers Co-authored-by: Julian Maurice Sponsored-by: Écoles nationales supérieures d'architecture (ENSA) --- .../prog/en/modules/intranet-main.tt | 14 +++++++++++++- mainpage.pl | 19 +++++++++++++++++++ members/member.pl | 9 +++++++-- 3 files changed, 39 insertions(+), 3 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 1b4dfe93dd..df90f07f4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -172,7 +172,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 %] + [% 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 || selfRegisteredPatrons %]
[% IF pending_article_requests %]
@@ -261,6 +261,18 @@
[% END %] + [% IF selfRegisteredPatrons %] +
+ Pre-registered patron(s) from: + All libraries: [% selfRegisteredPatrons | html %] + + [% IF selfRegisteredPatronsInMyBranch %] + / + [% Branches.GetLoggedInBranchname | html %]: [% selfRegisteredPatronsInMyBranch | html %] + [% END %] +
+ [% END %] +
[% END %] diff --git a/mainpage.pl b/mainpage.pl index 855913ae72..71bdcc9ee2 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -135,6 +135,25 @@ if ( C4::Context->preference('CurbsidePickup') ) { ); } +my $PatronSelfRegistrationDefaultCategory = C4::Context->preference('PatronSelfRegistrationDefaultCategory'); +if ($PatronSelfRegistrationDefaultCategory) { + my $selfRegisteredPatrons = Koha::Patrons->search( + { + categorycode => $PatronSelfRegistrationDefaultCategory, + } + )->count; + my $selfRegisteredPatronsInMyBranch = Koha::Patrons->search( + { + categorycode => $PatronSelfRegistrationDefaultCategory, + branchcode => C4::Context::mybranch(), + } + )->count; + $template->param( + selfRegisteredPatrons => $selfRegisteredPatrons, + selfRegisteredPatronsInMyBranch => $selfRegisteredPatronsInMyBranch, + ); +} + $template->param( pendingcomments => $pendingcomments, pendingtags => $pendingtags, diff --git a/members/member.pl b/members/member.pl index 909341bcd7..6e8879e577 100755 --- a/members/member.pl +++ b/members/member.pl @@ -65,16 +65,21 @@ if ( $quicksearch and $searchmember && !$circsearch ) { } my $searchfieldstype = $input->param('searchfieldstype') || 'standard'; +my $branchcode_filter = $input->param('branchcode_filter') // ''; +my $categorycode_filter = $input->param('categorycode_filter') // ''; $template->param( 'alphabet' => C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ); my $defer_loading = $input->request_method() eq "GET" && !$circsearch ? 1 : 0; +if ($branchcode_filter ne '' || $categorycode_filter ne '') { + $defer_loading = 0; +} $template->param( patron_lists => [ GetPatronLists() ], searchmember => $searchmember, - branchcode_filter => scalar $input->param('branchcode_filter'), - categorycode_filter => scalar $input->param('categorycode_filter'), + branchcode_filter => $branchcode_filter, + categorycode_filter => $categorycode_filter, searchfieldstype => $searchfieldstype, PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20, do_not_defer_loading => !$defer_loading, -- 2.30.2