From 82bdd288ad7677f37f573c59c368c91aed721c95 Mon Sep 17 00:00:00 2001 From: Lucas Gass 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') %] The 538a: [% record.subfield('538' , 'a') %] [% 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 | 4 ++++ .../prog/en/xslt/MARC21slim2intranetResults.xsl | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) 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 = "" . $extracontentproccessed . ""; + } # embed variables my $varxml = "\n"; @@ -248,7 +257,7 @@ sub XSLTParse4Display { $varxml .= "\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..fb08b541114 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -1568,6 +1568,10 @@ + + + + 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 @@ + + + -- 2.39.5