From fc60b7f7316f4d00f0fa87d2d69162729cd8e74e Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Tue, 20 Nov 2007 23:01:00 -0600 Subject: [PATCH] fixing mc-* group OR queries (checkboxs) Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Search.pm | 13 ++++++++----- catalogue/search.pl | 2 +- etc/zebradb/biblios/etc/bib1.att | 1 + etc/zebradb/ccl.properties | 12 ++++++------ .../prog/en/modules/catalogue/advsearch.tmpl | 2 +- .../prog/en/modules/catalogue/results.tmpl | 2 +- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 688d0782df..c9bfa579ce 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -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 diff --git a/catalogue/search.pl b/catalogue/search.pl index 0dd0b4ae11..9d59919906 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -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 diff --git a/etc/zebradb/biblios/etc/bib1.att b/etc/zebradb/biblios/etc/bib1.att index a3dff1e975..f5c8a8c53f 100644 --- a/etc/zebradb/biblios/etc/bib1.att +++ b/etc/zebradb/biblios/etc/bib1.att @@ -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 diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties index 548faf5b7f..c9a306cefd 100644 --- a/etc/zebradb/ccl.properties +++ b/etc/zebradb/ccl.properties @@ -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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl index 78f4928794..a0c0bc1c8b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl @@ -87,7 +87,7 @@ " alt="" /> - " name="limit" value="mt:" />  + " name="limit" value="mc:" />  diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl index ee8a1084cc..a755d658e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl @@ -59,7 +59,7 @@ -- 2.39.5
- Scan Index for: + Scan Index for: