From 4114495d05a98237d1454845d7851e52178924fb Mon Sep 17 00:00:00 2001 From: Rafal Kopaczka Date: Tue, 7 Oct 2014 14:43:36 +0200 Subject: [PATCH] Bug 13035: Overdue notices send notices for due date in future. Overdue notices, script uses method days_between which returns always positive value of days, no mater if due_date is higher or lower from date_to_run. This causes overdue notices to be send for real overdue and for checkouts with due date in future, which have same days_between as in notice triggers. To reproduce: 1. Set up overdue notice triggers for eg. 2 day. 2. Checkout items for 2 borrowers first gets item with due date 2 days in past and second gets 2 days in future. 3. run ./misc/cronjobs/overdue_notices.pl -n -t 4. watch that notices was generated for both of them. To test: 1. Repeat steps 1,2 2. Apply patch 3. run ./misc/cronjobs/overdue_notices.pl -n -t 4. should be 1 notice for borrower with overdue item. Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer Passes tests and QA script, just adds an additional test. Signed-off-by: Tomas Cohen Arazi --- misc/cronjobs/overdue_notices.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 942cb6a6ea..51ce0722a3 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -510,6 +510,8 @@ END_SQL my $borrowernumber; while ( my $data = $sth->fetchrow_hashref ) { + next unless ( DateTime->compare( $date_to_run, dt_from_string($data->{date_due})) ) == 1; + # check the borrower has at least one item that matches my $days_between; if ( C4::Context->preference('OverdueNoticeCalendar') ) -- 2.39.5