[Koha-cvs] koha/opac opac-search.pl [rel_2_2]

Joshua Ferraro jmf at kados.org
Wed Mar 8 19:49:51 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	Joshua Ferraro <kados at savannah.gnu.org>	06/03/08 18:49:51

Modified files:
	opac           : opac-search.pl 

Log message:
	Adding a new way to return branches to the template as requested by
	owen. I preserved the old method so that paul can decide whether to
	switch default templates or not.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/opac/opac-search.pl.diff?only_with_tag=rel_2_2&tr1=1.21.2.15&tr2=1.21.2.16&r1=text&r2=text

Patches:
Index: koha/opac/opac-search.pl
diff -u koha/opac/opac-search.pl:1.21.2.15 koha/opac/opac-search.pl:1.21.2.16
--- koha/opac/opac-search.pl:1.21.2.15	Wed Mar  8 13:46:55 2006
+++ koha/opac/opac-search.pl	Wed Mar  8 18:49:51 2006
@@ -11,6 +11,7 @@
 use C4::SearchMarc;
 use C4::Acquisition;
 use C4::Biblio;
+use C4::Koha;
 # use C4::Search;
 
 my $classlist='';
@@ -177,7 +178,7 @@
 	my  @itemtype;
 	my %itemtypes;
 	push @itemtype, "";
-	$itemtypes{''} = "";
+	$itemtypes{''} = "Any Document Type";
 	while (my ($value,$lib) = $sth->fetchrow_array) {
 		push @itemtype, $value;
 		$itemtypes{$value}=$lib;
@@ -189,26 +190,41 @@
 				-size     => 1,
 				-multiple => 0 );
 	$sth->finish;
-	
-	my @branches;
-	my @select_branch;
-	my %select_branches;
-	my ($count2, at branches)=branches();
-	push @select_branch, "";
-	$select_branches{''} = "";
-	for (my $i=0;$i<$count2;$i++){
-		push @select_branch, $branches[$i]->{'branchcode'};#
-		$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
+
+	my @oldbranches;
+	my @oldselect_branch;
+	my %oldselect_branches;
+	my ($oldcount2, at oldbranches)=branches();
+	push @oldselect_branch, "";
+	$oldselect_branches{''} = "";
+	for (my $i=0;$i<$oldcount2;$i++){
+		push @oldselect_branch, $oldbranches[$i]->{'branchcode'};#
+		$oldselect_branches{$oldbranches[$i]->{'branchcode'}} = $oldbranches[$i]->{'branchname'};
 	}
 	my $CGIbranch=CGI::scrolling_list( -name     => 'value',
-				-values   => \@select_branch,
-				-labels   => \%select_branches,
+				-values   => \@oldselect_branch,
+				-labels   => \%oldselect_branches,
 				-size     => 1,
 				-multiple => 0 );
 	$sth->finish;
-    
+
+	my @branches;
+	my @select_branch;
+	my %select_branches;
+	my $branches = getallbranches();
+	my @branchloop;
+	foreach my $thisbranch (keys %$branches) {
+        my $selected = 1 if (C4::Context->userenv && ($thisbranch eq C4::Context->userenv->{branch}));
+        my %row =(value => $thisbranch,
+                                selected => $selected,
+                                branchname => $branches->{$thisbranch}->{'branchname'},
+                        );
+        push @branchloop, \%row;
+	}
+ 
 	$template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary")) if (C4::Context->preference("Disable_Dictionary"));
 	$template->param(classlist => $classlist,
+					branchloop=>\@branchloop,
 					CGIitemtype => $CGIitemtype,
 					CGIbranch => $CGIbranch,
 					suggestion => C4::Context->preference("suggestion"),





More information about the Koha-cvs mailing list