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 <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2018-02-05 18:08:03 -03:00
parent 7b51c8e443
commit 6d439a5c58

View file

@ -2524,12 +2524,15 @@ sub GetUpcomingDueIssues {
my $dbh = C4::Context->dbh;
my $statement = <<END_SQL;
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
HAVING days_until_due >= 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'} );