diff --git a/C4/XSLT.pm b/C4/XSLT.pm
index 5974215958..d9bfd7c6de 100644
--- a/C4/XSLT.pm
+++ b/C4/XSLT.pm
@@ -33,7 +33,9 @@ use Koha::XSLT::Base;
use Koha::Libraries;
use Koha::Recalls;
use Koha::TemplateUtils qw( process_tt );
+use Koha::AdditionalContents;
use C4::Scrubber;
+use C4::Languages;
my $engine; #XSLT Handler object
@@ -241,13 +243,38 @@ sub XSLTParse4Display {
}
}
my $extracontent = '';
+ my $location;
+ my $branch = C4::Context->userenv->{branch} || '';
+ my $lang = C4::Languages::getlanguage;
- # Check if we should add extra content based on system preference
- if ( C4::Context->preference('ExtraContentForXSLTDisplay') ) {
+ if ( $xslsyspref eq "XSLTDetailsDisplay" ) {
+ $location = 'StaffDetailPage';
+ } elsif ( $xslsyspref eq "XSLTResultsDisplay" ) {
+ $location = 'StaffResultsPage';
+ } elsif ( $xslsyspref eq "OPACXSLTDetailsDisplay" ) {
+ $location = 'OPACDetailPage';
+ } elsif ( $xslsyspref eq "OPACXSLTResultsDisplay" ) {
+ $location = 'OPACResultsPage';
+ }
+ my @record_display_customizations = Koha::AdditionalContents->search_for_display(
+ {
+ category => 'record_display',
+ location => $location,
+ lang => $lang,
+ library_id => $branch,
+ }
+ )->as_list;
+
+ if (@record_display_customizations) {
+ foreach my $customization (@record_display_customizations) {
+ $extracontent .= $customization->content;
+ }
+ }
+
+ if ($extracontent) {
my $scrubber = C4::Scrubber->new('staff');
- my $extracontentvalue = C4::Context->preference('ExtraContentForXSLTDisplay');
- my $extracontentproccessed = process_tt( $extracontentvalue, { record => $record } );
+ my $extracontentproccessed = process_tt( $extracontent, { record => $record } );
$extracontent = $scrubber->scrub($extracontentproccessed);
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt
index a5884db4bb..a1be9c8e52 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt
@@ -12,6 +12,8 @@
[% t("Modify news item") | html %]
[% ELSIF category == 'pages' %]
[% t("Modify page") | html %]
+ [% ELSIF category == 'record_display' %]
+ [% t("Modify record display customization") | html %]
[% ELSE %]
[% t("Modify HTML customization") | html %]
[% END %]
@@ -20,6 +22,8 @@
[% t("New news item") | html %]
[% ELSIF category == 'pages' %]
[% t("New page") | html %]
+ [% ELSIF category == 'record_display' %]
+ [% t("New record display customization") | html %]
[% ELSE %]
[% t("New HTML customization") | html %]
[% END %]
@@ -30,6 +34,8 @@
[% t("News") | html %]
[% ELSIF category == 'pages' %]
[% t("Pages") | html %]
+ [% ELSIF category == 'record_display' %]
+ [% t("Record display customizations") | html %]
[% ELSE %]
[% t("HTML customizations") | html %]
[% END %]
@@ -97,6 +103,8 @@
News
[% ELSIF category == 'pages' %]
Pages
+ [% ELSIF category == 'record_display' %]
+ Record display customizations
[% ELSE %]
HTML customizations
[% END %]
@@ -356,6 +364,8 @@
[% t("News") | html %]
[% ELSIF category == 'pages' %]
[% t("Pages") | html %]
+ [% ELSIF category == 'record_display' %]
+ [% t("Record display customizations") | html %]
[% ELSE %]
[% t("HTML customizations") | html %]
[% END %]
@@ -365,6 +375,7 @@
News
HTML customizations
Pages
+ Record display customizations
[% IF ( CAN_user_parameters_manage_sysprefs ) %]
OPACUserJS
OPACUserCSS
@@ -531,6 +542,27 @@
[% END %]
[% END %]
+ [% ELSIF category == 'record_display' %]
+ [% SET staff_available_options = ['StaffResultsPage' , 'StaffDetailPage'] %]
+
+ [% SET opac_available_options = ['OPACResultsPage' , 'OPACResultsPage'] %]
+
[% ELSE %]