[Koha-patches] [PATCH] Bug 3087 Fix Z39.50 server to return the correct record syntax

Frédéric Demians f.demians at tamil.fr
Wed Apr 11 18:23:51 CEST 2012


Modify Makefile.PL and Zebra configuration files in order to parametrized
biblio record type returned by Zebra Z39.50 server.

How to test:

- Test with a MARC21 and a UNIMARC DB
- Do a new installation
- Search from OPAC
- Search from a Z39.50 client like yaz-client: syntax = MARC21/UNIMARC must be
  choosed
- It was working for MARC21: it continues to work
- It wasn't working for UNIMARC: it works now, both in OPAC and from a Z39.50
  client
---
 C4/Context.pm              |    2 +
 Makefile.PL                |    1 +
 etc/koha-conf.xml          |   46 ++++++++++++++++++++++----------------------
 etc/zebradb/etc/usmarc.mar |    4 +-
 4 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/C4/Context.pm b/C4/Context.pm
index 67d31ee..d368643 100644
--- a/C4/Context.pm
+++ b/C4/Context.pm
@@ -656,6 +656,8 @@ sub Zconn {
         $context->{"Zconn"}->{$server}->destroy() if defined($context->{"Zconn"}->{$server});
 
         $context->{"Zconn"}->{$server} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax);
+        $context->{ Zconn }->{ $server }->option(
+            preferredRecordSyntax => C4::Context->preference("marcflavour") );
         return $context->{"Zconn"}->{$server};
     }
 }
diff --git a/Makefile.PL b/Makefile.PL
index 2e414d5..11c3b5a 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -500,6 +500,7 @@ my $pl_files = {
 if ($config{'INSTALL_ZEBRA'} eq "yes") {
     push @{ $pl_files->{'rewrite-config.PL'} }, (
         'blib/ZEBRA_CONF_DIR/etc/passwd',
+        'blib/ZEBRA_CONF_DIR/etc/usmarc.mar',
         'blib/ZEBRA_CONF_DIR/zebra-biblios.cfg',
         'blib/ZEBRA_CONF_DIR/zebra-authorities.cfg',
         'blib/ZEBRA_CONF_DIR/zebra-authorities-dom.cfg',
diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml
index f5e2c0f..68d8e7c 100644
--- a/etc/koha-conf.xml
+++ b/etc/koha-conf.xml
@@ -41,47 +41,47 @@ __PAZPAR2_TOGGLE_XML_POST__
      <!-- <stylesheet>xsl/default.xsl</stylesheet> -->
      <!-- <maximumrecordsize>2000000</maximumrecordsize> -->
      <retrievalinfo>
-       <retrieval syntax="usmarc" name="F"/>
-       <retrieval syntax="usmarc" name="B"/>
+       <retrieval syntax="__ZEBRA_MARC_FORMAT__" name="F"/>
+       <retrieval syntax="__ZEBRA_MARC_FORMAT__" name="B"/>
        <retrieval syntax="xml" name="F"/>
        <retrieval syntax="xml" name="B"/>
        <retrieval syntax="xml" name="marcxml"
                   identifier="info:srw/schema/1/marcxml-v1.1">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="dc">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2DC.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="mods">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2MODS.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="rdfdc">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2RDFDC.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="rss2">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2RSS2.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="utils">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slimUtils.xsl"/>
@@ -119,38 +119,38 @@ __PAZPAR2_TOGGLE_XML_POST__
                 xmlns:xi="http://www.w3.org/2001/XInclude">
       <xi:fallback>
      <retrievalinfo>
-       <retrieval syntax="usmarc" name="F"/>
-       <retrieval syntax="usmarc" name="B"/>
+       <retrieval syntax="__ZEBRA_MARC_FORMAT__" name="F"/>
+       <retrieval syntax="__ZEBRA_MARC_FORMAT__" name="B"/>
        <retrieval syntax="xml" name="marcxml"
                   identifier="info:srw/schema/1/marcxml-v1.1">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="dc">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2DC.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="mods">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2MODS.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="rdfdc">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2RDFDC.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="utils">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slimUtils.xsl"/>
@@ -185,47 +185,47 @@ __PAZPAR2_TOGGLE_XML_POST__
     <config>__ZEBRA_CONF_DIR__/zebra-biblios.cfg</config>
     <cql2rpn>__ZEBRA_CONF_DIR__/pqf.properties</cql2rpn>
      <retrievalinfo>
-       <retrieval syntax="usmarc" name="F"/>
-       <retrieval syntax="usmarc" name="B"/>
+       <retrieval syntax="__ZEBRA_MARC_FORMAT__" name="F"/>
+       <retrieval syntax="__ZEBRA_MARC_FORMAT__" name="B"/>
        <retrieval syntax="xml" name="F"/>
        <retrieval syntax="xml" name="B"/>
        <retrieval syntax="xml" name="marcxml"
                   identifier="info:srw/schema/1/marcxml-v1.1">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="dc">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2DC.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="mods">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2MODS.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="rdfdc">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2RDFDC.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="rss2">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2RSS2.xsl"/>
          </backend>
        </retrieval>
        <retrieval syntax="xml" name="utils">
-         <backend syntax="usmarc" name="F">
+         <backend syntax="__ZEBRA_MARC_FORMAT__" name="F">
            <marc inputformat="marc" outputformat="marcxml"
                  inputcharset="utf-8"/>
            <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slimUtils.xsl"/>
diff --git a/etc/zebradb/etc/usmarc.mar b/etc/zebradb/etc/usmarc.mar
index 99920f9..a977ae5 100644
--- a/etc/zebradb/etc/usmarc.mar
+++ b/etc/zebradb/etc/usmarc.mar
@@ -1,3 +1,3 @@
 # $Id: usmarc.mar,v 1.1 2002/10/22 12:51:09 adam Exp $
-name usmarc
-reference USmarc
+name __ZEBRA_MARC_FORMAT__
+reference __ZEBRA_MARC_FORMAT__
-- 
1.7.8



More information about the Koha-patches mailing list