Browse Source

Bug 20076: (RM follow-up) Fix system preference boolean logic

A Yes/No system preference must use 1 for Yes and 0 for No.
So "Send" for 1/Yes and "Don't send" for 0/No.
We add too much problems with double-negation boolean system preferences (such as dontmerge).

Previous patch changed default value to 1 in atomicupdate, do the same
in installer/data/mysql/mandatory/sysprefs.sql

Also to be consistant, sets options = NULL instead of '' in atomicupdate

Also removed useless added empty line in /misc/cronjobs/overdue_notices.pl

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
22.05.x
Fridolin Somers 2 years ago
parent
commit
8a8e105695
  1. 10
      installer/data/mysql/atomicupdate/bug_20076-add_system_preference_EmailOverduesNoEmail.pl
  2. 2
      installer/data/mysql/mandatory/sysprefs.sql
  3. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref
  4. 4
      misc/cronjobs/overdue_notices.pl

10
installer/data/mysql/atomicupdate/add-system-preference-EmailOverduesNoEmail.perl → installer/data/mysql/atomicupdate/bug_20076-add_system_preference_EmailOverduesNoEmail.pl

@ -1,15 +1,15 @@
use Modern::Perl; use Modern::Perl;
{ return {
bug_number => "20076", bug_number => "20076",
description => "Add system preference EmailOverduesNoEmail", description => "Add system preference EmailOverduesNoEmail",
up => sub { up => sub {
my ($args) = @_; my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)}; my ($dbh, $out) = @$args{qw(dbh out)};
$dbh->do(q{ $dbh->do(q{
INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`) INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`)
VALUES ('EmailOverduesNoEmail','1','','Send send overdues of patrons without email address to staff', 'YesNo') VALUES ('EmailOverduesNoEmail','1',NULL,'Send send overdues of patrons without email address to staff', 'YesNo')
}); });
}, },
} }

2
installer/data/mysql/mandatory/sysprefs.sql

@ -193,7 +193,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'), ('ElasticsearchCrossFields', '1', '', 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'),
('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'), ('EmailAddressForSuggestions','','',' If you choose EmailAddressForSuggestions you have to enter a valid email address: ','free'),
('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'), ('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'),
('EmailOverduesNoEmail','0',NULL,'Send send overdues of patrons without email address to staff','YesNo'), ('EmailOverduesNoEmail','1',NULL,'Send send overdues of patrons without email address to staff','YesNo'),
('EmailPurchaseSuggestions','0','0|EmailAddressForSuggestions|BranchEmailAddress|KohaAdminEmailAddress','Choose email address that new purchase suggestions will be sent to: ','Choice'), ('EmailPurchaseSuggestions','0','0|EmailAddressForSuggestions|BranchEmailAddress|KohaAdminEmailAddress','Choose email address that new purchase suggestions will be sent to: ','Choice'),
('EnableAdvancedCatalogingEditor','0','','Enable the Rancor advanced cataloging editor','YesNo'), ('EnableAdvancedCatalogingEditor','0','','Enable the Rancor advanced cataloging editor','YesNo'),
('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'), ('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'),

4
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref

@ -80,8 +80,8 @@ Administration:
- -
- pref: EmailOverduesNoEmail - pref: EmailOverduesNoEmail
choices: choices:
1: "Don't send" 1: "Send"
0: "Send" 0: "Don't send"
- "overdue notices for patrons without email address to staff." - "overdue notices for patrons without email address to staff."
Login options: Login options:

4
misc/cronjobs/overdue_notices.pl

@ -368,7 +368,6 @@ if (@branchcodes) {
my $branch_word = scalar @branches > 1 ? 'branches' : 'branch'; my $branch_word = scalar @branches > 1 ? 'branches' : 'branch';
$verbose and warn "$branch_word @branches have overdue rules\n"; $verbose and warn "$branch_word @branches have overdue rules\n";
} else { } else {
$verbose and warn "No active overduerules for $branchcodes_word '@branchcodes'\n"; $verbose and warn "No active overduerules for $branchcodes_word '@branchcodes'\n";
@ -842,8 +841,7 @@ END_SQL
} }
$content .= join( "\n", @output_chunks ); $content .= join( "\n", @output_chunks );
my $EmailOverduesNoEmail = C4::Context->preference('EmailOverduesNoEmail'); if ( C4::Context->preference('EmailOverduesNoEmail') ) {
if ( $EmailOverduesNoEmail == 0) {
my $attachment = { my $attachment = {
filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt', filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt',
type => 'text/plain', type => 'text/plain',

Loading…
Cancel
Save