Browse Source

Bug 12346: Display the correct number of pending patron modifications on the patron module home page

Due to the way handles the variable $branch, the number
of patron modifications listed on may differ from the
number listed on When the librarian clicks this link, he or
she may see a different number than was listed, or none at all!

Test Plan:
0) Set IndependentBranchesPatronModifications = Yes
1) Create a number of modification request for BranchA
2) Log into the staff intranet with a patron without superlibrarian
permissions and set your branch to BranchB
3) Note the modifications alert to does not display on
4) Click the "Patrons" link to take you to
5) Note the modifictions alert does display on this page
6) Apply this patch
7) Reload, note the alert no longer displays

QA notes: What was the point of the branch variable?

Followed test plan, patch worked as described. Also passed QA test tool
Signed-off-by: Alex Buckley <>
Signed-off-by: Tomas Cohen Arazi <>

Signed-off-by: Jonathan Druart <>
Jonathan Druart 5 years ago
  1. 14


@ -30,11 +30,8 @@ use Koha::List::Patron;
use Koha::Patron::Categories;
my $query = new CGI;
my $branch = $query->param('branchcode');
$branch = q{} unless defined $branch;
my ($template, $loggedinuser, $cookie)
my ($template, $loggedinuser, $cookie, $flags)
= get_template_and_user({template_name => "members/",
query => $query,
type => "intranet",
@ -58,9 +55,14 @@ else {
my $branch =
( C4::Context->preference("IndependentBranchesPatronModifications")
|| C4::Context->preference("IndependentBranches") )
&& !$flags->{'superlibrarian'}
? C4::Context->userenv()->{'branch'}
: undef;
my $pending_borrower_modifications =
Koha::Patron::Modifications->pending_count( $branch );
my $pending_borrower_modifications = Koha::Patron::Modifications->pending_count( $branch );
no_add => $no_add,