[Koha-bugs] [Bug 21725] Incorrect HAVING in group by in Acquisitions.pm

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Oct 30 16:42:44 CET 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21725

--- Comment #5 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
As I said on bug 21714 I do not recreate the issue. That would be good to
understand why.

The query is (I removed the WHERE clause):
SELECT aqbasket.basketno, aqbasket.basketname, aqbasket.note,
aqbasket.booksellernote, aqbasket.contractnumber, aqbasket.creationdate,
aqbasket.closedate, aqbasket.booksellerid, aqbasket.authorisedby,
aqbasket.booksellerinvoicenumber, aqbasket.basketgroupid,
aqbasket.deliveryplace, aqbasket.billingplace, aqbasket.branch,
aqbasket.is_standing, aqbasket.create_items,           SUM(aqorders.quantity)
AS total_items,           SUM(             IF ( aqorders.orderstatus =
'cancelled', aqorders.quantity, 0 )           ) AS total_items_cancelled,      
    COUNT(DISTINCT aqorders.biblionumber) AS total_biblios,           SUM(     
       IF(aqorders.datereceived IS NULL               AND
(aqorders.datecancellationprinted IS NULL OR
aqorders.datecancellationprinted='0000-00-00')             , aqorders.quantity 
           , 0)           ) AS expected_items         FROM aqbasket          
LEFT JOIN aqorders ON aqorders.basketno = aqbasket.basketno GROUP BY
aqbasket.basketno, aqbasket.basketname, aqbasket.note, aqbasket.booksellernote,
aqbasket.contractnumber, aqbasket.creationdate, aqbasket.closedate,
aqbasket.booksellerid, aqbasket.authorisedby, aqbasket.booksellerinvoicenumber,
aqbasket.basketgroupid, aqbasket.deliveryplace, aqbasket.billingplace,
aqbasket.branch, aqbasket.is_standing, aqbasket.create_items HAVING (closedate
IS NULL OR (expected_items > 0));

Can you confirm it fail for you after having set the modes accordingly?

SET SESSION sql_mode =
'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';


Server version: 10.0.36-MariaDB-0+deb8u1 (Debian)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list