fixing mc-* group OR queries (checkboxs)
authorJoshua Ferraro <jmf@liblime.com>
Wed, 21 Nov 2007 05:01:00 +0000 (23:01 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Wed, 21 Nov 2007 20:12:46 +0000 (14:12 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Search.pm
catalogue/search.pl
etc/zebradb/biblios/etc/bib1.att
etc/zebradb/ccl.properties
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl

index 688d078..c9bfa57 100644 (file)
@@ -409,7 +409,6 @@ sub getRecords {
                     ## This is just an index scan
                     if ($scan) {
                         my ( $term, $occ ) = $results[ $i - 1 ]->term($j);
-
                  # here we create a minimal MARC record and hand it off to the
                  # template just like a normal result ... perhaps not ideal, but
                  # it works for now
@@ -417,7 +416,7 @@ sub getRecords {
                         $tmprecord->encoding('UTF-8');
                         my $tmptitle;
 
-          # srote the minimal record in author/title (depending on MARC flavour)
+                       # srote the minimal record in author/title (depending on MARC flavour)
                         if ( C4::Context->preference("marcflavour") eq
                             "UNIMARC" )
                         {
@@ -816,6 +815,7 @@ sub buildQuery {
     warn "QUERY BEFORE LIMITS: >$query<" if $DEBUG;
 
     # add limits
+       my $group_OR_limits;
     foreach my $this_limit (@limits) {
         if ( $this_limit =~ /available/ ) {
                        # FIXME: switch to zebra search for null values
@@ -825,17 +825,20 @@ sub buildQuery {
         }
                # these are treated as OR
         elsif ( $this_limit =~ /mc/ ) {
-            $limit .= " or $this_limit";
+            $group_OR_limits .= " or " if $group_OR_limits;
+                       $group_OR_limits .= "$this_limit";
                        $limit_cgi .="&limit=$this_limit";
             $limit_desc .= " or $this_limit";
         }
                else {
-                       $limit .= " and $this_limit";
+                       $limit .= " and " if $limit || $query;
+                       $limit .= "$this_limit";
                        $limit_cgi .="&limit=$this_limit";
                        $limit_desc .=" and $this_limit";
                }
     }
-
+       $limit.=" and " if ($query && $limit);
+       $limit.="($group_OR_limits)" if $group_OR_limits;
        # normalize the strings
        for ($query, $query_search_desc, $limit, $limit_desc) {
                $_ =~ s/  / /g;    # remove extra spaces
index 0dd0b4a..9d59919 100755 (executable)
@@ -525,7 +525,7 @@ $template->param(
             searchdesc => ($query_type?"$query_type=":"")."$query_search_desc",
             opacfacets => 1,
             facets_loop => $facets,
-            scan_use => $scan,
+            scan => $scan,
             search_error => $error,
 );
 ## Now let's find out if we have any supplemental data to show the user
index a3dff1e..f5c8a8c 100644 (file)
@@ -147,6 +147,7 @@ att 8027 copynumber
 att 8028 uri
 att 8029 replacementprice
 att 8030 replacementpricedate
+att 8031 itype
 
 ## Fixed Fields and other special indexes
 att 9901                       Extent
index 548faf5..c9a306c 100644 (file)
@@ -461,11 +461,10 @@ bc Stock-number
 #                           kit, computer database,
 #                           computer file.
 Material-type  1=1031
-#itemtype Material-type
 #collection Material-type
-collection-code Material-type
-mt Material-type
-mc-collection Material-type
+#collection-code Material-type
+#mt Material-type
+#mc-collection Material-type
 #dt-lh Material-type
 
 #Music-key            1025  A statement of the key in       $r in the following:
@@ -939,7 +938,8 @@ copynumber 1=8027
 uri 1=8028
 replacementprice 1=8029
 replacementpricedate 1=8030
-
+itype 1=8031
+mc itype
 # Publisher Location
 
 Place-publication 1=59
@@ -1023,7 +1023,7 @@ datedue 1=9522
 popularity 1=issues
 
 # Material Category
-mc 1=8700
+#mc 1=8700
 ## TYPE LIMITS
 dt-bks 1=8700
 dt-vis 1=8700
index 78f4928..a0c0bc1 100644 (file)
@@ -87,7 +87,7 @@
       <!--TMPL_LOOP Name="itemtypeloop"-->
         <td>
         <!-- TMPL_IF name="imageurl"--><img border="0" src="<!--TMPL_VAR Name="imageurl" -->" alt="<!--TMPL_VAR Name="description" -->" /><!-- /TMPL_IF -->
-               <input type="checkbox" id="mt-<!--TMPL_VAR Name="number" -->" name="limit" value="mt:<!--TMPL_VAR Name="code" -->" />&nbsp;
+               <input type="checkbox" id="mc-<!--TMPL_VAR Name="number" -->" name="limit" value="mc:<!--TMPL_VAR Name="code" -->" />&nbsp;
         <!--TMPL_VAR Name="description" --></td>
         <!-- TMPL_UNLESS name="count5" --></tr><tr><!-- /TMPL_UNLESS -->
       <!--/TMPL_LOOP-->
index ee8a108..a755d65 100644 (file)
@@ -59,7 +59,7 @@
             <table>
                 <tr>
                     <td>
-                        Scan Index for: <input type="text" name="qf" id="scan-index" size="35" value="" />
+                        Scan Index for: <input type="text" name="q" id="scan-index" size="35" value="" />
                     </td>
                 </tr>
                 <tr>