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

Henri-Damien LAURENT laurenthdl at alinto.com
Tue Nov 14 11:43:57 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Henri-Damien LAURENT <hdl>	06/11/14 10:43:57

Modified files:
	opac           : opac-search.pl 

Log message:
	BUG Fixing : OPAC would display NO results When multiple fields are queried.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-search.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.21.2.18&r2=1.21.2.19

Patches:
Index: opac-search.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-search.pl,v
retrieving revision 1.21.2.18
retrieving revision 1.21.2.19
diff -u -b -r1.21.2.18 -r1.21.2.19
--- opac-search.pl	8 Sep 2006 08:45:47 -0000	1.21.2.18
+++ opac-search.pl	14 Nov 2006 10:43:57 -0000	1.21.2.19
@@ -43,8 +43,8 @@
 	my $orderby = $query->param('orderby');
 	my $desc_or_asc = $query->param('desc_or_asc');
 	my $exactsearch = $query->param('exact');
+	my @tags;
 	for (my $i=0;$i<=$#marclist;$i++) {
-
 		if ($marclist[$i] eq "biblioitems.isbn") {
 			$value[$i] =~ s/-//g;
 		}
@@ -52,6 +52,24 @@
                         $searchdesc .= $and_or[$i].$excluding[$i]." ".($marclist[$i]?$marclist[$i]:"* ")." ".$operator[$i]." ".$value[$i]." " if ($value[$i]);
                 } else {                        $searchdesc = $excluding[$i].($marclist[$i]?$marclist[$i]:"* ")." ".$operator[$i]." ".$value[$i]." " if ($value[$i]);
                 }
+      if ($marclist[$i]) {
+        my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marclist[$i],'');
+        if ($tag) {
+          push @tags,$dbh->quote("$tag$subfield");
+        } else {
+          if ($marclist[$i] =~ /^(\d){3}(. -)(.)*/)
+          {
+            # The user is using the search catalogue part, more fields
+            push @tags, $dbh->quote(substr($marclist[$i],0,4));
+          }
+          else
+          {
+            push @tags, $marclist[$i];
+          }
+        }
+      } else {
+        push @tags, "";
+      }
         }
 	
 	$resultsperpage= $query->param('resultsperpage');
@@ -63,20 +81,18 @@
 		}
 	}
 	# builds tag and subfield arrays
-	my @tags;
-
-	foreach my $marc (@marclist) {
-		if ($marc) {
-			my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marc,'');
-			if ($tag) {
-				push @tags,$dbh->quote("$tag$subfield");
-			} else {
-				push @tags, $dbh->quote(substr($marc,0,4));
-			}
-		} else {
-			push @tags, "";
-		}
-	}
+# 	foreach my $marc (@marclist) {
+# 		if ($marc) {
+# 			my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marc,'');
+# 			if ($tag) {
+# 				push @tags,$dbh->quote("$tag$subfield");
+# 			} else {
+# 				push @tags, $dbh->quote(substr($marc,0,4));
+# 			}
+# 		} else {
+# 			push @tags, "";
+# 		}
+# 	}
 	findseealso($dbh,\@tags);
 	my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or,
 										\@excluding, \@operator, \@value,
@@ -238,7 +254,7 @@
 	$template->param(classlist => $classlist,
 					branchloop=>\@branchloop,
 					itemtypeloop => \@itemtypeloop,
-					CGIbranch => $CGIbranch,
+# 					CGIbranch => $CGIbranch,
 					suggestion => C4::Context->preference("suggestion"),
 					virtualshelves => C4::Context->preference("virtualshelves"),
 					LibraryName => C4::Context->preference("LibraryName"),





More information about the Koha-cvs mailing list