From 101ce893747cf3f9da5fdce40c071513a125e220 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 13 Mar 2023 14:05:51 +0000 Subject: [PATCH] Bug 33192: Update all occurrences of AutoEmailPrimaryAddress This patch updates all references to AutoEmailPrimaryAddress to refer to EmailFieldPrimary instead. Signed-off-by: Caroline Cyr La Rose Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- C4/UsageStats.pm | 2 +- Koha/Patron.pm | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/patrons.pref | 2 +- opac/opac-registration-verify.pl | 2 +- t/Auth_with_shibboleth.t | 2 +- t/db_dependent/Koha/Patrons.t | 10 +++++----- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 7cf2098f49..e638f15490 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -326,7 +326,7 @@ sub _shared_preferences { PatronSelfRegistration OPACShelfBrowser AutoEmailNewUser - AutoEmailPrimaryAddress + EmailFieldPrimary autoMemberNum BorrowerRenewalPeriodBase EnableBorrowerFiles diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 9a532af2f6..dae2d9fd21 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1400,7 +1400,7 @@ Returns the empty string if no email address. sub notice_email_address{ my ( $self ) = @_; - my $which_address = C4::Context->preference("AutoEmailPrimaryAddress"); + my $which_address = C4::Context->preference("EmailFieldPrimary"); # if syspref is set to 'first valid' (value == OFF), look up email address if ( $which_address eq 'OFF' ) { return $self->first_valid_email_address; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index ab53e04b0c..e899c44ba5 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -209,9 +209,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL), ('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'), ('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'), -('EmailFieldPrimary','OFF','email|emailpro|B_email|cardnumber|OFF','Defines the default email address field where patron email notices are sent.','Choice'), ('EmailAddressForPatronRegistrations', '', '', ' If you choose EmailAddressForPatronRegistrations you have to enter a valid email address: ', 'free'), ('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'), +('EmailFieldPrimary','OFF','email|emailpro|B_email|cardnumber|OFF','Defines the default email address field where patron email notices are sent.','Choice'), ('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'), ('EmailOverduesNoEmail','1',NULL,'Send send overdues of patrons without email address to staff','YesNo'), ('EmailPatronRegistrations', '0', '0|EmailAddressForPatronRegistrations|BranchEmailAddress|KohaAdminEmailAddress', 'Choose email address that new patron registrations will be sent to: ', 'Choice'), 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 b0638195a8..2380260d75 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 @@ -174,7 +174,7 @@ Patrons: - email receipts to patrons for payments and writeoffs. - - "Use" - - pref: AutoEmailPrimaryAddress + - pref: EmailFieldPrimary default: "OFF" choices: email: home diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl index 4af265c110..5cb30239da 100755 --- a/opac/opac-registration-verify.pl +++ b/opac/opac-registration-verify.pl @@ -95,7 +95,7 @@ if ( # 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 + # Look up correct email address taking EmailFieldPrimary into account my $emailaddr = $patron->notice_email_address; # if we manage to find a valid email address, send notice if ($emailaddr) { diff --git a/t/Auth_with_shibboleth.t b/t/Auth_with_shibboleth.t index 2d8958d3bf..121df22869 100755 --- a/t/Auth_with_shibboleth.t +++ b/t/Auth_with_shibboleth.t @@ -419,7 +419,7 @@ sub mockedPref { $return = $staffClientBaseURL; } - if ( $param eq 'AutoEmailPrimaryAddress' ) { + if ( $param eq 'EmailFieldPrimary' ) { $return = 'OFF'; } diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index afb0dcb461..187b18c379 100755 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -1066,11 +1066,11 @@ subtest 'notice_email_address' => sub { my $patron = $builder->build_object({ class => 'Koha::Patrons' }); - t::lib::Mocks::mock_preference( 'AutoEmailPrimaryAddress', 'OFF' ); - is ($patron->notice_email_address, $patron->email, "Koha::Patron->notice_email_address returns correct value when AutoEmailPrimaryAddress is off"); + t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'OFF' ); + is ($patron->notice_email_address, $patron->email, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is off"); - t::lib::Mocks::mock_preference( 'AutoEmailPrimaryAddress', 'emailpro' ); - is ($patron->notice_email_address, $patron->emailpro, "Koha::Patron->notice_email_address returns correct value when AutoEmailPrimaryAddress is emailpro"); + t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'emailpro' ); + is ($patron->notice_email_address, $patron->emailpro, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is emailpro"); $patron->delete; }; @@ -2176,7 +2176,7 @@ subtest 'queue_notice' => sub { plan tests => 11; my $dbh = C4::Context->dbh; - t::lib::Mocks::mock_preference( 'AutoEmailPrimaryAddress', 'email' ); + t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'email' ); my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); my $branch = $builder->build_object( { class => 'Koha::Libraries' } ); my $letter_e = $builder->build_object( { -- 2.39.5