From d5623c9c1c50f12b8b6aa495e6b0aad2ca5dd7ae Mon Sep 17 00:00:00 2001 From: Stefan Berndtsson Date: Thu, 23 Feb 2017 13:07:18 +0100 Subject: [PATCH] Option for disabling advance notice when auto_renew is set on item that is due soon https://bugs.koha-community.org/show_bug.cgi?id=18161 --- .../bug_18161-no-advance-notices-when-auto-renew-syspref.sql | 1 + .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ misc/cronjobs/advance_notices.pl | 1 + 3 files changed, 8 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_18161-no-advance-notices-when-auto-renew-syspref.sql diff --git a/installer/data/mysql/atomicupdate/bug_18161-no-advance-notices-when-auto-renew-syspref.sql b/installer/data/mysql/atomicupdate/bug_18161-no-advance-notices-when-auto-renew-syspref.sql new file mode 100644 index 0000000..df72f99 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_18161-no-advance-notices-when-auto-renew-syspref.sql @@ -0,0 +1 @@ +INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('NoAdvanceNoticeWhenAutoRenewal', '0', '', 'Disable advance notices when auto renew was used', 'YesNo'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index dfbcd8d..e857370 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -260,6 +260,12 @@ Circulation: Calendar: the calendar to skip all days the library is closed. Datedue: the calendar to push the due date to the next open day - + - pref: NoAdvanceNoticeWhenAutoRenewal + choices: + yes: Do not send + no: Send + - advance notice when loan was automatically renewable when issued. + - - Calculate "No renewal before" based on - pref: NoRenewalBeforePrecision choices: diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl index 855492e..7f1cd3e 100755 --- a/misc/cronjobs/advance_notices.pl +++ b/misc/cronjobs/advance_notices.pl @@ -278,6 +278,7 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { message_name => 'advance_notice' } ); next UPCOMINGITEM unless $borrower_preferences && exists $borrower_preferences->{'days_in_advance'}; next UPCOMINGITEM unless $borrower_preferences->{'days_in_advance'} == $upcoming->{'days_until_due'}; + next UPCOMINGITEM if C4::Context->preference('NoAdvanceNoticeWhenAutoRenewal') && $upcoming->{'auto_renew'}; if ( $borrower_preferences->{'wants_digest'} ) { # cache this one to process after we've run through all of the items. -- 2.7.4