Bug 35028: Add self-registrations alert on staff interface main page

This adds a new system preference PatronSelfRegistrationAlert to enable
or disable alerts (disabled by default)

Test plan:
1. Create patron category SELFREG
2. Enable PatronSelfRegistration and set
   PatronSelfRegistrationDefaultCategory to SELFREG and
   PatronSelfRegistrationAlert to "Show"
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 "Self-registrations from: All libraries: 1 /
   <CURRENT LIBRARY>: 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 "Self-registrations 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 <fridolin.somers@biblibre.com>
Co-authored-by: Julian Maurice <julian.maurice@biblibre.com>
Sponsored-by: Écoles nationales supérieures d'architecture (ENSA)
Signed-off-by: William Lavoie <william.lavoie@inLibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
jeremy breuillard 2021-10-22 15:13:36 +00:00 committed by Katrin Fischer
parent 86a8c1d233
commit fbdc4132ea
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
5 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,15 @@
use Modern::Perl;
return {
bug_number => '35028',
description => 'Add system preference PatronSelfRegistrationAlert',
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
$dbh->do( "
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
('PatronSelfRegistrationAlert','0',NULL,'If enabled, an alter will be shown on staff interface home page when there are self-registered patrons.','YesNo')
" );
},
};

View File

@ -612,6 +612,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
('PatronSelfModificationMandatoryField','',NULL,'Define the required fields when a patron is editing their information via the OPAC','free'),
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
('PatronSelfRegistrationAlert','0',NULL,'If enabled, an alter will be shown on staff interface home page when there are self-registered patrons.','YesNo'),
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'),
('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','free'),
('PatronSelfRegistrationConfirmEmail', '0', NULL, 'Require users to confirm their email address by entering it twice.', 'YesNo'),

View File

@ -888,6 +888,12 @@ OPAC:
- '<br>If you choose <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EmailAddressForPatronRegistrations">EmailAddressForPatronRegistrations</a> you have to enter a valid email address: '
- pref: EmailAddressForPatronRegistrations
class: email
-
- pref: PatronSelfRegistrationAlert
choices:
0: "Don't show"
1: "Show"
- an alert on staff interface home page when there are patrons in the category defined by <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory">PatronSelfRegistrationDefaultCategory</a>.
Suggestions:
-
- pref: OpacSuggestionManagedBy

View File

@ -180,7 +180,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 && ( 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 ) %]
[% 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 %]
<div id="area-pending" class="page-section">
[% IF pending_article_requests %]
<div class="pending-info" id="article_requests_pending">
@ -275,6 +275,19 @@
<span class="pending-number-link">[% holds_with_cancellation_requests | html %]</span>
</div>
[% END %]
[% IF self_registered_count %]
<div class="pending-info" id="self_registered_patrons_info">
Self-registrations from:
<a class="self-registration-link pending-number-link self-registration-link-all" href="/cgi-bin/koha/members/member.pl?categorycode_filter=[% Koha.Preference('PatronSelfRegistrationDefaultCategory') | html %]">All libraries: [% self_registered_count | html %]</a>
[% IF self_registered_mybranch_count %]
<span>/</span>
<a class="self-registration-link pending-number-link self-registration-link-branch" href="/cgi-bin/koha/members/member.pl?categorycode_filter=[% Koha.Preference('PatronSelfRegistrationDefaultCategory') | html %]&branchcode_filter=[% Branches.GetLoggedInBranchcode | html %]">[% Branches.GetLoggedInBranchname | html %]: [% self_registered_mybranch_count | html %]</a>
[% END %]
</div>
[% END %]
</div>
[% END %]

View File

@ -138,6 +138,18 @@ if ( C4::Context->preference('CurbsidePickup') ) {
);
}
if ( C4::Context->preference('PatronSelfRegistrationAlert') ) {
my $categorycode = C4::Context->preference('PatronSelfRegistrationDefaultCategory');
my $branchcode = C4::Context::mybranch();
my $rs = Koha::Patrons->search( { categorycode => $categorycode } );
$template->param(
self_registered_count => $rs->count,
self_registered_mybranch_count => $rs->search( { branchcode => $branchcode } )->count,
);
}
$template->param(
pendingcomments => $pendingcomments,
pendingtags => $pendingtags,