Bug 21241: (follow-up) Made SQL change idempotent

Also added the new pref to sysprefs.sql

Also simplified the conditional statement.

Sponsored-By: Brimbank Library, Australia

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Alex Buckley 2018-12-24 21:38:24 +00:00 committed by Nick Clemens
parent a4b38a18b3
commit 89d4b5ea58
3 changed files with 3 additions and 5 deletions

View File

@ -504,10 +504,7 @@ sub ModSuggestion {
my $full_suggestion = GetSuggestion( $suggestion->{suggestionid} );
my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} );
my $transport = 'email';
if (C4::Context->preference("FallbackToSMSIfNoEmail")) {
$transport = ($patron->smsalertnumber) && (!$patron->email) ? 'sms' : 'email';
}
my $transport = (C4::Context->preference("FallbackToSMSIfNoEmail")) && ($patron->smsalertnumber) && (!$patron->email) ? 'sms' : 'email';
if (
my $letter = C4::Letters::GetPreparedLetter(

View File

@ -1 +1 @@
INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('FallbackToSMSIfNoEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo');
INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('FallbackToSMSIfNoEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo');

View File

@ -175,6 +175,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'),
('FacetMaxCount','20',NULL,'Specify the max facet count for each category','Integer'),
('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'),
('FallbackToSMSIfNoEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo'),
('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is charged','YesNo'),
('FilterBeforeOverdueReport','0','','Do not run overdue report until filter selected','YesNo'),
('FineNotifyAtCheckin','0',NULL,'If ON notify librarians of overdue fines on the items they are checking in.','YesNo'),