Bug 21907 - Error from mainpage when Article requests enabled and either IndependentBranches or IndependentBranchesPatronModifications is enabled
Summary: Error from mainpage when Article requests enabled and either IndependentBranc...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 18403
Blocks:
  Show dependency treegraph
 
Reported: 2018-11-28 20:34 UTC by Nick Clemens (kidclamp)
Modified: 2020-01-06 20:14 UTC (History)
4 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:
Circulation function:


Attachments
Bug 21907: Fix article requests count for non-superlibrarians (1.03 KB, patch)
2018-12-11 13:14 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21907: Fix article requests count for non-superlibrarians (1.09 KB, patch)
2019-01-11 14:29 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 21907: Fix article requests count for non-superlibrarians (1.14 KB, patch)
2019-02-03 11:18 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2018-11-28 20:34:59 UTC
DBD::mysql::st execute failed: Column 'branchcode' in where clause is ambiguous [for Statement "SELECT COUNT( * ) FROM `article_requests` `me`  JOIN `borrowers` `borrowernumber` ON `borrowernumber`.`borrowernumber` = `me`.`borrowernumber` WHERE ( ( `branchcode` = ? AND `status` = ? ) )" with ParamValues: 0="LIBRARY", 1='PENDING'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
No method count found for Koha::ArticleRequests DBIx::Class::Storage::DBI::_dbh_execute(): Column 'branchcode' in where clause is ambiguous at /usr/share/koha/lib/Koha/Objects.pm line 395
 at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 71.

To recreate:
1 - Enable 'IndependentBranchesPatronModifications' and article requests
2 - Sign in as non-superlibrarian
3 - View plack log
4 - Refresh mainpage, see error in logs
Comment 1 Jonathan Druart 2018-12-11 13:12:12 UTC
Caused by
  commit 710175fbe6721583028083d498f1df4a44bb1784
  Bug 18403: Article requests
Comment 2 Jonathan Druart 2018-12-11 13:14:58 UTC
Created attachment 83037 [details] [review]
Bug 21907: Fix article requests count for non-superlibrarians

The query generates "Column 'branchcode' in where clause is ambiguous"

Test plan:
1 - Enable 'IndependentBranchesPatronModifications' and article requests
2 - Sign in as non-superlibrarian
3 - View plack log
4 - Refresh mainpage, see error in logs
Comment 3 Nick Clemens (kidclamp) 2019-01-11 14:29:17 UTC
Created attachment 83794 [details] [review]
Bug 21907: Fix article requests count for non-superlibrarians

The query generates "Column 'branchcode' in where clause is ambiguous"

Test plan:
1 - Enable 'IndependentBranchesPatronModifications' and article requests
2 - Sign in as non-superlibrarian
3 - View plack log
4 - Refresh mainpage, see error in logs

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Katrin Fischer 2019-02-03 10:54:25 UTC
I am not even sure if the current behaviour is correct: When requesting an article the pick-up branch is selected and it seems only libraries from the pick-up branch see the request... so the fact where the item actually is is not taken into account at all and libraries who might be able to fill the request are not notified?
Comment 5 Katrin Fischer 2019-02-03 11:17:23 UTC
My confusion was related to bug 22265. PQA.
Comment 6 Katrin Fischer 2019-02-03 11:18:37 UTC
Created attachment 84681 [details] [review]
Bug 21907: Fix article requests count for non-superlibrarians

The query generates "Column 'branchcode' in where clause is ambiguous"

Test plan:
1 - Enable 'IndependentBranchesPatronModifications' and article requests
2 - Sign in as non-superlibrarian
3 - View plack log
4 - Refresh mainpage, see error in logs

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Nick Clemens (kidclamp) 2019-02-04 17:46:04 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize (ashimema) 2019-02-11 13:42:47 UTC
Pushed to 18.11.x for 18.11.03
Comment 9 Lucas Gass (lukeg) 2019-02-12 21:05:09 UTC
backported to 18.05.x for 18.05.09
Comment 10 Fridolin Somers 2019-02-15 06:47:40 UTC
Depends on Bug 18403 not in 17.11.x