Permalink
Browse files

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
  • Loading branch information...
1 parent 9fadac6 commit a52261837c75f9abf7121360c4cb9870927f86d7 @PaulPoulain PaulPoulain committed with J. David Bavousett Nov 6, 2009
Showing with 4 additions and 4 deletions.
  1. +4 −4 C4/Overdues.pm
View
@@ -123,15 +123,15 @@ 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 = "
SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode
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;

0 comments on commit a522618

Please sign in to comment.