Bug 37757: Update EmailFieldPrimary value

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Tomás Cohen Arazi 2024-08-28 14:57:18 -03:00 committed by Katrin Fischer
parent 24f84f11a2
commit 79ffb8841b
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
3 changed files with 23 additions and 3 deletions

View file

@ -0,0 +1,20 @@
use Modern::Perl;
use Koha::Installer::Output qw(say_warning say_failure say_success say_info);
return {
bug_number => "37757",
description => "More robust handling of EmailFieldPrimary syspref values",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
$dbh->do(
q{
UPDATE systempreferences
SET value=IF(value='OFF','',value),
options='|email|emailpro|B_email|cardnumber|MULTI'
WHERE variable='EmailFieldPrimary';
}
) == 1 && say_success( $out, "Updated system preference 'EmailFieldPrimary'" );
},
};

View file

@ -234,7 +234,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('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'),
('EmailFieldPrecedence','email|emailpro|B_email','','Ordered list of patron email fields to use when AutoEmailPrimaryAddress is set to first valid','multiple'),
('EmailFieldPrimary','OFF','email|emailpro|B_email|cardnumber|OFF|MULTI','Defines the default email address field where patron email notices are sent.','Choice'),
('EmailFieldPrimary','','|email|emailpro|B_email|cardnumber|MULTI','Defines the default email address field where patron email notices are sent.','Choice'),
('EmailFieldSelection','','email|emailpro|B_email','Selection list of patron email fields to use whern AutoEmailPrimaryAddress is set to selected addresses','multiple'),
('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'),

View file

@ -193,13 +193,13 @@ Patrons:
-
- "Use the patron's"
- pref: EmailFieldPrimary
default: "OFF"
default: ""
choices:
email: primary email
emailpro: secondary email
B_email: alternate email
cardnumber: card number
"OFF": first valid email address
"": first valid email address
"MULTI": selected addresses
- 'for sending out email notices.'
- '<br><strong>NOTE:</strong> If set to "first valid", the order in which the email addresses are checked is set in <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EmailFieldPrecedence">EmailFieldPrecedence</a>.'