Bug 36111: 856$h should not appear as a link in detailed record

Test plan:
1. Add 856$h to MARC editor
   1.1. Go to Administration > MARC bibliographic frameworks
   1.2. Next to Default framework, click Actions > MARC structure
   1.3. Search for field 856
   1.4. Click Actions > Edit subfields
   1.5. Click h
   1.6. Check the Editor box
   1.7. Click Save changes
2. Catalog a new record with a random URL in 856$h
   2.1. Go to Cataloging
   2.2. Click New record
   2.3. Fill out the mandatory fields (000, 003, 005, 008, 040$c,
        245$a, 942$c)
   2.4. Go to tab 8 and enter a value in 856$h
   2.5. Click Save (No need to add an item)
3. Search for the title in the staff interface (a large enough
   search to have more than one result)
   --> Notice it says "Online resources: Click here to access online"
   3.1. Try to click the link
        --> Blank page
4. Access the detailed record in the staff interface
   --> Notice it says "Online resources: Click here to access online"
   4.1. Try to click the link
        --> Blank page
5. Search for the title in the opac (a large enough search to have
   more than one result)
   --> Notice it says "Online resources: Click here to access online"
   5.1. Try to click the link
        --> Blank page
6. Access the detailed record in the opac
   --> Notice it says "Online resources: Click here to access online"
   6.1. Try to click the link
        --> Blank page
7. Edit the item and add a text in field 856$y
8. Access the detailed record in the staff interface
   --> Notice it says what you put in 856$y field
9. Apply the patch
10. Replay steps 3 through 6, but this time, the "Online resources"
   field should not be present.
11. Replay steps 7 through 8, but this time, what you put in 856$y
   field should not be present.
12. Edit the item and add a url in field 856$u
13. Replay steps 3 through 6, but this time, clicking on the link
    should take you to the URL specified in the 856$u field.
14. Replay steps 7 through 8, but this time, what you put in 856$y
   field should be present and
   clicking on the link should take you to the URL specified in the 856$u field.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matthias Le Gac 2024-04-05 09:17:16 -04:00 committed by Katrin Fischer
parent b9f97ec015
commit fe37e7eda6
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
4 changed files with 66 additions and 37 deletions

View File

@ -921,7 +921,10 @@
</xsl:if>
<xsl:if test="marc:datafield[@tag=856]">
<span class="results_summary online_resources"><span class="label">Online resources: </span>
<span class="results_summary online_resources">
<xsl:if test="marc:datafield[@tag=856]/marc:subfield[@code='u']">
<span class="label">Online resources: </span>
</xsl:if>
<xsl:for-each select="marc:datafield[@tag=856]">
<xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
<a>
@ -933,11 +936,14 @@
</xsl:call-template>
<xsl:value-of select="marc:subfield[@code='u']"/>
</xsl:attribute>
<xsl:if test="not(marc:subfield[@code='u'])">
<xsl:attribute name="style">pointer-events: none; color: #202020;</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="($Show856uAsImage='Details' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="height">100</xsl:attribute></xsl:element><xsl:text></xsl:text>
</xsl:when>
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z'] and marc:subfield[@code='u']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">y3z</xsl:with-param>
</xsl:call-template>
@ -947,18 +953,17 @@
<xsl:when test="$URLLinkText!=''">
<xsl:value-of select="$URLLinkText"/>
</xsl:when>
<xsl:otherwise>
<xsl:when test="marc:subfield[@code='u']">
<xsl:text>Click here to access online</xsl:text>
</xsl:otherwise>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</a>
<xsl:choose>
<xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when>
<xsl:otherwise> | </xsl:otherwise>
<xsl:when test="(marc:subfield[@code='y'] or marc:subfield[@code='3'] or marc:subfield[@code='z'] or marc:subfield[@code='u']) and marc:subfield[@code='u']"><xsl:text> | </xsl:text></xsl:when>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>

View File

@ -979,7 +979,9 @@
<xsl:if test="marc:datafield[@tag=856]">
<span class="results_summary online_resources">
<span class="label">Online resources: </span>
<xsl:if test="marc:datafield[@tag=856]/marc:subfield[@code='u']">
<span class="label">Online resources: </span>
</xsl:if>
<xsl:for-each select="marc:datafield[@tag=856]">
<xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
<a>
@ -991,11 +993,14 @@
</xsl:call-template>
<xsl:value-of select="marc:subfield[@code='u']"/>
</xsl:attribute>
<xsl:if test="not(marc:subfield[@code='u'])">
<xsl:attribute name="style">pointer-events: none; color: #202020;</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="height">100</xsl:attribute></xsl:element><xsl:text></xsl:text>
</xsl:when>
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z'] and marc:subfield[@code='u']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">y3z</xsl:with-param>
</xsl:call-template>
@ -1005,16 +1010,16 @@
<xsl:when test="$URLLinkText!=''">
<xsl:value-of select="$URLLinkText"/>
</xsl:when>
<xsl:otherwise>
<xsl:when test="marc:subfield[@code='u']">
<xsl:text>Click here to access online</xsl:text>
</xsl:otherwise>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</a>
<xsl:choose>
<xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when>
<xsl:otherwise> | </xsl:otherwise>
<xsl:when test="(marc:subfield[@code='y'] or marc:subfield[@code='3'] or marc:subfield[@code='z'] or marc:subfield[@code='u']) and marc:subfield[@code='u']"><xsl:text> | </xsl:text></xsl:when>
</xsl:choose>
</xsl:for-each>
</span>

View File

@ -1039,11 +1039,11 @@
<!-- Image processing code added here, takes precedence over text links including y3z text -->
<xsl:if test="marc:datafield[@tag=856]">
<span class="results_summary online_resources">
<span class="label">Online resources: </span>
<ul class="resource_list">
<xsl:if test="marc:datafield[@tag=856]/marc:subfield[@code='u']">
<span class="label">Online resources: </span>
</xsl:if>
<xsl:for-each select="marc:datafield[@tag=856]">
<xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
<li>
<a property="url">
<xsl:choose>
<xsl:when test="$OPACTrackClicks='track'">
@ -1061,6 +1061,9 @@
</xsl:call-template>
<xsl:value-of select="marc:subfield[@code='u']"/>
</xsl:attribute>
<xsl:if test="not(marc:subfield[@code='u'])">
<xsl:attribute name="style">pointer-events: none; color: #202020;</xsl:attribute>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$OPACURLOpenInNewWindow='1'">
@ -1070,22 +1073,28 @@
<xsl:when test="($Show856uAsImage='Details' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px</xsl:attribute></xsl:element><xsl:text></xsl:text>
</xsl:when>
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z'] and marc:subfield[@code='u']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">y3z</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="$URLLinkText!=''">
<xsl:value-of select="$URLLinkText"/>
<xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])">
<xsl:choose>
<xsl:when test="$URLLinkText!=''">
<xsl:value-of select="$URLLinkText"/>
</xsl:when>
<xsl:when test="marc:subfield[@code='u']">
<xsl:text>Click here to access online</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>Click here to access online</xsl:text>
</xsl:otherwise>
</xsl:choose>
</a>
</li>
<xsl:choose>
<xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when>
<xsl:when test="(marc:subfield[@code='y'] or marc:subfield[@code='3'] or marc:subfield[@code='z'] or marc:subfield[@code='u']) and marc:subfield[@code='u']"><xsl:text> | </xsl:text></xsl:when>
</xsl:choose>
</xsl:for-each>
</ul>
</span>
</xsl:if>

View File

@ -1217,12 +1217,13 @@
<xsl:if test="marc:datafield[@tag=856]">
<div class="results_summary online_resources">
<xsl:if test="marc:datafield[@tag=856]/marc:subfield[@code='u']">
<span class="label">Online resources: </span>
<ul class="resource_list">
</xsl:if>
<xsl:for-each select="marc:datafield[@tag=856]">
<xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
<xsl:if test="$OPACURLOpenInNewWindow='0'">
<li><a>
<a>
<xsl:choose>
<xsl:when test="$OPACTrackClicks='track'">
<xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
@ -1239,13 +1240,16 @@
</xsl:call-template>
<xsl:value-of select="marc:subfield[@code='u']"/>
</xsl:attribute>
<xsl:if test="not(marc:subfield[@code='u'])">
<xsl:attribute name="style">pointer-events: none; color: #202020;</xsl:attribute>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px;</xsl:attribute></xsl:element><xsl:text></xsl:text>
</xsl:when>
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z'] and marc:subfield[@code='u']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">y3z</xsl:with-param>
</xsl:call-template>
@ -1255,16 +1259,16 @@
<xsl:when test="$URLLinkText!=''">
<xsl:value-of select="$URLLinkText"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>Click here to access online</xsl:text>
</xsl:otherwise>
<xsl:when test="marc:subfield[@code='u']">
<xsl:text>Click here to access online</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</a></li>
</a>
</xsl:if>
<xsl:if test="$OPACURLOpenInNewWindow='1'">
<li><a target='_blank'>
<a target='_blank'>
<xsl:choose>
<xsl:when test="$OPACTrackClicks='track'">
<xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
@ -1274,13 +1278,16 @@
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute>
</xsl:otherwise>
<xsl:if test="not(marc:subfield[@code='u'])">
<xsl:attribute name="style">pointer-events: none; color: #202020;</xsl:attribute>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and ($SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
<xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px</xsl:attribute></xsl:element><xsl:text></xsl:text>
</xsl:when>
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
<xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z'] and marc:subfield[@code='u']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">y3z</xsl:with-param>
</xsl:call-template>
@ -1290,16 +1297,19 @@
<xsl:when test="$URLLinkText!=''">
<xsl:value-of select="$URLLinkText"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>Click here to access online</xsl:text>
</xsl:otherwise>
<xsl:when test="marc:subfield[@code='u']">
<xsl:text>Click here to access online</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</a></li>
</a>
</xsl:if>
<xsl:choose>
<xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when>
<xsl:when test="(marc:subfield[@code='y'] or marc:subfield[@code='3'] or marc:subfield[@code='z'] or marc:subfield[@code='u']) and marc:subfield[@code='u']"><xsl:text> | </xsl:text></xsl:when>
</xsl:choose>
</xsl:for-each>
</ul>
</div>
</xsl:if>