Bug 22082: ambiguous column in patron stats
authorFridolin Somers <fridolin.somers@biblibre.com>
Tue, 8 Jan 2019 13:32:19 +0000 (14:32 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 30 Jan 2019 08:47:54 +0000 (09:47 +0100)
commitd504715ea7db808ed2adc5c75f7fd0488715487d
treec3bc1a86cba49951f2829e1607c52496d05b891f
parent35e696ec85a5fd66cc9872a426154ed70781c4d7
Bug 22082: ambiguous column in patron stats

In Reports > Patrons statistics, the combination of activity and extended attributes generates an invalid SQL query with error :
ERROR 1052 (23000): Column 'borrowernumber' in IN/ALL/ANY subquery is ambiguous

This is because FROM contains tables borrowers and borrower_attributes both containing borrowernumber column.

Test plan :
1) Be sure to have a patron extended attribute
2) Be sure you have some recent circulation activity
3) Go to Reports > Patrons statistics
4) Select 'active' in 'Patron activity' and 1 years of activity
5) Check 'Row' in 'Patron category'
6) Check 'Columns' in a extended attribute
7) Submit
8) Without patch you have no results, with patch you have exepected results

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8d2324e6de6f639904d188cd432e14add4874779)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit bccbb54491d3722411cee786000959abade33aa7)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit cf3df9058af418d70b02085f8bf724989567cee1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
reports/borrowers_stats.pl