Auth, after verifying the session/logging in the user, calls to the database
to get the users borrowernumber. This call is probably unnecessary because
borrowernumber is part of userenv. Check userenv before going to the database.
---
C4/Auth.pm | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index d73f19b..7574f9e 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -1468,6 +1468,10 @@ sub haspermission {
sub getborrowernumber {
my ($userid) = @_;
+ my $userenv = C4::Context->userenv;
+ if ( defined( $userenv ) && ref( $userenv ) eq 'HASH' &&
$userenv->{number} ) {
+ return $userenv->{number};
+ }
my $dbh = C4::Context->dbh;
for my $field ( 'userid', 'cardnumber' ) {
my $sth =
--
1.6.0.4
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches