followup : auto_truncation 3287252c0
[koha.git] / C4 / Branch.pm
index 35424d7..7dfd737 100644 (file)
@@ -141,7 +141,7 @@ sub onlymine {
     return 
     C4::Context->preference('IndependantBranches') &&
     C4::Context->userenv                           &&
-    C4::Context->userenv->{flags}!=1               &&
+    C4::Context->userenv->{flags} %2 != 1          &&
     C4::Context->userenv->{branch}                 ;
 }
 
@@ -379,21 +379,18 @@ sub GetBranch ($$) {
 
 =head2 GetBranchDetail
 
-  $branchname = &GetBranchDetail($branchcode);
+    $branch = &GetBranchDetail($branchcode);
 
-Given the branch code, the function returns the corresponding
-branch name for a comprehensive information display
+Given the branch code, the function returns a
+hashref for the corresponding row in the branches table.
 
 =cut
 
 sub GetBranchDetail {
-    my ($branchcode) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
+    my ($branchcode) = shift or return;
+    my $sth = C4::Context->dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
     $sth->execute($branchcode);
-    my $branchname = $sth->fetchrow_hashref();
-    $sth->finish();
-    return $branchname;
+    return $sth->fetchrow_hashref();
 }
 
 =head2 get_branchinfos_of