Bug 7537 - Implement TraceCompleteSubfields, TraceSubjectSubdivisions and UseICU...
authorMagnus Enger <magnus@enger.priv.no>
Thu, 16 Feb 2012 11:07:35 +0000 (12:07 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 29 Mar 2012 09:00:32 +0000 (11:00 +0200)
IMPORTANT! This patch relies on the patch for Bug 7092, which is now pushed to
master.

As the title says, this patch implements TraceCompleteSubfields,
TraceSubjectSubdivisions and UseICU for NORMARC XSLT, both for the OPAC
and the Intranet. This affects how clickable subject-links are constructed.

To make this work the indexing of MARC fields in the 600 range is changed
to include "Subject:p" in several new places.

To test:

Find a record with a "complex" subject, like "Internet -- Law and legislation".
MARC21 and NORMARC are very similar in how they handle subjects, so testing
on a MARC21 database should be OK. (Changes in indexing reflect changes already
made to the MARC21 indexing.)

Make sure you have these syspref settings:
- marcflavour = NORMARC
- XSLTDetailsDisplay = using XSLT stylesheets
- OPACXSLTDetailsDisplay = using XSLT stylesheets

(Ideally, testing should be done on a real NORMARC setup, but since the changes
to indexing only reflect how it's already done in MARC21, I think testing
on a MARC21 installation with marcflavour = NORMARC should be OK.)

Now try the different combinations of TraceCompleteSubfields,
TraceSubjectSubdivisions and UseICU, and check the format of the
clickable links, both in the OPAC and staff client. Here's what you should
be seeing:

1.
TraceCompleteSubfields   = Don't force
TraceSubjectSubdivisions = Don't include
UseICU = Not using
  opac-search.pl?q=su:"Internet"
UseICU = Using
  opac-search.pl?q=su:{Internet}

2.
TraceCompleteSubfields   = Force
TraceSubjectSubdivisions = Don't include
UseICU = Not using
  opac-search.pl?q=su,complete-subfield:"Internet"
UseICU = Using
  opac-search.pl?q=su,complete-subfield:{Internet}

3.
TraceCompleteSubfields   = Don't force
TraceSubjectSubdivisions = Include
UseICU = Not using
  opac-search.pl?q=(su:"Internet") AND (su:"Law and legislation.")
UseICU = Using
  opac-search.pl?q=(su:{Internet}) AND (su:{Law and legislation.})

4.
TraceCompleteSubfields   = Force
TraceSubjectSubdivisions = Include
UseICU = Not using
  opac-search.pl?q=(su,complete-subfield:"Internet") AND (su,complete-subfield:"Law and legislation.")
UseICU = Using
  opac-search.pl?q=(su,complete-subfield:{Internet}) AND (su,complete-subfield:{Law and legislation.})

UPDATE 2012-03-23
- Change the syspref TracingQuotes to UseICU, see bug 7092
- Change boolean operator from "and" to "AND", see bug 7695

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Note: UseControlnumber must be turned off.

1) Works.
2) Works.
3) Works.
4) Works.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>

etc/zebradb/marc_defs/normarc/biblios/record.abs
koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl
koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACDetail.xsl
koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslimUtils.xsl

index 7495cc4..97d5334 100644 (file)
@@ -177,25 +177,25 @@ melm 520        Abstract:w,Abstract:p
 #melm 533$d     pubdate,pubdate:s
 #melm 541$d     Date-of-acquisition,Date-of-acquisition:s
 
-melm 600$a      Name-and-title,Name,Personal-name,Subject-name-personal,Subject
-melm 600$t      Name-and-title,Title,Subject
+melm 600$a      Name-and-title,Name,Personal-name,Subject-name-personal,Subject,Subject:p
+melm 600$t      Name-and-title,Title,Subject,Subject:p
 melm 600$9      Koha-Auth-Number
 #melm 600       Name,Personal-name,Subject-heading,Subject-name-personal
-melm 600        Name,Personal-name,Subject-name-personal,Subject
-melm 610$a      Name-and-title
-melm 610$t      Name-and-title,Title
+melm 600        Name,Personal-name,Subject-name-personal,Subject,Subject:p
+melm 610$a      Name-and-title,Subject,Subject:p
+melm 610$t      Name-and-title,Title,Subject,Subject:p
 melm 610$9      Koha-Auth-Number
-melm 610        Name,Subject,Corporate-name
-melm 611        Conference-name
-melm 611$a      Name-and-title
-melm 611$t      Name-and-title,Title
+melm 610        Name,Subject,Corporate-name,Subject,Subject:p
+melm 611        Conference-name,Subject,Subject:p
+melm 611$a      Name-and-title,Subject,Subject:p
+melm 611$t      Name-and-title,Title,Subject,Subject:p
 melm 611$9      Koha-Auth-Number
-melm 611        Name,Subject
-melm 630$i      Thematic-number
-melm 630$n      Thematic-number
-melm 630$r      Music-key
+melm 611        Name,Subject,Subject:p
+melm 630$i      Thematic-number,Subject,Subject:p
+melm 630$n      Thematic-number,Subject,Subject:p
+melm 630$r      Music-key,Subject,Subject:p
 melm 630$9      Koha-Auth-Number
-melm 630        Subject
+melm 630        Subject,Subject:p
 melm 650$9      Koha-Auth-Number
 melm 650        Subject,Subject:p
 melm 651$9      Koha-Auth-Number
@@ -205,13 +205,13 @@ melm 652$9      Koha-Auth-Number
 melm 653$9      Koha-Auth-Number
 melm 653        Subject,Subject:p
 melm 654$9      Koha-Auth-Number
-melm 654        Subject
+melm 654        Subject,Subject:p
 melm 655$9      Koha-Auth-Number
-melm 655        Subject
+melm 655        Subject,Subject:p
 melm 656$9      Koha-Auth-Number
-melm 656        Subject
+melm 656        Subject,Subject:p
 melm 657$9      Koha-Auth-Number
-melm 657        Subject
+melm 657        Subject,Subject:p
 melm 690$9      Koha-Auth-Number
 melm 690        Subject,Subject:p
 
index 163ed29..c28116a 100644 (file)
 
         <!-- Sysprefs -->
         <xsl:variable name="OPACBaseURL" select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
+        <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
+        <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
+        <xsl:variable name="TracingQuotesLeft">
+          <xsl:choose>
+            <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
+            <xsl:otherwise>"</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="TracingQuotesRight">
+          <xsl:choose>
+            <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
+            <xsl:otherwise>"</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
 
         <xsl:variable name="leader" select="marc:leader"/>
         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
         </span>
         </xsl:if>
 
+        <!-- Subjects -->
+
         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
-            <span class="results_summary"><span class="label">Emner: </span>
+            <span class="results_summary subjects"><span class="label">Emne(r): </span>
             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
             <a>
             <xsl:choose>
-            <xsl:when test="marc:subfield[@code=9]">
-                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+            <!-- Will implement this later
+                <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
+                    <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+                </xsl:when>
+            -->
+            <xsl:when test="$TraceSubjectSubdivisions='1'">
+                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">abcdvxyz</xsl:with-param>
+                        <xsl:with-param name="delimeter"> AND </xsl:with-param>
+                        <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
+                        <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
+                    </xsl:call-template>
+                </xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
             </xsl:otherwise>
             </xsl:choose>
             <xsl:call-template name="chopPunctuation">
                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
                     </xsl:call-template>
                 </xsl:with-param>
-            </xsl:call-template></a>
+            </xsl:call-template>
+            </a>
             <xsl:choose>
             <xsl:when test="position()=last()"></xsl:when>
             <xsl:otherwise> | </xsl:otherwise>
index 7c2bf21..606727e 100644 (file)
                <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
                <xsl:param name="subdivCodes"/>
                <xsl:param name="subdivDelimiter"/>
+        <xsl:param name="prefix"/>
+        <xsl:param name="suffix"/>
                <xsl:variable name="str">
                        <xsl:for-each select="marc:subfield">
                                <xsl:if test="contains($codes, @code)">
                     <xsl:if test="contains($subdivCodes, @code)">
                         <xsl:value-of select="$subdivDelimiter"/>
                     </xsl:if>
-                                       <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>
+                                       <xsl:value-of select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
                                </xsl:if>
                        </xsl:for-each>
                </xsl:variable>
index 2538106..3a77417 100644 (file)
 
     <xsl:template match="marc:record">
 
-    <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
+        <!-- Sysprefs -->
+        <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
+        <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
+        <xsl:variable name="TracingQuotesLeft">
+          <xsl:choose>
+            <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
+            <xsl:otherwise>"</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="TracingQuotesRight">
+          <xsl:choose>
+            <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">}</xsl:when>
+            <xsl:otherwise>"</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
 
         <xsl:variable name="leader" select="marc:leader"/>
         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
         </span>
         </xsl:if>
 
+        <!-- Subjects -->
+
         <xsl:if test="marc:datafield[substring(@tag, 1, 1) = '6']">
-            <span class="results_summary"><span class="label">Emner: </span>
+            <span class="results_summary subjects"><span class="label">Emne(r): </span>
             <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
             <a>
             <xsl:choose>
-            <xsl:when test="marc:subfield[@code=9]">
-                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+            <!-- Will implement this later
+                <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
+                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
+                </xsl:when>
+            -->
+            <xsl:when test="$TraceSubjectSubdivisions='1'">
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">abcdvxyz</xsl:with-param>
+                        <xsl:with-param name="delimeter"> AND </xsl:with-param>
+                        <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param>
+                        <xsl:with-param name="suffix"><xsl:value-of select="$TracingQuotesRight"/>)</xsl:with-param>
+                    </xsl:call-template>
+                </xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="marc:subfield[@code='a']"/></xsl:attribute>
+                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute>
             </xsl:otherwise>
             </xsl:choose>
             <xsl:call-template name="chopPunctuation">
                         <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
                     </xsl:call-template>
                 </xsl:with-param>
-            </xsl:call-template></a>
+            </xsl:call-template>
+            </a>
             <xsl:choose>
             <xsl:when test="position()=last()"></xsl:when>
             <xsl:otherwise> | </xsl:otherwise>
index 31317b1..91a0437 100644 (file)
                <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
                <xsl:param name="subdivCodes"/>
                <xsl:param name="subdivDelimiter"/>
+        <xsl:param name="prefix"/>
+        <xsl:param name="suffix"/>
                <xsl:variable name="str">
                        <xsl:for-each select="marc:subfield">
                                <xsl:if test="contains($codes, @code)">
                     <xsl:if test="contains($subdivCodes, @code)">
                         <xsl:value-of select="$subdivDelimiter"/>
                     </xsl:if>
-                                       <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>
+                                       <xsl:value-of select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/>
                                </xsl:if>
                        </xsl:for-each>
                </xsl:variable>