[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-06-29 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Jonathan Druart  changed:

   What|Removed |Added

 Blocks||25875


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25875
[Bug 25875] Patron displayed multiple times in add user search if they have
multiple sub permissions
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-05-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Lucas Gass  changed:

   What|Removed |Added

 Status|Pushed to stable|Pushed to oldstable
 Version(s)|20.05.00,19.11.06   |20.05.00,19.11.06,19.05.11
released in||
 CC||lu...@bywatersolutions.com

--- Comment #29 from Lucas Gass  ---
Rebase for 19.11 also applies clean to 19.05. Backported to 19.05.x for
19.05.11

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-29 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Joy Nelson  changed:

   What|Removed |Added

 Status|Pushed to master|Pushed to stable
 Version(s)|20.05.00|20.05.00,19.11.06
released in||

--- Comment #28 from Joy Nelson  ---
Thanks for the backport!  Applied and tested it works on 19.11.x

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #27 from Jonathan Druart  
---
(In reply to Joy Nelson from comment #17)
> does not apply to 19.11.x branch.  not backported
> please rebase if needed.

Patches rebased for 19.11.x. Please give them a try before pushing them.
Let me know if you have any questions!

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #26 from Jonathan Druart  
---
Created attachment 102461
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102461=edit
Bug 24964: [19.11.x] Do not fetch all patrons for owner/users of funds

admin/add_user_search.pl sets 'patrons_with_acq_perm_only', to only
retrieve patrons with acq (order_manage) permissions.

The original bug was hidden in the existing code, but the behavior was
terrible.
To prevent patrons matching the permissions contrainst to be hidden, we
fetched ALL the patrons from the DB, then filtered them depending on
their permissions. This might have awful performance on DB with lot of
patrons.

So basically with this patch we are adding the pagination back to the
"owner/users for funds" feature, as the permission filtering is now done
at DB level.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #24 from Jonathan Druart  
---
Created attachment 102459
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102459=edit
Bug 24964: [19.11.x] Prevent random failures sorting by borrowernumber

Signed-off-by: Fridolin Somers 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #25 from Jonathan Druart  
---
Created attachment 102460
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102460=edit
Bug 24964: [19.11.x] Fix perl critic warning

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #23 from Jonathan Druart  
---
Created attachment 102458
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102458=edit
Bug 24964: [19.11.x] Do not filter patrons after they have been fetched

The svc/members/search script is called in different places.
In some places (Set owner for a fund, add users to a fund, or set a
manager to a suggestion), we need patrons to be filtered depending on
the permissions they have.
For instance you can only set a fund's owner with a patron that has
acquisition.order_manage.

Currently we have fetching X (default 20) patrons, then filter them
depending on their permission.
Says you have 3 patrons that have the correct permissions but are not in
the 20 first patrons, if you do not define a search term, the search
result will be empty.

This is not ideal and we should filter when requesting the DB.

Test plan:
- Have more than 20 patrons, remove them their permissions
- Create 3 more:
1 superlibrarian
1 with the full acq permission
1 with acquisition.order_manage
- Create a fund and set a owner
- Search for patrons, without specifying a search term (to get them all)
=> Without this patch the new patrons you created are not displayed
=> With this patch they are!

Same test plan apply to set a manager to a suggestion (freshly pushed,
see bug 23590), with suggestions and suggestions.suggestions_manage

Note: The code has been written that way to rely on
C4::Auth::haspermission, but the SQL query is quite trivial and the gain
is important.

Signed-off-by: Fridolin Somers 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #22 from Jonathan Druart  
---
Created attachment 102457
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102457=edit
Bug 24964: [19.11.x] Add tests

Signed-off-by: Fridolin Somers 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #21 from Martin Renvoize  ---
Nice work everyone!

Pushed to master for 20.05

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Jonathan Druart  changed:

   What|Removed |Added

 Attachment #102434|0   |1
is obsolete||

--- Comment #20 from Jonathan Druart  
---
Created attachment 102435
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102435=edit
Bug 24964: Do not fetch all patrons for owner/users of funds

admin/add_user_search.pl sets 'patrons_with_acq_perm_only', to only
retrieve patrons with acq (order_manage) permissions.

The original bug was hidden in the existing code, but the behavior was
terrible.
To prevent patrons matching the permissions contrainst to be hidden, we
fetched ALL the patrons from the DB, then filtered them depending on
their permissions. This might have awful performance on DB with lot of
patrons.

So basically with this patch we are adding the pagination back to the
"owner/users for funds" feature, as the permission filtering is now done
at DB level.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #19 from Jonathan Druart  
---
(In reply to Joy Nelson from comment #17)
> does not apply to 19.11.x branch.  not backported
> please rebase if needed.

I found something when rebasing this for 19.11. I will wait for the last
follow-up to be pushed to master before submitting the rebased patches.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #18 from Jonathan Druart  
---
Created attachment 102434
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102434=edit
Bug 24964: Do not fetch all patrons for owner/users of funds

admin/add_user_search.pl sets 'patrons_with_acq_perm_only', to only
retrieve patrons with acq (order_manage) permissions.

The original bug was hidden in the existing code, but the behavior was
terrible.
To prevent patrons matching the permissions contrainst to be hidden, we
fetched ALL the patrons from the DB, then filtered them depending on
their permissions. This might have awful performance on DB with lot of
patrons.

So basically with this patch we are adding the pagination back to the
"owner/users for funds" feature, as the permission filtering is now done
at DB level.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-04-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Joy Nelson  changed:

   What|Removed |Added

 CC||j...@bywatersolutions.com

--- Comment #17 from Joy Nelson  ---
does not apply to 19.11.x branch.  not backported
please rebase if needed.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Martin Renvoize  changed:

   What|Removed |Added

 Status|Passed QA   |Pushed to master
 Version(s)||20.05.00
released in||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #16 from Martin Renvoize  ---
Nice work everyone!

Pushed to master for 20.05

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #15 from Kyle M Hall  ---
Created attachment 101823
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101823=edit
Bug 24964: Fix perl critic warning

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #13 from Kyle M Hall  ---
Created attachment 101821
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101821=edit
Bug 24964: Do not filter patrons after they have been fetched

The svc/members/search script is called in different places.
In some places (Set owner for a fund, add users to a fund, or set a
manager to a suggestion), we need patrons to be filtered depending on
the permissions they have.
For instance you can only set a fund's owner with a patron that has
acquisition.order_manage.

Currently we have fetching X (default 20) patrons, then filter them
depending on their permission.
Says you have 3 patrons that have the correct permissions but are not in
the 20 first patrons, if you do not define a search term, the search
result will be empty.

This is not ideal and we should filter when requesting the DB.

Test plan:
- Have more than 20 patrons, remove them their permissions
- Create 3 more:
1 superlibrarian
1 with the full acq permission
1 with acquisition.order_manage
- Create a fund and set a owner
- Search for patrons, without specifying a search term (to get them all)
=> Without this patch the new patrons you created are not displayed
=> With this patch they are!

Same test plan apply to set a manager to a suggestion (freshly pushed,
see bug 23590), with suggestions and suggestions.suggestions_manage

Note: The code has been written that way to rely on
C4::Auth::haspermission, but the SQL query is quite trivial and the gain
is important.

Signed-off-by: Fridolin Somers 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Kyle M Hall  changed:

   What|Removed |Added

 Status|Signed Off  |Passed QA

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #14 from Kyle M Hall  ---
Created attachment 101822
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101822=edit
Bug 24964: Prevent random failures sorting by borrowernumber

Signed-off-by: Fridolin Somers 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Kyle M Hall  changed:

   What|Removed |Added

 Attachment #101813|0   |1
is obsolete||
 Attachment #101814|0   |1
is obsolete||
 Attachment #101815|0   |1
is obsolete||

--- Comment #12 from Kyle M Hall  ---
Created attachment 101820
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101820=edit
Bug 24964: Add tests

Signed-off-by: Fridolin Somers 

Signed-off-by: Kyle M Hall 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Kyle M Hall  changed:

   What|Removed |Added

 QA Contact|testo...@bugs.koha-communit |k...@bywatersolutions.com
   |y.org   |
 CC||k...@bywatersolutions.com

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Fridolin SOMERS  changed:

   What|Removed |Added

 Attachment #101686|0   |1
is obsolete||

--- Comment #10 from Fridolin SOMERS  ---
Created attachment 101814
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101814=edit
Bug 24964: Do not filter patrons after they have been fetched

The svc/members/search script is called in different places.
In some places (Set owner for a fund, add users to a fund, or set a
manager to a suggestion), we need patrons to be filtered depending on
the permissions they have.
For instance you can only set a fund's owner with a patron that has
acquisition.order_manage.

Currently we have fetching X (default 20) patrons, then filter them
depending on their permission.
Says you have 3 patrons that have the correct permissions but are not in
the 20 first patrons, if you do not define a search term, the search
result will be empty.

This is not ideal and we should filter when requesting the DB.

Test plan:
- Have more than 20 patrons, remove them their permissions
- Create 3 more:
1 superlibrarian
1 with the full acq permission
1 with acquisition.order_manage
- Create a fund and set a owner
- Search for patrons, without specifying a search term (to get them all)
=> Without this patch the new patrons you created are not displayed
=> With this patch they are!

Same test plan apply to set a manager to a suggestion (freshly pushed,
see bug 23590), with suggestions and suggestions.suggestions_manage

Note: The code has been written that way to rely on
C4::Auth::haspermission, but the SQL query is quite trivial and the gain
is important.

Signed-off-by: Fridolin Somers 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Fridolin SOMERS  changed:

   What|Removed |Added

 Attachment #101702|0   |1
is obsolete||

--- Comment #11 from Fridolin SOMERS  ---
Created attachment 101815
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101815=edit
Bug 24964: Prevent random failures sorting by borrowernumber

Signed-off-by: Fridolin Somers 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Fridolin SOMERS  changed:

   What|Removed |Added

 Attachment #101668|0   |1
is obsolete||

--- Comment #9 from Fridolin SOMERS  ---
Created attachment 101813
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101813=edit
Bug 24964: Add tests

Signed-off-by: Fridolin Somers 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Fridolin SOMERS  changed:

   What|Removed |Added

   Patch complexity|--- |Small patch
 Status|Needs Signoff   |Signed Off

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #8 from Jonathan Druart  
---
Created attachment 101702
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101702=edit
Bug 24964: Prevent random failures sorting by borrowernumber

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Jonathan Druart  changed:

   What|Removed |Added

 Status|Failed QA   |Needs Signoff

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #7 from Fridolin SOMERS  ---
(In reply to Jonathan Druart from comment #6)
> They should be returned depending on their borrowernumber. Which order do
> you get?

By adding debug to t/db_dependent/Utils/Datatables_Members.t :
-'We got the 3 patrons we expected'
+'We got the 3 patrons we expected'.Data::Dumper::Dumper(map {
$_->{borrowernumber} } @{ $search_results->{patrons} })

I get :
# $VAR1 = 7888;
# $VAR2 = 7886;
# $VAR3 = 7887;

I confirm failing is random.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #6 from Jonathan Druart  
---
They should be returned depending on their borrowernumber. Which order do you
get?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

--- Comment #5 from Jonathan Druart  
---
they should be returned depending on the bug number. Which order do you get?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Fridolin SOMERS  changed:

   What|Removed |Added

 CC||fridolin.som...@biblibre.co
   ||m
 Status|Needs Signoff   |Failed QA

--- Comment #4 from Fridolin SOMERS  ---
In test :
+is_deeply(
+[ map { $_->{borrowernumber} } @{ $search_results->{patrons} } ],
+[
+$superlibrarian->borrowernumber,
+$librarian_with_full_permission->borrowernumber,
+$librarian_with_subpermission->borrowernumber
+],
+'We got the 3 patrons we expected'
+);

I get an error because $search_results->{patrons} may not be ordered like
expected array.
Test is OK when adding sort on both arrays.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Jonathan Druart  changed:

   What|Removed |Added

 Attachment #101669|0   |1
is obsolete||

--- Comment #3 from Jonathan Druart  
---
Created attachment 101686
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101686=edit
Bug 24964: Do not filter patrons after they have been fetched

The svc/members/search script is called in different places.
In some places (Set owner for a fund, add users to a fund, or set a
manager to a suggestion), we need patrons to be filtered depending on
the permissions they have.
For instance you can only set a fund's owner with a patron that has
acquisition.order_manage.

Currently we have fetching X (default 20) patrons, then filter them
depending on their permission.
Says you have 3 patrons that have the correct permissions but are not in
the 20 first patrons, if you do not define a search term, the search
result will be empty.

This is not ideal and we should filter when requesting the DB.

Test plan:
- Have more than 20 patrons, remove them their permissions
- Create 3 more:
1 superlibrarian
1 with the full acq permission
1 with acquisition.order_manage
- Create a fund and set a owner
- Search for patrons, without specifying a search term (to get them all)
=> Without this patch the new patrons you created are not displayed
=> With this patch they are!

Same test plan apply to set a manager to a suggestion (freshly pushed,
see bug 23590), with suggestions and suggestions.suggestions_manage

Note: The code has been written that way to rely on
C4::Auth::haspermission, but the SQL query is quite trivial and the gain
is important.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Jonathan Druart  changed:

   What|Removed |Added

Summary|Remove pagination when  |Do not filter patrons AFTER
   |searching for patrons with  |they have been fetched from
   |permissions |the DB (when searching with
   ||permissions)

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 24964] Do not filter patrons AFTER they have been fetched from the DB (when searching with permissions)

2020-03-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24964

Jonathan Druart  changed:

   What|Removed |Added

   Severity|normal  |major

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/