Bug 12346: Display the correct number of pending patron modifications on the patron...
[koha.git] / members / members-home.pl
index 5e474bb..fcd8eb1 100755 (executable)
@@ -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/member.tt",
                  query => $query,
                  type => "intranet",
@@ -58,9 +55,14 @@ else {
     $template->param(categories=>\@categories);
 }
 
+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 );
 
 $template->param( 
         no_add => $no_add,