From 2099b4d1b289306a9c8f36f5055155d8d7e73b25 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 | 17 ++++++++++++++++- .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 1 - 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 422a02b1ea7..a961583c15b 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -32,6 +32,8 @@ use Koha::RecordProcessor; use Koha::XSLT::Base; use Koha::Libraries; use Koha::Recalls; +use Koha::TemplateUtils qw( process_tt ); +use C4::Scrubber; my $engine; #XSLT Handler object @@ -238,6 +240,16 @@ sub XSLTParse4Display { $variables->{OpenURLResolverURL} = $biblio->get_openurl; } } + my $extracontent = ''; + + # Check if we should add extra content based on system preference + if ( C4::Context->preference('ExtraContentForXSLTDisplay') ) { + + my $scrubber = C4::Scrubber->new('staff'); + my $extracontentvalue = C4::Context->preference('ExtraContentForXSLTDisplay'); + my $extracontentproccessed = process_tt( $extracontentvalue, { record => $record } ); + $extracontent = $scrubber->scrub($extracontentproccessed); + } # embed variables my $varxml = "\n"; @@ -260,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 9167240766c..3d56fe9f560 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -14,7 +14,6 @@ - -- 2.39.5