From aaab3361b2a6d8d9218ba4e42f73296c57b74d72 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 4 Jun 2025 23:04:27 +0000 Subject: [PATCH] Bug 25090: Update PatronSelfRegistrationVerifyByEmail to include choices Signed-off-by: David Nind --- ...onSelfRegistrationVerifyByEmail_syspref.pl | 20 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../en/modules/admin/preferences/opac.pref | 8 +++++--- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_25090_-_update_PatronSelfRegistrationVerifyByEmail_syspref.pl diff --git a/installer/data/mysql/atomicupdate/bug_25090_-_update_PatronSelfRegistrationVerifyByEmail_syspref.pl b/installer/data/mysql/atomicupdate/bug_25090_-_update_PatronSelfRegistrationVerifyByEmail_syspref.pl new file mode 100755 index 0000000000..73bcec962a --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_25090_-_update_PatronSelfRegistrationVerifyByEmail_syspref.pl @@ -0,0 +1,20 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "25090", + description => "Moderate OPAC self registrations before a patron account is created", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do( + q{UPDATE systempreferences SET value = "off", options = "off|patron|library", type = "Choice" WHERE variable = "PatronSelfRegistrationVerifyByEmail" and value = "0"} + ); + $dbh->do( + q{UPDATE systempreferences SET value = "patron", options = "off|patron|library", type = "Choice" WHERE variable = "PatronSelfRegistrationVerifyByEmail" and value = "1"} + ); + + say_success( $out, "Updated system preference 'PatronSelfRegistrationVerifyByEmail' to include choices" ); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 09b8afd6fd..22da426cb3 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -635,7 +635,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PatronSelfRegistrationExpireTemporaryAccountsDelay','0',NULL,'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.','Integer'), ('PatronSelfRegistrationLibraryList','',NULL,'Only display libraries listed. If empty, all libraries are displayed.','Free'), ('PatronSelfRegistrationPrefillForm','1',NULL,'Display password and prefill login form after a patron has self-registered','YesNo'), -('PatronSelfRegistrationVerifyByEmail','0',NULL,'If enabled, any patron attempting to register themselves via the OPAC will be required to verify themselves via email to activate their account.','YesNo'), +('PatronSelfRegistrationVerifyByEmail','off','off|patron|library','If enabled, any patron attempting to register themselves via the OPAC will require self-verification or library verification via email to activate their account.','Choice'), ('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'), ('PhoneNotification','0',NULL,'If ON, enables generation of phone notifications to be sent by plugins','YesNo'), ('PlaceHoldsOnOrdersFromSuggestions','0',NULL,'If ON, enables generation of holds when orders are placed from suggestions','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 5441fd7e11..8b0aeb6f44 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 @@ -833,10 +833,12 @@ OPAC: - - pref: PatronSelfRegistrationVerifyByEmail choices: - 1: Require - 0: "Don't require" - - "that a self-registering patron verify themselves via email." + patron: "must verify themselves via email" + library: "must be verified via email sent to EmailPatronRegistrations" + off: "is not required to verify themselves" + - "to activate their account." - "
NOTE: This system preference requires the misc/cronjobs/cleanup_database.pl cronjob. Ask your system administrator to schedule it." + - "
NOTE: Ensure the EmailPatronRegistrations system preference is set if you choose that verification option." - - "Use" - pref: PatronSelfRegistrationDefaultCategory -- 2.39.5