[Koha-cvs] koha/C4 Koha.pm [rel_2_2]

Ryan Higgins rch at liblime.com
Fri Apr 20 15:57:11 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Ryan Higgins <rych>	07/04/20 13:57:11

Modified files:
	C4             : Koha.pm 

Log message:
	add test for userenv before trying to get its branch

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Koha.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.22.2.8&r2=1.22.2.9

Patches:
Index: Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.22.2.8
retrieving revision 1.22.2.9
diff -u -b -r1.22.2.8 -r1.22.2.9
--- Koha.pm	19 Apr 2007 05:04:16 -0000	1.22.2.8
+++ Koha.pm	20 Apr 2007 13:57:10 -0000	1.22.2.9
@@ -517,9 +517,10 @@
 
 sub getbranch ($$) {
     my($query, $branches) = @_; # get branch for this query from branches
-    my $branch = $query->param('branch');
-	($branch) || ($branch = $query->cookie('branch'));
-	($branches->{$branch}) || ( $branch = C4::Context->userenv->{'branch'} ); 
+    my $branch = $query->param('branch') || $query->cookie('branch');
+	if ( ( ! $branch) && C4::Context->userenv() ) {
+		$branch = C4::Context->userenv->{'branch'} ;
+	}
 	($branches->{$branch}) || ($branch=(keys %$branches)[0]);
 
 return $branch;





More information about the Koha-cvs mailing list