From 16ce46bb389488affdb174d948f6c06068b579fc Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Sun, 3 Nov 2024 23:53:03 +0000 Subject: [PATCH] Bug 25090: Update PatronSelfRegistrationVerifyByEmail to include choices This database update changes PatronSelfRegistrationVerifyByEmail from a YesNo preference to have these options: * don't require (same as 0 previously) * patron verifies (same as 1 previously) * library verifies, based on the EmailPatronRegistrations syspref setting Sponsored-by: Mental Health Education & Resource Centre Signed-off-by: Owen Leonard --- ...atronSelfRegistrationVerifyByEmail_syspref.pl | 16 ++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/opac.pref | 9 ++++++--- 3 files changed, 23 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..1edd16b83c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_25090_-_update_PatronSelfRegistrationVerifyByEmail_syspref.pl @@ -0,0 +1,16 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "25090", + description => "Redirect self-registration verification email to the library", + 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 34ada9d837..e9b1b1cca3 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -617,7 +617,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 1be562220e..d79a6ba69a 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 @@ -791,12 +791,15 @@ OPAC: - "library patrons to register for an account via the OPAC." - "
NOTE: This needs PatronSelfRegistrationDefaultCategory to be set to a valid patron category code." - + - "A self-registering patron" - 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