From b4b11d07985a73fc88a983854be97d6d6ce64b32 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 8 Mar 2022 16:15:52 +0000 Subject: [PATCH] Bug 30237: Replace AutoEmailOpacUser with AutoEmailNewUser Content-Type: text/plain; charset=utf-8 This patch replaces the AutoEmailOpacUser system preference with a new AutoEmailNewUser preference. This makes the functionof the preference clearer. Signed-off-by: Kyle M Hall Signed-off-by: Marcel de Rooy --- C4/UsageStats.pm | 2 +- installer/data/mysql/atomicupdate/bug_30237.pl | 7 ++++++- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/patrons.pref | 4 ++-- members/memberentry.pl | 4 ++-- opac/opac-memberentry.pl | 4 ++-- opac/opac-registration-verify.pl | 4 ++-- t/db_dependent/Context.t | 6 +++--- 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 12378b1b15..181a5cb555 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -324,7 +324,7 @@ sub _shared_preferences { TrackClicks PatronSelfRegistration OPACShelfBrowser - AutoEmailOpacUser + AutoEmailNewUser AutoEmailPrimaryAddress autoMemberNum BorrowerRenewalPeriodBase diff --git a/installer/data/mysql/atomicupdate/bug_30237.pl b/installer/data/mysql/atomicupdate/bug_30237.pl index 9f33af64b2..0114abda85 100644 --- a/installer/data/mysql/atomicupdate/bug_30237.pl +++ b/installer/data/mysql/atomicupdate/bug_30237.pl @@ -8,6 +8,11 @@ return { my ($dbh, $out) = @$args{qw(dbh out)}; # Add WELCOME notice $dbh->do( q{ - INSERT IGNORE INTO letter (module, code, name, is_html, title, content, message_transport_type) VALUES ('members', 'WELCOME', 'Welcome notice', 1, '[% USE Koha %]Welcome to [% Koha.Preference('LibraryName') %]', "[% USE Koha %]\r\nHello [% borrower.title %] [% borrower.firstname %] [% borrower.surname %].\r\n\r\nThankyou for joining [% Koha.Preference('LibraryName') %]\r\n\r\nThe library's catalog can be found here.\r\n\r\nYour library card number is [% borrower.cardnumber %]\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.", 'email');}); + INSERT IGNORE INTO letter (module, code, name, is_html, title, content, message_transport_type) VALUES ('members', 'WELCOME', 'Welcome notice', 1, "[% USE Koha %]Welcome to [% Koha.Preference('LibraryName') %]", "[% USE Koha %]\r\nHello [% borrower.title %] [% borrower.firstname %] [% borrower.surname %].\r\n\r\nThankyou for joining [% Koha.Preference('LibraryName') %]\r\n\r\nThe library's catalog can be found here.\r\n\r\nYour library card number is [% borrower.cardnumber %]\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.", 'email');}); + + # Update system preference + $dbh->do( q{ + UPDATE systempreferences SET variable = 'AutoEmailNewUser', explanation = 'Send an email to newly created patrons.' WHERE variable = 'AutoEmailOpacUser' + }); }, }; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 34523550c0..d6618ceb45 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -74,7 +74,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'), ('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'), ('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'), -('AutoEmailOpacUser','0',NULL,'Sends notification emails containing new account details to patrons - when account is created.','YesNo'), +('AutoEmailNewUser','0',NULL,'Send an email to newly created patrons.','YesNo'), ('AutoEmailPrimaryAddress','OFF','email|emailpro|B_email|cardnumber|OFF','Defines the default email address where \'Account Details\' emails are sent.','Choice'), ('AutoShareWithMana','subscription','','defines datas automatically shared with mana','multiple'), ('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff interface from unauthorized IP addresses','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 256962915b..7401b5af9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -143,11 +143,11 @@ Patrons: - "patron messaging setting on the OPAC." - '
NOTE: EnhancedMessagingPreferences must be enabled.' - - - pref: AutoEmailOpacUser + - pref: AutoEmailNewUser choices: 1: Send 0: "Don't send" - - an email to newly created patrons with their account details. + - an email to newly created patrons. - - pref: UseEmailReceipts choices: diff --git a/members/memberentry.pl b/members/memberentry.pl index e4f56a470d..4e25891dd0 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -459,8 +459,8 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ delete $newdata{password}; } - # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. - if ( C4::Context->preference("AutoEmailOpacUser") ) { + # If 'AutoEmailNewUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. + if ( C4::Context->preference("AutoEmailNewUser") ) { #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead my $emailaddr = $patron->notice_email_address; # if we manage to find a valid email address, send notice diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 66a6484719..f456362c3a 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -244,8 +244,8 @@ if ( $action eq 'create' ) { $template->param( password_cleartext => $patron->plain_text_password ); $template->param( borrower => $patron->unblessed ); - # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. - if ( C4::Context->preference("AutoEmailOpacUser") ) { + # If 'AutoEmailNewUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. + if ( C4::Context->preference("AutoEmailNewUser") ) { #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead my $emailaddr = $patron->notice_email_address; # if we manage to find a valid email address, send notice diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl index 4c7c8d0dd0..73ff55e6e5 100755 --- a/opac/opac-registration-verify.pl +++ b/opac/opac-registration-verify.pl @@ -85,8 +85,8 @@ if ( $template->param( password_cleartext => $patron->plain_text_password ); $template->param( borrower => $patron ); - # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. - if ( C4::Context->preference("AutoEmailOpacUser") ) { + # If 'AutoEmailNewUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. + if ( C4::Context->preference("AutoEmailNewUser") ) { # Look up correct email address taking AutoEmailPrimaryAddress into account my $emailaddr = $patron->notice_email_address; # if we manage to find a valid email address, send notice diff --git a/t/db_dependent/Context.t b/t/db_dependent/Context.t index 433510b2cb..77a8924822 100755 --- a/t/db_dependent/Context.t +++ b/t/db_dependent/Context.t @@ -126,9 +126,9 @@ is($oConnection->option('async'), 1, "ZOOM connection is asynchronous"); $silly_preference->delete(); -# AutoEmailOpacUser should be a YesNo pref -C4::Context->set_preference('AutoEmailOpacUser', ''); -my $yesno_pref = Koha::Config::SysPrefs->find('AutoEmailOpacUser'); +# AutoEmailNewUser should be a YesNo pref +C4::Context->set_preference('AutoEmailNewUser', ''); +my $yesno_pref = Koha::Config::SysPrefs->find('AutoEmailNewUser'); is( $yesno_pref->value(), 0, 'set_preference should have set the value to 0, instead of an empty string' ); done_testing(); -- 2.20.1