From 638dfd30e5469473fd3adf320f7b42fdeb1ab75b Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Fri, 6 Nov 2009 15:16:07 +0100 Subject: [PATCH] fixing overdue checking (today is not late) NOW() returns minuts and seconds. date_due is just YYYY-MM-DD Thus date_due < now() is wrong if date_due is today, and the patron is considered as late. With curdate(), the patron is late only the day after the overdue limit --- C4/Overdues.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index 8f40e8bdb6..04520b255d 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -123,7 +123,7 @@ sub Getoverdues { SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode FROM issues LEFT JOIN items USING (itemnumber) - WHERE date_due < now() + WHERE date_due < CURDATE() "; } else { $statement = " @@ -131,7 +131,7 @@ LEFT JOIN items USING (itemnumber) FROM issues LEFT JOIN items USING (itemnumber) LEFT JOIN biblioitems USING (biblioitemnumber) - WHERE date_due < now() + WHERE date_due < CURDATE() "; } @@ -169,7 +169,7 @@ sub checkoverdues { LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber WHERE issues.borrowernumber = ? - AND issues.date_due < NOW()" + AND issues.date_due < CURDATE()" ); # FIXME: SELECT * across 4 tables? do we really need the marc AND marcxml blobs?? $sth->execute($borrowernumber); @@ -1201,7 +1201,7 @@ sub GetOverduesForBranch { WHERE (accountlines.amountoutstanding != '0.000000') AND (accountlines.accounttype = 'FU' ) AND (issues.branchcode = ? ) - AND (issues.date_due <= NOW()) + AND (issues.date_due < CURDATE()) "; my @getoverdues; my $i = 0; -- 2.39.5