Bug 24030: Fix GetItemsForInventory under MySQL 8
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 13 Nov 2019 10:09:37 +0000 (11:09 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 13 Nov 2019 13:25:28 +0000 (13:25 +0000)
commitdfb33b7f87f905e044bb6c23bccead0551c1190f
tree9e8a2f83ae1eae5bbf291af8678c868ad0fe7ca0
parent7aa84d28e5aad61126242afe31142d3f3c946337
Bug 24030: Fix GetItemsForInventory under MySQL 8

t/db_dependent/Items/GetItemsForInventory.t .. 1/9 DBD::mysql::st execute failed: Expression #1 of ORDER BY clause is not in SELECT list, references column 'koha_kohadev.items.cn_sort' which is not in SELECT list; this is incompatible with DISTINCT [for Statement "
        SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber

        FROM items
        LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber
        LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber
     ORDER BY items.cn_sort, itemcallnumber, title"] at /kohadevbox/koha/C4/Items.pm line 838.

We simply follow what the error says, and add items.cn_sort to the SELECT list

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/Items.pm