diff --git a/authorities/detail.pl b/authorities/detail.pl
index 8915781dbd..83f42dfdfb 100755
--- a/authorities/detail.pl
+++ b/authorities/detail.pl
@@ -38,16 +38,19 @@ parameters tables.
use Modern::Perl;
+use CGI qw ( -utf8 );
+
use C4::Auth qw( get_template_and_user );
use C4::AuthoritiesMarc qw( GetAuthority GenerateHierarchy GetTagsLabels );
use C4::Context;
-use C4::Output qw( output_html_with_http_headers );
-use CGI qw ( -utf8 );
use C4::Koha;
-use Koha::Authorities;
+use C4::Languages;
+use C4::Output qw( output_html_with_http_headers );
+use Koha::Authorities;
use Koha::Authority::Types;
use Koha::Token;
+use Koha::XSLT::Base;
use Koha::Z3950Servers;
our ($tagslib);
@@ -213,7 +216,24 @@ while (my ($tagfield) = $sth->fetchrow) {
}
chop $biblio_fields if $biblio_fields;
-build_tabs ($template, $record, $dbh,"",$query);
+my $AuthorityXSLTDetailsDisplay = C4::Context->preference('AuthorityXSLTDetailsDisplay');
+if ( $AuthorityXSLTDetailsDisplay ) {
+ my $xsl = $AuthorityXSLTDetailsDisplay;
+ my $lang = C4::Languages::getlanguage();
+ $xsl =~ s/\{langcode\}/$lang/g;
+ $xsl =~ s/\{authtypecode\}/$authtypecode/g;
+
+ my $xslt_engine = Koha::XSLT::Base->new;
+ my $output = $xslt_engine->transform({ xml => $authobj->marcxml, file => $xsl });
+ if ($xslt_engine->err) {
+ warn "XSL transformation failed ($xsl): " . $xslt_engine->err;
+ next;
+ }
+
+ $template->param( html => $output );
+} else {
+ build_tabs ($template, $record, $dbh,"",$query);
+}
my $servers = Koha::Z3950Servers->search(
{
diff --git a/installer/data/mysql/atomicupdate/bug_35305.pl b/installer/data/mysql/atomicupdate/bug_35305.pl
new file mode 100755
index 0000000000..f5d1c64cd3
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_35305.pl
@@ -0,0 +1,15 @@
+use Modern::Perl;
+
+return {
+ bug_number => "35305",
+ description => "Add XSLT for authority details display in staff interface",
+ up => sub {
+ my ($args) = @_;
+ my ( $dbh, $out ) = @$args{qw(dbh out)};
+ $dbh->do(q{
+ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`)
+ VALUES ('AuthorityXSLTDetailsDisplay','','','Enable XSL stylesheet control over authority details page display on intranet','Free')
+ });
+ say $out "Added new system preference 'AuthorityXSLTDetailsDisplay'";
+ },
+};
diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql
index 2390e6ed5a..ebd4dd1866 100644
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ b/installer/data/mysql/mandatory/sysprefs.sql
@@ -79,6 +79,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'),
('AuthorityXSLTOpacDetailsDisplay','','','Enable XSL stylesheet control over authority details page in the OPAC','Free'),
('AuthorityXSLTOpacResultsDisplay','','','Enable XSL stylesheet control over authority results page in the OPAC','Free'),
+('AuthorityXSLTDetailsDisplay','','','Enable XSL stylesheet control over authority details page display on intranet','Free'),
('AuthorityXSLTResultsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','Free'),
('AuthorLinkSortBy','default','call_number|pubdate|acqdate|title','Specify the default field used for sorting when click author links','Choice'),
('AuthorLinkSortOrder','asc','asc|dsc|az|za','Specify the default sort order for author links','Choice'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
index d4a5c40170..cda1011030 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
@@ -5,6 +5,11 @@ Staff interface:
- pref: AuthorityXSLTResultsDisplay
class: file
- '
Options: