Bug 21635 - Incorrect GROUP BY clause in batchMod.pl
Summary: Incorrect GROUP BY clause in batchMod.pl
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks: 17258 22022
  Show dependency treegraph
 
Reported: 2018-10-23 13:34 UTC by Jonathan Druart
Modified: 2019-01-02 10:43 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 21635: [sql_modes] Remove GROUP BY clause in batchMod.pl (3.00 KB, patch)
2018-10-23 13:37 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21635: [sql_modes] Remove GROUP BY clause in batchMod.pl (3.06 KB, patch)
2018-10-25 13:07 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 21635: [sql_modes] Remove GROUP BY clause in batchMod.pl (3.15 KB, patch)
2018-10-26 09:44 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2018-10-23 13:34:43 UTC
batchMod.pl: DBD::mysql::st execute failed: 'koha_kohadev.authorised_values.authorised_val
ue' isn't in GROUP BY [for Statement "SELECT authorised_value, lib FROM authorised_values LEFT JOIN authorised_values_branches ON ( id = av_id )  WHERE category = ? AND ( branchcode = ? OR branchcode IS NULL )  
GROUP BY lib ORDER BY lib, lib_opac" with ParamValues: 0='WITHDRAWN', 1="CPL"] at /home/vagrant/kohaclone/tools/batchMod.pl line 396.


We must use Koha::AuthorisedValues->search instead of a raw SQL query.
Comment 1 Jonathan Druart 2018-10-23 13:37:21 UTC
Created attachment 81025 [details] [review]
Bug 21635: [sql_modes] Remove GROUP BY clause in batchMod.pl

batchMod.pl: DBD::mysql::st execute failed: 'koha_kohadev.authorised_values.authorised_val
ue' isn't in GROUP BY [for Statement "SELECT authorised_value, lib FROM authorised_values LEFT JOIN authorised_values_branches ON ( id = av_id )  WHERE category = ? AND ( branchcode = ? OR branchcode IS NULL )
GROUP BY lib ORDER BY lib, lib_opac" with ParamValues: 0='WITHDRAWN', 1="CPL"] at /home/vagrant/kohaclone/tools/batchMod.pl line 396.

We must use Koha::AuthorisedValues->search instead of a raw SQL query.

Test plan:
Edit some items in a batch
Confirm that the dropdown list (AV) are correctly filled

We will lose speed efficiency here, but better to be consistent, then cache AV in Koha::AuthorisedValues
Comment 2 Andrew Isherwood 2018-10-25 13:07:50 UTC
Created attachment 81147 [details] [review]
Bug 21635: [sql_modes] Remove GROUP BY clause in batchMod.pl

batchMod.pl: DBD::mysql::st execute failed: 'koha_kohadev.authorised_values.authorised_val
ue' isn't in GROUP BY [for Statement "SELECT authorised_value, lib FROM authorised_values LEFT JOIN authorised_values_branches ON ( id = av_id )  WHERE category = ? AND ( branchcode = ? OR branchcode IS NULL )
GROUP BY lib ORDER BY lib, lib_opac" with ParamValues: 0='WITHDRAWN', 1="CPL"] at /home/vagrant/kohaclone/tools/batchMod.pl line 396.

We must use Koha::AuthorisedValues->search instead of a raw SQL query.

Test plan:
Edit some items in a batch
Confirm that the dropdown list (AV) are correctly filled

We will lose speed efficiency here, but better to be consistent, then cache AV in Koha::AuthorisedValues

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Comment 3 Marcel de Rooy 2018-10-26 09:44:57 UTC
Created attachment 81260 [details] [review]
Bug 21635: [sql_modes] Remove GROUP BY clause in batchMod.pl

batchMod.pl: DBD::mysql::st execute failed: 'koha_kohadev.authorised_values.authorised_val
ue' isn't in GROUP BY [for Statement "SELECT authorised_value, lib FROM authorised_values LEFT JOIN authorised_values_branches ON ( id = av_id )  WHERE category = ? AND ( branchcode = ? OR branchcode IS NULL )
GROUP BY lib ORDER BY lib, lib_opac" with ParamValues: 0='WITHDRAWN', 1="CPL"] at /home/vagrant/kohaclone/tools/batchMod.pl line 396.

We must use Koha::AuthorisedValues->search instead of a raw SQL query.

Test plan:
Edit some items in a batch
Confirm that the dropdown list (AV) are correctly filled

We will lose speed efficiency here, but better to be consistent, then cache AV in Koha::AuthorisedValues

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Nick Clemens 2018-10-26 17:24:17 UTC
Awesome work all!

Pushed to master for 18.11
Comment 5 Martin Renvoize 2018-11-06 11:54:53 UTC
Pushed to 18.05.x for 18.05.06
Comment 6 Fridolin SOMERS 2018-11-28 10:00:09 UTC
I pass for sql modes in 17.11.x