fixing zebra searching after recent commits
authorJoshua Ferraro <jmf@liblime.com>
Fri, 21 Dec 2007 03:45:55 +0000 (21:45 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 21 Dec 2007 03:45:55 +0000 (21:45 -0600)
C4/Search.pm
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl

index 54efd49..8fd7205 100644 (file)
@@ -934,7 +934,13 @@ sub buildQuery {
        $query_cgi =~ s/^&//;
 
        # append the limit to the query
-       $query ? $query .= " ".$limit : $query = $limit;
+       if ($query) {
+               $query .=" ".$limit;
+       }
+       else {
+               $query = $limit;
+       }
+
     warn "query=$query and limit=$limit" if $DEBUG;
 
     warn "QUERY:".$query if $DEBUG;
@@ -953,7 +959,6 @@ sub buildQuery {
 # building the HTML output for the template
 sub searchResults {
     my ( $searchdesc, $hits, $results_per_page, $offset, @marcresults ) = @_;
-
     my $dbh = C4::Context->dbh;
     my $toggle;
     my $even = 1;
@@ -964,7 +969,7 @@ sub searchResults {
         $span_terms_hashref->{$span_term}++;
     }
 
-    #Build brancnames hash
+    #Build branchnames hash
     #find branchname
     #get branch information.....
     my %branches;
@@ -997,15 +1002,12 @@ sub searchResults {
     }
 
     #search item field code
-    my $sth =
-      $dbh->prepare(
-"select tagfield from marc_subfield_structure where kohafield like 'items.itemnumber'"
-      );
+    my $sth = $dbh->prepare("SELECT tagfield FROM marc_subfield_structure WHERE kohafield LIKE 'items.itemnumber'");
     $sth->execute;
     my ($itemtag) = $sth->fetchrow;
 
     ## find column names of items related to MARC
-    my $sth2 = $dbh->prepare("SHOW COLUMNS from items");
+    my $sth2 = $dbh->prepare("SHOW COLUMNS FROM items");
     $sth2->execute;
     my %subfieldstosearch;
     while ( ( my $column ) = $sth2->fetchrow ) {
index 898cc70..819abab 100644 (file)
@@ -301,8 +301,7 @@ $(window).load(function() {
                                 </td>
 
                                                                <td style="white-space : nowrap"><div class="availability">
-                                                                        <div>
-                                                                       <!-- TMPL_IF NAME="items_count" --><!-- TMPL_VAR NAME="items_count" --><!-- /TMPL_IF -->
+                                                                       <!-- TMPL_IF NAME="items_count" --><div><!-- TMPL_VAR NAME="items_count" -->
                                                                        <!-- TMPL_IF NAME="itemsplural" -->items<!-- TMPL_ELSE -->item<!-- /TMPL_IF --></div>
 
                                                                        <!-- TMPL_IF NAME="available_items_loop" -->
@@ -345,6 +344,9 @@ $(window).load(function() {
                                         (<!-- TMPL_VAR NAME="count" -->)</li>
                                     <!-- /TMPL_LOOP --></ul>
                                     <!-- /TMPL_IF -->
+                                                                       <!-- TMPL_ELSE -->
+                                                                       <span class="unavailable">No items</span>
+                                                                       <!-- /TMPL_IF --> <!-- /items count -->
                                                        </div></td>
 
                             </tr>