Bug 25875

Summary: Patron displayed multiple times in add user search if they have multiple sub permissions
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Architecture, internals, and plumbingAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: aleisha, jonathan.druart, julian.maurice, lucas, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.02, 19.11.08, 19.05.14
Bug Depends on: 24964    
Bug Blocks:    
Attachments: Bug 25875: Unit test
Bug 25875: Move check for module_bit and code to the JOIN
Bug 25875: Unit test
Bug 25875: Move check for module_bit and code to the JOIN
Bug 25875: Unit test
Bug 25875: Move check for module_bit and code to the JOIN
Bug 25875: Unit test

Description Nick Clemens (kidclamp) 2020-06-25 10:37:35 UTC
To recreate:
1 - Give a patron full acquisitions permissions
2 - Also give them several subpermissions on other areas
3 - Go to Acquisitions
4 - Edit a fund
5 - Add a user to the fund
6 - Search for user above
7 - They return multiple times in results
Comment 1 Nick Clemens (kidclamp) 2020-06-25 10:40:14 UTC
Created attachment 106283 [details] [review]
Bug 25875: Unit test
Comment 2 Nick Clemens (kidclamp) 2020-06-25 10:40:17 UTC
Created attachment 106284 [details] [review]
Bug 25875: Move check for module_bit and code to the JOIN

If we limit the JOIN to rows with the correct subpermission we won't
duplicate the returned patrons

To test:
 1 - Give a patron full acquisitions permissions
 2 - Also give them several subpermissions on other areas
 3 - Go to Acquisitions
 4 - Edit a fund
 5 - Add a user to the fund
 6 - Search for user above
 7 - They return multiple times in results
 8 - Apply patch
 9 - Restart all the things
10 - Repeat search
11 - Patron appears once
Comment 3 Owen Leonard 2020-06-25 11:02:56 UTC
Created attachment 106285 [details] [review]
Bug 25875: Unit test
Comment 4 Owen Leonard 2020-06-25 11:02:59 UTC
Created attachment 106286 [details] [review]
Bug 25875: Move check for module_bit and code to the JOIN

If we limit the JOIN to rows with the correct subpermission we won't
duplicate the returned patrons

To test:
 1 - Give a patron full acquisitions permissions
 2 - Also give them several subpermissions on other areas
 3 - Go to Acquisitions
 4 - Edit a fund
 5 - Add a user to the fund
 6 - Search for user above
 7 - They return multiple times in results
 8 - Apply patch
 9 - Restart all the things
10 - Repeat search
11 - Patron appears once

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Julian Maurice 2020-06-26 13:40:30 UTC
Unit tests pass even without the 2nd patch, can you take a look Nick please ?
Comment 6 Nick Clemens (kidclamp) 2020-06-26 14:51:40 UTC
Created attachment 106341 [details] [review]
Bug 25875: Unit test
Comment 7 Katrin Fischer 2020-06-28 21:42:26 UTC
Created attachment 106363 [details] [review]
Bug 25875: Move check for module_bit and code to the JOIN

If we limit the JOIN to rows with the correct subpermission we won't
duplicate the returned patrons

To test:
 1 - Give a patron full acquisitions permissions
 2 - Also give them several subpermissions on other areas
 3 - Go to Acquisitions
 4 - Edit a fund
 5 - Add a user to the fund
 6 - Search for user above
 7 - They return multiple times in results
 8 - Apply patch
 9 - Restart all the things
10 - Repeat search
11 - Patron appears once

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2020-06-28 21:42:30 UTC
Created attachment 106364 [details] [review]
Bug 25875: Unit test

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Jonathan Druart 2020-06-29 11:50:59 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 10 Lucas Gass 2020-07-13 16:25:29 UTC
backported to 20.05.x for 20.05.02
Comment 11 Aleisha Amohia 2020-07-16 04:38:02 UTC
backported to 19.11.x for 19.11.08
Comment 12 Victor Grousset/tuxayo 2020-07-26 15:49:14 UTC
Backported to 19.05.x branch for 19.05.14