[PATCH 1/2] Make sure haspermission function does not pass along a null value
Chad Billman
chad at pennmanor.net
Wed Jun 29 18:30:15 CEST 2011
---
C4/Auth.pm | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index b416449..2569ff1 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -1580,7 +1580,12 @@ sub haspermission {
my ($userid, $flagsrequired) = @_;
my $sth = C4::Context->dbh->prepare("SELECT flags FROM borrowers WHERE userid=?");
$sth->execute($userid);
- my $flags = getuserflags($sth->fetchrow(), $userid);
+
+ # Make sure the query returns a value before passing to getuserflags
+ my $flags = $sth->fetchrow();
+ if( !$flags ) { $flags = 0; }
+
+ $flags = getuserflags($flags, $userid);
if ( $userid eq C4::Context->config('user') ) {
# Super User Account from /etc/koha.conf
$flags->{'superlibrarian'} = 1;
--
1.7.4.1
--------------090602050905080002080504
Content-Type: text/x-patch;
name="0002-Back-out-part-of-bug-5995-do-not-change-userid-to-ca.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0002-Back-out-part-of-bug-5995-do-not-change-userid-to-ca.pa";
filename*1="tch"
More information about the Koha-patches
mailing list