http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9362 Bug ID: 9362 Summary: Wrong query in GetUpcomingDueIssues (Circulation.pm) Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: minor Priority: P5 - low Component: Circulation Assignee: adrien.saurat@biblibre.com Reporter: adrien.saurat@biblibre.com CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com C4:Circulation:GetUpcomingDueIssues is used in the advance_notices.pl script. This script waits for a "maxdays" parameter, which is used in the following request. We have in GetUpcomingDueIssues the following query: SELECT issues.*, items.itype as itemtype, items.homebranch, TO_DAYS( date_due )-TO_DAYS( NOW() ) as days_until_due, branches.branchemail FROM issues LEFT JOIN items USING (itemnumber) LEFT OUTER JOIN branches USING (branchcode) WhERE returndate is NULL AND ( TO_DAYS( NOW() )-TO_DAYS( date_due ) ) < ? Shouldn't the last line be replaced by "AND TO_DAYS( date_due )-TO_DAYS( NOW() ) < ?" like what we see in the select clause? The date_due is supposed to be "bigger" (farther) than the NOW date. -- Also, this request gives the upcoming due issues, but also the overdues. Is it supposed to be so? If not, the last line should in fact be: AND ( TO_DAYS( NOW() )-TO_DAYS( date_due ) ) BETWEEN 0 AND ? -- I'm not sure about the last point, so for now I'll make a patch including only the first change. -- You are receiving this mail because: You are watching all bug changes.