From 48455784409f8866734185d2e48ef91954ae53ae Mon Sep 17 00:00:00 2001
From: Jared Camins-Esakov <jcamins@cpbibliography.com>
Date: Mon, 25 Jun 2012 12:11:35 -0400
Subject: [PATCH] Bug 8311: Fix scoping error in C4::Auth
Content-Type: text/plain; charset="UTF-8"

There is a mis-scoped function call in C4::Auth, on line 154, where
GetMembers is called without explicit scoping and before
'require C4::Members;'. This does not actually have any functional
ramifications as far as I can tell, but it would be a good idea to fix
it.

This patch also corrects a bit of indenting in that area, because it was
an unnecessary challenge to understand the code with the mis-indenting.
---
 C4/Auth.pm |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index 143fe3f..1b14915 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -146,14 +146,15 @@ sub get_template_and_user {
     my $borrowernumber;
     my $insecure = C4::Context->preference('insecure');
     if ($user or $insecure) {
+        require C4::Members;
         # It's possible for $user to be the borrowernumber if they don't have a
         # userid defined (and are logging in through some other method, such
         # as SSL certs against an email address)
         $borrowernumber = getborrowernumber($user) if defined($user);
         if (!defined($borrowernumber) && defined($user)) {
-		my $borrower = GetMember(borrowernumber => $user);
-		if ($borrower) {
-		$borrowernumber = $user;
+            my $borrower = C4::Members::GetMember(borrowernumber => $user);
+            if ($borrower) {
+                $borrowernumber = $user;
                 # A bit of a hack, but I don't know there's a nicer way
                 # to do it.
                 $user = $borrower->{firstname} . ' ' . $borrower->{surname};
@@ -172,7 +173,6 @@ sub get_template_and_user {
             barshelvesloop  => $barshelves,
         );
 
-        require C4::Members;
         my ( $borr ) = C4::Members::GetMemberDetails( $borrowernumber );
         my @bordat;
         $bordat[0] = $borr;
-- 
1.7.2.5