From 8c76f19b548251e8d2ea477930d40307c009c69c 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: 0. APPLY PATCH, restart_all 1. 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 ) 2. Go to Tools and you should see a new link for 'Record display customizations'. 3. From Record display customizations click 'New Entry' 4. Choose a display location, the choices should be StaffResultsPage, StaffDetailPage, OPACResultsPage, and OPACDetailPage 5. Add the following to the entry: [% IF record.subfield('538' , 'a') %] The 538a: [% record.subfield('538' , 'a') %] [% END %] 6. Go to the record from step 1, you should see the 538$a labeled as 'The 538a:' with the appropriate data in it. 7. This should display in the appropriate location depending on if you chose StaffResultsPage, StaffDetailPage, OPACResultsPage, or OPACDetailPage. Check each of the locations. 8. Make a new, or edit existing, Record display customization and mark the 'Library:' field for a specific branch. Make sure that the Record display customization only shows up when you are logged in at that branch. 9. Install a new language pack, I tested with es-ES. 10. Make a new, or edit existing, Record display customization and fill out the language specific tab. Make sure the Record display customization shows correctly with the language you chose. --- 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