From 4b91df5ea4065011ee0df64826454cd7c2dd3399 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Tue, 5 May 2020 09:07:56 +0000 Subject: [PATCH] Bug 25090: Add 2 new sysprefs allowing libraries to approve OPAC registrations Added: * PatronSelfRegistrationVerifyByEmailToLibrary - Default value = 'None' * PatronSelfRegistrationVerifyByEmailToPatron - Default value = "Don't require" Removed: * PatronSelfRegistrationVerifyByEmail For existing Koha installs if removed PatronSelfRegistrationVerifyByEmail was enabled then PatronSelfRegistrationVerifyByEmailToPatron is enabled - they have the same behaviour when enabled. Sponsored-By: Mental Health Education Resource Centre, NZ --- ...fRegistrationVerifyByEmailToPatron_sysprefs.perl | 21 +++++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 3 ++- .../prog/en/modules/admin/preferences/opac.pref | 13 +++++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_25090-add_PatronSelfRegistrationVerifyByEmailToLibrary_and_PatronSelfRegistrationVerifyByEmailToPatron_sysprefs.perl diff --git a/installer/data/mysql/atomicupdate/bug_25090-add_PatronSelfRegistrationVerifyByEmailToLibrary_and_PatronSelfRegistrationVerifyByEmailToPatron_sysprefs.perl b/installer/data/mysql/atomicupdate/bug_25090-add_PatronSelfRegistrationVerifyByEmailToLibrary_and_PatronSelfRegistrationVerifyByEmailToPatron_sysprefs.perl new file mode 100644 index 00000000000..f10c26bd402 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_25090-add_PatronSelfRegistrationVerifyByEmailToLibrary_and_PatronSelfRegistrationVerifyByEmailToPatron_sysprefs.perl @@ -0,0 +1,21 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + my $sth = $dbh->prepare("SELECT value from systempreferences WHERE variable='PatronSelfRegistrationVerifyByEmail'"); + $sth->execute; + my ($value) = $sth->fetchrow; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('PatronSelfRegistrationVerifyByEmailToPatron', '$value', NULL, 'If enabled, any patron attempting to register themselves via the OPAC will will receieve an email requiring him or her to verify themselves via email to activate their account', 'YesNo'); + }); + + $dbh->do(q{ + DELETE FROM systempreferences WHERE variable='PatronSelfRegistrationVerifyByEmail'; + }); + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('PatronSelfRegistrationVerifyByEmailToLibrary', '0', '0|BranchEmailAddress|KohaAdminEmailAddress', 'If enabled, when a patron attempts to register themselves via the OPAC a verification email will be sent to the library to approve the activation of the patron account.', 'Choice'); + }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 25090 - Add two new sysprefs PatronSelfRegistrationVerifyByEmailToPatron and PatronSelfRegistrationVerifyByEmailToLibrary so libraries have option to moderate which registrations get Koha accounts)\n"; +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 0e9f4880559..f0691bcb2af 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -506,7 +506,8 @@ 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'), +('PatronSelfRegistrationVerifyByEmailToLibrary', '0', '0|BranchEmailAddress|KohaAdminEmailAddress', 'If enabled, when a patron attempts to register themselves via the OPAC a verification email will be sent to the library to approve the activation of the patron account.', 'Choice'), +('PatronSelfRegistrationVerifyByEmailToPatron','0',NULL,'If enabled, any patron attempting to register themselves via the OPAC will will receieve an email requiring him or her to verify themselves via email to activate their account','YesNo'), ('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'), ('EnablePayPalOpacPayments', '0', NULL , 'Enables the ability to pay fees and fines from the OPAC via PayPal', 'YesNo' ), ('PatronQuickAddFields', '', NULL , 'A list of fields separated by "|" to be displayed along with mandatory fields in the patron quick add form if chosen at patron entry', 'Free' ), 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 3d8cd4fab9a..c0dfa71d9ce 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 @@ -792,12 +792,21 @@ OPAC: - "library patrons to register for an account via the OPAC." - "
NOTE: This needs PatronSelfRegistrationDefaultCategory to be set to a valid patron category code." - - - pref: PatronSelfRegistrationVerifyByEmail + - pref: PatronSelfRegistrationVerifyByEmailToPatron choices: yes: Require no: "Don't require" - "that a self-registering patron verify themselves via email." - - "
NOTE: This system preference requires the misc/cronjobs/cleanup_database.pl cronjob. Ask your system administrator to schedule it." + + - "

Enable librarian verification of OPAC self registrations by sending verification email to" + - pref: PatronSelfRegistrationVerifyByEmailToLibrary + default: 0 + choices: + 0: None + BranchEmailAddress: email address of branch + KohaAdminEmailAddress: KohaAdminEmailAddress + - "for a librarian to approve activation of Koha account.

" + - "
NOTE: Both of these system preferences requires the misc/cronjobs/cleanup_database.pl cronjob. Ask your system administrator to schedule it." - - "Use the patron category code" - pref: PatronSelfRegistrationDefaultCategory -- 2.11.0