From 810c37e91bd234fb15d4d8b39d9f0d158fd1b33c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Mar 2020 17:46:54 +0100 Subject: [PATCH] Bug 24852: Adjust XSLT paths for dev installs We are building the XSLT paths with intrahtdocs, it should be intranetdir (and assume that have the usual git structure). For instance, on a dev box, the XSLT base path was outside of the git repo: /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/xslt/ Now it will be: /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/xslt/ Test plan: 0. Do not apply the patch, set dev_install to 1 in $KOHA_CONF 1. Modify a xslt in the git repo, and in the "htdocs" path, in a different way: /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl 2. Restart all the things and refresh a bibliographic record detail page Notice that you see the change from the "htdocs", outside of the git repo 3. Apply the patch 4. Repeat 2. Notice that you now see the change you made on the file from the git repo 5. Set dev_install to 0 in $KOHA_CONF 6. Repeat 2. Notice that you now see the change from htdocs --- C4/XSLT.pm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 44b8aea94f..eb07e3029a 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -197,41 +197,52 @@ sub XSLTParse4Display { $lang ||= C4::Languages::getlanguage(); if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) { - my $htdocs; - my $theme; - my $xslfile; + my ( $htdocs, $theme, $xslfile, $interface ); if ($xslsyspref eq "XSLTDetailsDisplay") { $htdocs = C4::Context->config('intrahtdocs'); $theme = C4::Context->preference("template"); $xslfile = C4::Context->preference('marcflavour') . "slim2intranetDetail.xsl"; + $interface = 'intranet'; } elsif ($xslsyspref eq "XSLTResultsDisplay") { $htdocs = C4::Context->config('intrahtdocs'); $theme = C4::Context->preference("template"); $xslfile = C4::Context->preference('marcflavour') . "slim2intranetResults.xsl"; + $interface = 'intranet'; } elsif ($xslsyspref eq "OPACXSLTDetailsDisplay") { $htdocs = C4::Context->config('opachtdocs'); $theme = C4::Context->preference("opacthemes"); $xslfile = C4::Context->preference('marcflavour') . "slim2OPACDetail.xsl"; + $interface = 'opac'; } elsif ($xslsyspref eq "OPACXSLTResultsDisplay") { $htdocs = C4::Context->config('opachtdocs'); $theme = C4::Context->preference("opacthemes"); $xslfile = C4::Context->preference('marcflavour') . "slim2OPACResults.xsl"; + $interface = 'opac'; } elsif ($xslsyspref eq 'XSLTListsDisplay') { # Lists default to *Results.xslt $htdocs = C4::Context->config('intrahtdocs'); $theme = C4::Context->preference("template"); $xslfile = C4::Context->preference('marcflavour') . "slim2intranetResults.xsl"; + $interface = 'intranet'; } elsif ($xslsyspref eq 'OPACXSLTListsDisplay') { # Lists default to *Results.xslt $htdocs = C4::Context->config('opachtdocs'); $theme = C4::Context->preference("opacthemes"); $xslfile = C4::Context->preference('marcflavour') . "slim2OPACResults.xsl"; + $interface = 'opac'; + } + + # Dealing with dev installs here + if ( C4::Context->config('dev_install') && $interface ) { + # /kohadevbox/koha/koha-tmpl/intranet-tmpl + # /kohadevbox/koha/koha-tmpl/opac-tmpl + $htdocs = sprintf "%s/koha-tmpl/%s-tmpl", C4::Context->config('intranetdir'), $interface; } $xslfilename = _get_best_default_xslt_filename($htdocs, $theme, $lang, $xslfile); } -- 2.20.1