Bug 33238: Fix bad suggestions query (Bug 29886 follow-up)
authorJanusz Kaczmarek <januszop@gmail.com>
Wed, 15 Mar 2023 19:25:53 +0000 (20:25 +0100)
committerArthur Suzuki <arthur.suzuki@biblibre.com>
Tue, 23 May 2023 18:43:31 +0000 (20:43 +0200)
commite7b02117503195ba806bc38a9b2f12a5c738c949
tree08c1915bd727f466d9c2e1815f817a5570a997eb
parent714ab3636fc6e48b85d1ee3b269b6bfc5918b632
Bug 33238: Fix bad suggestions query (Bug 29886 follow-up)

With IndependentBranches Koha explodes with Error 500 when a non
superlibrarian tries to add to basket from suggestions.  In errorlog you
would find "DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception:
DBD::mysql::st execute failed: Column 'branchcode' in where clause is
ambiguous".

Test plan:
==========
1. Have a Koha instance with IndependentBranches, some accepted
   suggestions, and a vendor defined.
2. Be a non superlibrarian librarian with permissions to
   manage acquisitions.
3. Create a new basket and try to add an item to the basket
   "From a suggestion".
4. Koha would generate error 500.
5. Apply the patch.
6. Try to add an item to the basket "From a suggestion".
7. You should succeed.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 68b2f29d483290d5dfd859dce9b9fe7a387f3ab1)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
(cherry picked from commit d4fb68703098f25bd587a8fdfc6cd5b4d884c4f9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f849dd313cde6dfdd03aba5652fb9429f093c901)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Koha/Suggestions.pm