From c2a2e2c85dfb60a7f468340f7843e85667de32cb Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 12 Jan 2016 12:45:31 +1100 Subject: [PATCH] Bug 15537 - Hide records on Leader 05 = d in OPAC Currently, if a bibliographic record has a record status of "deleted" (ie LDR05=d), it shows up in the catalogue. This patch indexes the LDR05 character into the Record-status index (already defined in bib1.att). It creates a CCL qualifier for that index, and it adds a condition to OPAC queries where it only returns records that do not have a LDR05 of "d". Test Conditions: 1) With QueryParser 2) Without QueryParser 3) With OpacSuppression 4) Without OpacSuppression Test Plan: Before applying patch: 1) Choose a bibliographic record and change the LDR05 to "d" 2) Try searching for that record in the OPAC 3) Note that it appears in the search results (or takes you directly to the record) Apply patch. After applying patch: 4) Try searching for that record in the OPAC 5) Note that the record doesn't appear in the search results 6) Re-try steps 4 & 5 with each of the 4 test conditions outlined above. It should work the same regardless of using the QueryParser or OpacSuppression. NOTE: When using the QueryParser, you might need to vary your syntax. For instance, w/ QP you'd need "local-number:492 || local-number:495" whereas w/o QP you'd need "local-number:492 or local-number:495". NOTE: For extra points, double-check the staff client to make sure that you can still find records that have a LDR05 of "d". --- C4/Search.pm | 1 + etc/zebradb/ccl.properties | 5 +++++ etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml | 3 +++ etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl | 3 +++ etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml | 3 +++ etc/zebradb/marc_defs/normarc/biblios/biblio-zebra-indexdefs.xsl | 3 +++ etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml | 3 +++ etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl | 5 +++++ opac/opac-search.pl | 7 +++++++ 9 files changed, 33 insertions(+) diff --git a/C4/Search.pm b/C4/Search.pm index f52e0ee..5140a88 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1178,6 +1178,7 @@ sub getIndexes{ 'rcn', 'Record-type', 'rtype', + 'Record-status', 'se', 'See', 'See-also', diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties index f65d269..e3abe74 100644 --- a/etc/zebradb/ccl.properties +++ b/etc/zebradb/ccl.properties @@ -271,6 +271,11 @@ language-original 1=1095 #Microform-generation 1=61 #material-designation Microform-generation +#Record-status 1046 Information about the status of the record, e.g. new, corrected, deleted, revised. +Record-status 1=1046 14=1 +#The special attribute 14=1 shouldn't be necessary as Record-status should never be an empty index, +#but this is an extra precaution to avoid Zebra errors when an index is empty + #Code-record-type 1001 A code that specifies the Leader/06 # characteristics and defines # the components of the record. diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml index 6b1fb87..337cb96 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml @@ -6,6 +6,9 @@ llength:w + + Record-status:w + rtype:w diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl index 604c76a..1ab1f4c 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl @@ -48,6 +48,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + diff --git a/etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml index 0918f2a..2e6c44c 100644 --- a/etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml @@ -6,6 +6,9 @@ llength:w + + Record-status:w + rtype:w diff --git a/etc/zebradb/marc_defs/normarc/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/normarc/biblios/biblio-zebra-indexdefs.xsl index 1eeca69..110dc6b 100644 --- a/etc/zebradb/marc_defs/normarc/biblios/biblio-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/normarc/biblios/biblio-zebra-indexdefs.xsl @@ -48,6 +48,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml index 90e92a0..b6f2fc0 100644 --- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml @@ -2,6 +2,9 @@ marc:controlfield[@tag='001'] + + Record-status:w + Local-number:w diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl index 32e1742..328eef2 100644 --- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-zebra-indexdefs.xsl @@ -44,6 +44,11 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + diff --git a/opac/opac-search.pl b/opac/opac-search.pl index bc703b3..fd9b169 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -571,6 +571,13 @@ if (C4::Context->preference('OpacSuppression')) { } } +# Hide records with Record-status=d +if ( $query_type eq 'pqf' ) { + $query = '@not '.$query.' @attr 14=1 @attr 1=1046 d'; +} else { + $query = "($query) not Record-status=d"; +} + $template->param ( LIMIT_INPUTS => \@limit_inputs ); $template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar')); -- 2.1.4