Bugzilla – Attachment 182055 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: Allow for the defining of custom MARC fields on the staff interface record display pages
Bug-39860-Allow-for-the-defining-of-custom-MARC-fi.patch (text/plain), 4.30 KB, created by
Lucas Gass (lukeg)
on 2025-05-07 21:43:41 UTC
(
hide
)
Description:
Bug 39860: Allow for the defining of custom MARC fields on the staff interface record display pages
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-05-07 21:43:41 UTC
Size:
4.30 KB
patch
obsolete
>From 2fad831e8f19c3e63e565e89002907da4b84525e Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Wed, 7 May 2025 21:39:18 +0000 >Subject: [PATCH] Bug 39860: Allow for the defining of custom MARC fields on > the staff interface record display pages > >To test: >1. APPLY PATCH, updatedatabase, restart_all >2. Search for the new 'ExtraContentForXSLTDisplay' system preference >3. Find or create a record that has some MARC fields that don't show up by default in the record display. ( I tested using a 538$a ) >4. Add the following to the ExtraContentForXSLTDisplay sys pref: > >[% IF record.subfield('538' , 'a') %] > <span class="results_summary test1"> > <span class="label">The 538a: </span> > [% record.subfield('538' , 'a') %] > </span> >[% END %] > >5. Go to the record from step 3, you should see the 538$a labeled as 'The 538a:' with the appropriate data in it. >--- > C4/XSLT.pm | 11 ++++++++++- > .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 6 +++++- > .../prog/en/xslt/MARC21slim2intranetResults.xsl | 3 +++ > 3 files changed, 18 insertions(+), 2 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 422a02b1ea7..9f77968299b 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -32,6 +32,7 @@ use Koha::RecordProcessor; > use Koha::XSLT::Base; > use Koha::Libraries; > use Koha::Recalls; >+use Koha::TemplateUtils qw( process_tt ); > > my $engine; #XSLT Handler object > >@@ -238,6 +239,14 @@ sub XSLTParse4Display { > $variables->{OpenURLResolverURL} = $biblio->get_openurl; > } > } >+ my $extracontentxml = ''; >+ >+ # Check if we should add extra content based on system preference >+ if ( C4::Context->preference('ExtraContentForXSLTDisplay') ) { >+ my $extracontentvalue = C4::Context->preference('ExtraContentForXSLTDisplay'); >+ my $extracontentproccessed = process_tt( $extracontentvalue, { record => $record } ); >+ $extracontentxml = "<extracontent><content>" . $extracontentproccessed . "</content></extracontent>"; >+ } > > # embed variables > my $varxml = "<variables>\n"; >@@ -248,7 +257,7 @@ sub XSLTParse4Display { > $varxml .= "</variables>\n"; > > my $sysxml = get_xslt_sysprefs(); >- $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/; >+ $xmlrecord =~ s/\<\/record\>/$itemsxml$extracontentxml$sysxml$varxml\<\/record\>/; > if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs > $xmlrecord =~ s/\&amp;/\&/g; > $xmlrecord =~ s/\&\;lt\;/\<\;/g; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index 9167240766c..1ff525de806 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -974,7 +974,7 @@ > </xsl:when> > <xsl:when test="marc:datafield[@tag=505]/@ind1=1"> > <span class="label">Incomplete contents:</span> >- </xsl:when> >+ </xsl:when>subfieldSelect > <xsl:when test="marc:datafield[@tag=505]/@ind1=2"> > <span class="label">Partial contents:</span> > </xsl:when> >@@ -1568,6 +1568,10 @@ > </xsl:for-each> > </span> > </xsl:if> >+ <xsl:if test="marc:extracontent"> >+ <xsl:copy-of select="marc:extracontent/marc:content/node()"/> >+ </xsl:if> >+ > > <!-- Indicate if record is suppressed in OPAC --> > <xsl:choose> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >index 58faae0eacb..36045762547 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >@@ -1021,6 +1021,9 @@ > </span> > </xsl:if> > </xsl:if> >+ <xsl:if test="marc:extracontent and normalize-space(string(marc:extracontent/marc:content)) != ''"> >+ <xsl:copy-of select="marc:extracontent/marc:content/node()"/> >+ </xsl:if> > > <!-- 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