Bug 21778

Summary: Sorting is inconsistent on patron search based on permissions
Product: Koha Reporter: Nick Clemens <nick>
Component: PatronsAssignee: Bugs List <koha-bugs>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: major    
Priority: P5 - low CC: fridolin.somers, gmcharlt, josef.moravec, kyle.m.hall, margaret, martin.renvoize
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21923
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 21778: Sort user list by surname,firstname unless user cannot manage patron lists OR edit patrons
Bug 21778: Sort user list by surname,firstname unless user cannot manage patron lists OR edit patrons
Bug 21778: Sort user list by surname,firstname unless user cannot manage patron lists OR edit patrons

Description Nick Clemens 2018-11-07 01:32:00 UTC
When searching for patrons the results are sorted by surname, firstname if 
CAN_user_tools_manage_patron_lists

otherwise they are sorted by cardnumber

This seems to be a confusion in the template - the checkbox column is only hidden if the user cannot edit patrons or add them to a list, however, the sorting assumes it is hidden if they cannot add patrons to a list
Comment 1 Nick Clemens 2018-11-07 01:36:27 UTC
Created attachment 82015 [details] [review]
Bug 21778: Sort user list by surname,firstname unless user cannot manage patron lists OR edit patrons

To test:
1 - Create four users:
    1 superlibrarian (or with both edit patrons and manage patron
            lists)
    1 with only edit patrons and catalogue
    1 with only add to list and catalogue
    1 with catalogue but neither edit patrons or manage patron lists
2 - Search patrons signed in as each user
3 - Note different sorting
4 - Apply patch
5 - Try searching with each patron
6 - Results should always be sorted by surname, firstname
7 - Only in the case of neither extra permission should the checkboxes
be absent
Comment 2 Devinim 2018-11-30 08:55:19 UTC
Created attachment 82768 [details] [review]
Bug 21778: Sort user list by surname,firstname unless user cannot manage patron lists OR edit patrons

To test:
1 - Create four users:
    1 superlibrarian (or with both edit patrons and manage patron
            lists)
    1 with only edit patrons and catalogue
    1 with only add to list and catalogue
    1 with catalogue but neither edit patrons or manage patron lists
2 - Search patrons signed in as each user
3 - Note different sorting
4 - Apply patch
5 - Try searching with each patron
6 - Results should always be sorted by surname, firstname
7 - Only in the case of neither extra permission should the checkboxes
be absent

It worked as described.

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Comment 3 Josef Moravec 2018-12-03 20:25:34 UTC
Nick,

if we want the sorting to be always consistant, why not to even remove the whole condition?
Comment 4 Nick Clemens 2018-12-03 20:29:51 UTC
if they have neither of those permissions there won't be the extra column, we will sort by the first column so we need the test to know if we wort on index 1 or 2


if we can name the column using class or something for sort instead of using the index that could avoid the conditions
Comment 5 Josef Moravec 2018-12-05 16:21:35 UTC
Created attachment 82876 [details] [review]
Bug 21778: Sort user list by surname,firstname unless user cannot manage patron lists OR edit patrons

To test:
1 - Create four users:
    1 superlibrarian (or with both edit patrons and manage patron
            lists)
    1 with only edit patrons and catalogue
    1 with only add to list and catalogue
    1 with catalogue but neither edit patrons or manage patron lists
2 - Search patrons signed in as each user
3 - Note different sorting
4 - Apply patch
5 - Try searching with each patron
6 - Results should always be sorted by surname, firstname
7 - Only in the case of neither extra permission should the checkboxes
be absent

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 6 Nick Clemens 2018-12-11 20:56:40 UTC
Awesome work all!

Pushed to master for 19.05
Comment 7 Martin Renvoize 2018-12-12 10:42:48 UTC
Pushed to 18.11.x for 18.11.01
Comment 8 Fridolin Somers 2019-01-02 09:35:24 UTC
Pushed to 18.05.x for 18.05.08
Comment 9 Fridolin Somers 2019-02-25 06:56:05 UTC
Pushed to 17.11.x for 17.11.14