From e343e4539fbefa2496d46ac2735f6980a77660ed Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 5 Feb 2018 18:08:03 -0300 Subject: [PATCH] Bug 20144: [sql_modes] Remove HAVING clause in GetUpcomingDueIssues More attention needed here! Fix for: Non-grouping field 'days_until_due' is used in HAVING clause t/db_dependent/Circulation.t Signed-off-by: Josef Moravec Signed-off-by: Julian Maurice --- C4/Circulation.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2b7722c429..75215db2e2 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2553,12 +2553,15 @@ sub GetUpcomingDueIssues { my $dbh = C4::Context->dbh; my $statement = <= 0 AND days_until_due <= ? +SELECT * +FROM ( + 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 +) tmp +WHERE days_until_due >= 0 AND days_until_due <= ? END_SQL my @bind_parameters = ( $params->{'days_in_advance'} ); -- 2.14.2