Bug 20144: [sql_modes] Fix GROUP BY clause in GetBasketsInfosByBookseller
This need to be tested from the interface! Fix for: 'koha_kohadev.aqbasket.basketname' isn't in GROUP BY t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t We need this group by. We should not need to list all fields, from mysql 5.7 doc: https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html "The query is valid if name is a primary key of t or is a unique NOT NULL column. In such cases, MySQL recognizes that the selected column is functionally dependent on a grouping column. " However, MariaDB did not implemented yet: https://jira.mariadb.org/browse/MDEV-11588 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:
parent
406a480a78
commit
2e35da4f6b
|
|
@ -692,7 +692,7 @@ sub GetBasketsInfosByBookseller {
|
|||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = q{
|
||||
SELECT aqbasket.*,
|
||||
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 )
|
||||
|
|
@ -711,7 +711,7 @@ sub GetBasketsInfosByBookseller {
|
|||
unless ( $allbaskets ) {
|
||||
$query.=" AND (closedate IS NULL OR (aqorders.quantity > aqorders.quantityreceived AND datecancellationprinted IS NULL))";
|
||||
}
|
||||
$query.=" GROUP BY aqbasket.basketno";
|
||||
$query.=" 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";
|
||||
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute($supplierid);
|
||||
|
|
|
|||
Loading…
Reference in New Issue