diff --git a/installer/data/mysql/atomicupdate/bug-35028.pl b/installer/data/mysql/atomicupdate/bug-35028.pl new file mode 100644 index 0000000000..87a8c5348f --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-35028.pl @@ -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') + " ); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index fb968a638c..682b9fb950 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -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'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index bf9d5bec79..03739d28f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -888,6 +888,12 @@ OPAC: - '
If you choose EmailAddressForPatronRegistrations 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 PatronSelfRegistrationDefaultCategory. Suggestions: - - pref: OpacSuggestionManagedBy 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 30dc2daf50..0e3236a920 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -180,7 +180,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 ) %] + [% 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 pending_article_requests %]
@@ -275,6 +275,19 @@ [% holds_with_cancellation_requests | html %]
[% END %] + + [% IF self_registered_count %] +
+ Self-registrations from: + All libraries: [% self_registered_count | html %] + + [% IF self_registered_mybranch_count %] + / + [% Branches.GetLoggedInBranchname | html %]: [% self_registered_mybranch_count | html %] + [% END %] +
+ [% END %] +
[% END %] diff --git a/mainpage.pl b/mainpage.pl index d84408538e..2b78894aaa 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -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,