Bugzilla – Attachment 182231 Details for
Bug 39860
Add a system preference to allow for addtional/custom MARC fields in the record display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39860: Do not XSLT transform the custom content
Bug-39860-Do-not-XSLT-transform-the-custom-content.patch (text/plain), 6.83 KB, created by
Lucas Gass (lukeg)
on 2025-05-09 21:34:26 UTC
(
hide
)
Description:
Bug 39860: Do not XSLT transform the custom content
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-05-09 21:34:26 UTC
Size:
6.83 KB
patch
obsolete
>From 69ff6fa6f467c934d24bd6d65d8fb69d9899ba11 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 9 May 2025 21:25:34 +0000 >Subject: [PATCH] Bug 39860: Do not XSLT transform the custom content > >--- > C4/XSLT.pm | 12 +++--- > .../en/xslt/MARC21slim2intranetDetail.xsl | 37 ------------------- > .../en/xslt/MARC21slim2intranetResults.xsl | 36 ------------------ > 3 files changed, 7 insertions(+), 78 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 7d7cbfb8794..a961583c15b 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -240,7 +240,7 @@ sub XSLTParse4Display { > $variables->{OpenURLResolverURL} = $biblio->get_openurl; > } > } >- my $extracontentxml = ''; >+ my $extracontent = ''; > > # Check if we should add extra content based on system preference > if ( C4::Context->preference('ExtraContentForXSLTDisplay') ) { >@@ -248,8 +248,7 @@ sub XSLTParse4Display { > my $scrubber = C4::Scrubber->new('staff'); > my $extracontentvalue = C4::Context->preference('ExtraContentForXSLTDisplay'); > my $extracontentproccessed = process_tt( $extracontentvalue, { record => $record } ); >- my $cleanxml = $scrubber->scrub($extracontentproccessed); >- $extracontentxml = qq{<extracontent><content>$cleanxml</content></extracontent>}; >+ $extracontent = $scrubber->scrub($extracontentproccessed); > } > > # embed variables >@@ -261,7 +260,7 @@ sub XSLTParse4Display { > $varxml .= "</variables>\n"; > > my $sysxml = get_xslt_sysprefs(); >- $xmlrecord =~ s/\<\/record\>/$itemsxml$extracontentxml$sysxml$varxml\<\/record\>/; >+ $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/; > if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs > $xmlrecord =~ s/\&amp;/\&/g; > $xmlrecord =~ s/\&\;lt\;/\<\;/g; >@@ -273,7 +272,10 @@ sub XSLTParse4Display { > #If the xslt should fail, we will return undef (old behavior was > #raw MARC) > #Note that we did set do_not_return_source at object construction >- return $engine->transform( $xmlrecord, $xslfilename ); #file or URL >+ my $transformed_xml = $engine->transform( $xmlrecord, $xslfilename ); >+ >+ my $concatenated_content = $transformed_xml . $extracontent; >+ return $concatenated_content; > } > > =head2 buildKohaItemsNamespace >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index f75b795604b..3d56fe9f560 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -14,24 +14,6 @@ > <xsl:template match="/"> > <xsl:apply-templates/> > </xsl:template> >- <!-- Template for adding custom content from ExtraContentForXSLTDisplay and preserving HTML and TT from the preference --> >- <xsl:template match="marc:extracontent//node()"> >- <xsl:choose> >- <xsl:when test="self::text() or self::comment()"> >- <xsl:value-of select="."/> >- </xsl:when> >- <xsl:otherwise> >- <xsl:element name="{local-name()}"> >- <xsl:for-each select="@*"> >- <xsl:attribute name="{name()}"> >- <xsl:value-of select="."/> >- </xsl:attribute> >- </xsl:for-each> >- <xsl:apply-templates select="node()"/> >- </xsl:element> >- </xsl:otherwise> >- </xsl:choose> >- </xsl:template> > <xsl:template match="marc:record"> > > <!-- Option: Display Alternate Graphic Representation (MARC 880) --> >@@ -1586,25 +1568,6 @@ > </span> > </xsl:if> > >- <!-- Process custom fields from ExtraContentForXSLTDisplay system preference --> >- <xsl:for-each select="marc:extracontent/marc:content/node()"> >- <xsl:choose> >- <xsl:when test="self::text() or self::comment()"> >- <xsl:value-of select="."/> >- </xsl:when> >- <xsl:otherwise> >- <xsl:element name="{local-name()}"> >- <xsl:for-each select="@*"> >- <xsl:attribute name="{name()}"> >- <xsl:value-of select="."/> >- </xsl:attribute> >- </xsl:for-each> >- <xsl:apply-templates select="node()"/> >- </xsl:element> >- </xsl:otherwise> >- </xsl:choose> >- </xsl:for-each> >- > <!-- Indicate if record is suppressed in OPAC --> > <xsl:choose> > <xsl:when test="$OpacSuppression = 1 and marc:datafield[@tag=942][marc:subfield[@code='n'] = '1']"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >index 6742d00fd5a..58faae0eacb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >@@ -12,24 +12,6 @@ > <xsl:template match="/"> > <xsl:apply-templates/> > </xsl:template> >- <!-- Template for adding custom content from ExtraContentForXSLTDisplay and preserving HTML and TT from the preference --> >- <xsl:template match="marc:extracontent//node()"> >- <xsl:choose> >- <xsl:when test="self::text() or self::comment()"> >- <xsl:value-of select="."/> >- </xsl:when> >- <xsl:otherwise> >- <xsl:element name="{local-name()}"> >- <xsl:for-each select="@*"> >- <xsl:attribute name="{name()}"> >- <xsl:value-of select="."/> >- </xsl:attribute> >- </xsl:for-each> >- <xsl:apply-templates select="node()"/> >- </xsl:element> >- </xsl:otherwise> >- </xsl:choose> >- </xsl:template> > <xsl:template match="marc:record"> > > <!-- Option: Display Alternate Graphic Representation (MARC 880) --> >@@ -1039,24 +1021,6 @@ > </span> > </xsl:if> > </xsl:if> >- <!-- Process custom fields from ExtraContentForXSLTDisplay system preference --> >- <xsl:for-each select="marc:extracontent/marc:content/node()"> >- <xsl:choose> >- <xsl:when test="self::text() or self::comment()"> >- <xsl:value-of select="."/> >- </xsl:when> >- <xsl:otherwise> >- <xsl:element name="{local-name()}"> >- <xsl:for-each select="@*"> >- <xsl:attribute name="{name()}"> >- <xsl:value-of select="."/> >- </xsl:attribute> >- </xsl:for-each> >- <xsl:apply-templates select="node()"/> >- </xsl:element> >- </xsl:otherwise> >- </xsl:choose> >- </xsl:for-each> > > <!-- Content Warning --> > <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/> >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39860
:
182054
|
182055
|
182056
|
182057
|
182058
|
182059
|
182230
|
182231
|
182232
|
182233