From 39b0b5909cb0bc271b85723eb32d02146649b3be Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 6 Feb 2018 12:02:47 -0300 Subject: [PATCH] Bug 20144: [sql_modes] Fix GROUP BY clause in GetInvoices Need to be tested from the interface! Fix for: 'koha_kohadev.aqinvoices.invoicenumber' isn't in GROUP BY Signed-off-by: Josef Moravec Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart --- C4/Acquisition.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 1973ab90e5..202ed7e7a3 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2518,7 +2518,8 @@ sub GetInvoices { my $dbh = C4::Context->dbh; my $query = qq{ - SELECT aqinvoices.*, aqbooksellers.name AS suppliername, + SELECT aqinvoices.invoiceid, aqinvoices.invoicenumber, aqinvoices.booksellerid, aqinvoices.shipmentdate, aqinvoices.billingdate, aqinvoices.closedate, aqinvoices.shipmentcost, aqinvoices.shipmentcost_budgetid, aqinvoices.message_id, + aqbooksellers.name AS suppliername, COUNT( DISTINCT IF( aqorders.datereceived IS NOT NULL, @@ -2604,7 +2605,7 @@ sub GetInvoices { } $query .= " WHERE " . join(" AND ", @bind_strs) if @bind_strs; - $query .= " GROUP BY aqinvoices.invoiceid "; + $query .= " GROUP BY aqinvoices.invoiceid, aqinvoices.invoicenumber, aqinvoices.booksellerid, aqinvoices.shipmentdate, aqinvoices.billingdate, aqinvoices.closedate, aqinvoices.shipmentcost, aqinvoices.shipmentcost_budgetid, aqinvoices.message_id, aqbooksellers.name"; if($args{order_by}) { my ($column, $direction) = split / /, $args{order_by}; -- 2.39.5