Bug 33238 - Error adding suggestion to basket as non-superlibrarian (Bug 29886 follow-up)
Summary: Error adding suggestion to basket as non-superlibrarian (Bug 29886 follow-up)
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: 22.11
Hardware: All All
: P5 - low normal (vote)
Assignee: Janusz Kaczmarek
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-15 19:13 UTC by Janusz Kaczmarek
Modified: 2023-12-28 20:44 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.05,22.05.13,21.11.21


Attachments
Bug 33238 (Bug 29886 follow-up) With IndependentBranches Koha explodes with Error 500 when a non superlibrarian tries to add to basket from suggestions (1.61 KB, patch)
2023-03-15 19:29 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 33238 (Bug 29886 follow-up) With IndependentBranches Koha explodes with Error 500 when a non superlibrarian tries to add to basket from suggestions (1.62 KB, patch)
2023-04-16 11:11 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 33238: Fix bad suggestions query (Bug 29886 follow-up) (1.58 KB, patch)
2023-04-17 12:39 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz Kaczmarek 2023-03-15 19:13:30 UTC
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".

This is apparently due to missing 'me.' in Koha::Suggestions::search_limited.
Comment 1 Janusz Kaczmarek 2023-03-15 19:29:51 UTC
Created attachment 148245 [details] [review]
Bug 33238 (Bug 29886 follow-up) With IndependentBranches Koha explodes with Error 500 when a non superlibrarian tries to add to basket from suggestions

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.
Comment 2 Katrin Fischer 2023-04-16 11:11:00 UTC
Created attachment 149726 [details] [review]
Bug 33238 (Bug 29886 follow-up) With IndependentBranches Koha explodes with Error 500 when a non superlibrarian tries to add to basket from suggestions

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>
Comment 3 Katrin Fischer 2023-04-16 11:11:30 UTC
Using QAM privilege to put this straight to PQA.
Comment 4 Tomás Cohen Arazi 2023-04-17 12:38:36 UTC
QA script is not happy with this one.
Comment 5 Tomás Cohen Arazi 2023-04-17 12:39:16 UTC
Created attachment 149751 [details] [review]
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>
Comment 6 Tomás Cohen Arazi 2023-04-17 12:42:24 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 7 Katrin Fischer 2023-04-17 12:43:02 UTC
oh, what was it?
Comment 8 Matt Blenkinsop 2023-04-18 12:25:17 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 9 Lucas Gass 2023-05-05 22:30:06 UTC
Backported to 22.05.x for upcoming 22.05.13
Comment 10 Arthur Suzuki 2023-05-23 12:25:29 UTC
applied to 21.11 for 21.11.21