Bug 30849

Summary: Make 'pending patron modification notices' on staff home page 'number of modifications at logged in library'
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: Staff interfaceAssignee: Lucas Gass (lukeg) <lucas>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: daniel.jones, gmcharlt, nick
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 36063    
Attachments: Bug 30849: show pending modifications by branch
Bug 30849: show pending modifications by branch
Bug 30849: show pending modifications by branch
Bug 30849: show pending modifications by branch
Bug 30849: show pending modifications by branch
Bug 30849: show pending modifications by branch

Description Lucas Gass (lukeg) 2022-05-25 15:14:57 UTC
On the staff main page pending suggestions show some like:


Suggestions pending approval: Centerville: 2 / All libraries: 100


It would be nice if we could do the same thing with pending patron modifications


Patrons requesting modifications: Centerville: 2 / All libraries: 100
Comment 1 Lucas Gass (lukeg) 2022-06-08 16:09:51 UTC
Created attachment 135823 [details] [review]
Bug 30849: show pending modifications by branch

To test:
1. Add some borrower modifications from the OPAC from patrons that belong to some different libraries.
2. On the staff client mainpage (mainpage.pl) you should see a link 'Patrons requesting modifications:' but no way of knowing if they are patrons from your logged in branch or not
3. Apply patch, restart_all
4. Try step 2 again and now you should see something like 'Patrons requesting modifications: Centerville: 1 / All libraries: 2';
5. Trying and and fulfilling some modifcations and make sure the numbers on mainpage.pl are always correct.
Comment 2 Biblibre Sandboxes 2022-07-12 15:55:03 UTC
Created attachment 137644 [details] [review]
Bug 30849: show pending modifications by branch

To test:
1. Add some borrower modifications from the OPAC from patrons that belong to some different libraries.
2. On the staff client mainpage (mainpage.pl) you should see a link 'Patrons requesting modifications:' but no way of knowing if they are patrons from your logged in branch or not
3. Apply patch, restart_all
4. Try step 2 again and now you should see something like 'Patrons requesting modifications: Centerville: 1 / All libraries: 2';
5. Trying and and fulfilling some modifcations and make sure the numbers on mainpage.pl are always correct.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 3 Daniel Jones 2022-07-12 15:56:44 UTC
Works as described, great idea for a feature.

I noticed this creates two links that both lead to the same location. At first glance it looks like the first link will only take you to patrons of that library who require approval.

Maybe if it was all one link it would be clearer that the destination is the same.
Comment 4 Katrin Fischer 2022-07-15 13:00:09 UTC
1) I am not sure if we don't give off the wrong impression here. The link for "my library" and "all libraries" is the same, because the patron modification page doesn't filter. But I think having 2 links would give off the impression that they behave differently. Would it be possible to create a link that filters? Or maybe we keep the link on the Patrons requesting... and not on the numbers.

2) We don't take  IndependentBranchesPatronModifications into account. I believe if that is 'on' we should only show the library count and could hide the all libraries one.

3) When there are no modification requests for the current library, it reads:
Patrons requesting modifications: Centerville: / All libraries: 1

For suggestions we show 0 here, which is a little nicer.
Comment 5 Lucas Gass (lukeg) 2026-01-02 14:16:16 UTC
Created attachment 190826 [details] [review]
Bug 30849: show pending modifications by branch

To test:
1. Add some borrower modifications from the OPAC from patrons that belong to some different libraries.
2. On the staff client mainpage (mainpage.pl) you should see a link 'Patrons requesting modifications:' but no way of knowing if they are patrons from your logged in branch or not
3. Apply patch, restart_all
4. Try step 2 again and now you should see something like 'Patrons requesting modifications: Centerville: 1 / All libraries: 2';
5. Turn on IndependentBranchesPatronModifications.
6. Log in as a superlibrarian, you should see branch specific and All libraries requests.
7. Log in as a non-superlibrarian, you should only see requests for your branch.
8. Trying and and fulfilling some modifcations and make sure the numbers on mainpage.pl are always correct.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 6 Lucas Gass (lukeg) 2026-01-02 14:39:12 UTC
Created attachment 190828 [details] [review]
Bug 30849: show pending modifications by branch

To test:
1. Add some borrower modifications from the OPAC from patrons that belong to some different libraries.
2. On the staff client mainpage (mainpage.pl) you should see a link 'Patrons requesting modifications:' but no way of knowing if they are patrons from your logged in branch or not
3. Apply patch, restart_all
4. Try step 2 again and now you should see something like 'Patrons requesting modifications: Centerville: 1 / All libraries: 2';
5. Turn on IndependentBranchesPatronModifications.
6. Log in as a superlibrarian, you should see branch specific and All libraries requests.
7. Log in as a non-superlibrarian, you should only see requests for your branch.
8. Trying and and fulfilling some modifcations and make sure the numbers on mainpage.pl are always correct.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 7 Lucas Gass (lukeg) 2026-01-02 17:16:27 UTC
Created attachment 190840 [details] [review]
Bug 30849: show pending modifications by branch

To test:
1. Add some borrower modifications from the OPAC from patrons that belong to some different libraries.
2. On the staff client mainpage (mainpage.pl) you should see a link 'Patrons requesting modifications:' but no way of knowing if they are patrons from your logged in branch or not
3. Apply patch, restart_all
4. Try step 2 again and now you should see something like 'Patrons requesting modifications: Centerville: 1 / All libraries: 2';
5. Turn on IndependentBranchesPatronModifications.
6. Log in as a superlibrarian, you should see branch specific and All libraries requests.
7. Log in as a non-superlibrarian, you should only see requests for your branch.
8. Trying and and fulfilling some modifcations and make sure the numbers on mainpage.pl are always correct.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 8 Lucas Gass (lukeg) 2026-01-02 17:22:17 UTC
Created attachment 190842 [details] [review]
Bug 30849: show pending modifications by branch

To test:
1. Add some borrower modifications from the OPAC from patrons that belong to some different libraries.
2. On the staff client mainpage (mainpage.pl) you should see a link 'Patrons requesting modifications:' but no way of knowing if they are patrons from your logged in branch or not
3. Apply patch, restart_all
4. Try step 2 again and now you should see something like 'Patrons requesting modifications: Centerville: 1 / All libraries: 2';
5. Turn on IndependentBranchesPatronModifications.
6. Log in as a superlibrarian, you should see branch specific and All libraries requests.
7. Log in as a non-superlibrarian, you should only see requests for your branch.
8. Trying and and fulfilling some modifcations and make sure the numbers on mainpage.pl are always correct.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 9 Katrin Fischer 2026-01-02 20:32:02 UTC
Had to read the description a few times until I got it, hope this improves readability a little :)
Comment 10 Nick Clemens (kidclamp) 2026-01-21 14:15:35 UTC
The general count is:
my $pending_borrower_modifications   = Koha::Patron::Modifications->pending_count($branch);


branch comes from:
 75 my $branch =
 76     (      C4::Context->preference("IndependentBranchesPatronModifications")
 77         || C4::Context->preference("IndependentBranches") )
 78     && !$flags->{'superlibrarian'}
 79     ? C4::Context->userenv()->{'branch'}
 80     : undef;



Then in the template:
[% IF Koha.Preference('IndependentBranchesPatronModifications') && !CAN_user_superlibrarian %]

Seems like that search can drop the $branch and we can use $local_pendingmodifications_count in the template

Otherwise for independent branches we are doing the same branch limited search twice