@@ -, +, @@ record --- C4/XSLT.pm | 13 +++++++------ basket/downloadcart.pl | 10 +++++++++- catalogue/detail.pl | 2 +- catalogue/export.pl | 13 +++++++++++-- opac/opac-detail.pl | 2 +- opac/opac-downloadcart.pl | 10 +++++++++- opac/opac-downloadshelf.pl | 12 ++++++++++-- opac/opac-export.pl | 11 ++++++++++- virtualshelves/downloadshelf.pl | 10 +++++++++- 9 files changed, 67 insertions(+), 16 deletions(-) --- a/C4/XSLT.pm +++ a/C4/XSLT.pm @@ -131,24 +131,24 @@ sub get_xslt_sysprefs { } sub get_xsl_filename { - my ( $xslsyspref ) = @_; + my ( $xslsyspref, $xslfilename ) = @_; my $lang = C4::Languages::getlanguage(); - my $xslfilename = C4::Context->preference($xslsyspref) || "default"; + $xslfilename ||= C4::Context->preference($xslsyspref) || "default"; if ($xslsyspref eq "XSLTCustomExport") { my $dir; $dir = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference("template") . - '/' . C4::Languages::getlanguage() . + '/' . $lang . '/xslt/biblioexport'; $xslfilename = $dir . "/" . $xslfilename; } elsif ($xslsyspref eq "OPACXSLTCustomExport") { my $dir; $dir = C4::Context->config('opachtdocs') . '/' . C4::Context->preference("opacthemes") . - '/' . C4::Languages::getlanguage() . + '/' . $lang . '/xslt/biblioexport'; $xslfilename = $dir . "/" . $xslfilename; } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) { @@ -209,11 +209,12 @@ sub XSLTParse4Display { my $hidden_items = $params->{hidden_items} || []; my $variables = $params->{xslt_variables}; my $items_rs = $params->{items_rs}; + my $xslfilename = $params->{xslfilename}; die "Mandatory \$params->{xsl_syspref} was not provided, called with biblionumber $params->{biblionumber}" if not defined $params->{xsl_syspref}; - my $xslfilename = get_xsl_filename( $xslsyspref); + $xslfilename = get_xsl_filename( $xslsyspref, $xslfilename); my $frameworkcode = GetFrameworkCode($biblionumber) || ''; my $record_processor = Koha::RecordProcessor->new( @@ -237,7 +238,7 @@ sub XSLTParse4Display { my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); my $biblio; - my $variables ||= {}; + $variables ||= {}; if (C4::Context->preference('OPACShowOpenURL')) { my @biblio_itemtypes; --- a/basket/downloadcart.pl +++ a/basket/downloadcart.pl @@ -80,7 +80,15 @@ if ($bib_list && $format) { $output .= marc2bibtex($record, $biblionumber); } elsif ($format =~ /^xsl\.(.*)$/) { - $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, , '', $1, ''); + $output .= XSLTParse4Display( + { + biblionumber => $biblio, + record => $record, + xsl_syspref => "XSLTCustomExport", + fix_amps => 1, + hidden_items => undef, + } + ); } } } --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -40,7 +40,7 @@ use C4::XISBN qw( get_xisbns ); use C4::External::Amazon qw( get_amazon_tld ); use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra ); use C4::Tags qw( get_tags ); -use C4::XSLT qw( XSLTParse4Display ); +use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList ); use Koha::DateUtils qw( format_sqldatetime ); use C4::HTML5Media; use C4::CourseReserves qw( GetItemCourseReservesInfo ); --- a/catalogue/export.pl +++ a/catalogue/export.pl @@ -7,7 +7,7 @@ use C4::Output; use C4::Biblio qw( GetMarcControlnumber ); use CGI qw ( -utf8 ); use C4::Ris qw( marc2ris ); -use C4::XSLT; +use C4::XSLT qw( XSLTParse4Display ); @@ -96,7 +96,16 @@ if ($op eq "export") { my $format=$query->param("format")||'txt'; my @hiddenitems; - $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, '', $xslFile,''); + $marc = XSLTParse4Display( + { + biblionumber => $biblionumber, + record => $marc, + xsl_syspref => "XSLTCustomExport", + fix_amps => 1, + hidden_items => \@hiddenitems, + xslfilename => $xslFile, + } + ); print $query->header( -type => 'application/octet-stream', -attachment=>"bib-$biblionumber.$format"); --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -58,7 +58,7 @@ use C4::External::Syndetics qw( get_syndetics_toc ); use C4::Members; -use C4::XSLT qw( XSLTParse4Display ); +use C4::XSLT qw( XSLTParse4Display CustomXSLTExportList ); use C4::ShelfBrowser qw( GetNearbyItems ); use C4::Reserves qw( GetReserveStatus ); use C4::Charset qw( SetUTF8Flag ); --- a/opac/opac-downloadcart.pl +++ a/opac/opac-downloadcart.pl @@ -117,7 +117,15 @@ if ($bib_list && $format) { $type = "text/plain"; } elsif ($format =~ /^xsl\.(.*)$/) { - $output .= XSLTParse4Display($biblio, $record, 'OPACXSLTCustomExport', 1, undef, undef, $1, ''); + $output .= XSLTParse4Display( + { + biblionumber => $biblio, + record => $record, + xsl_syspref => "OPACXSLTCustomExport", + fix_amps => 1, + hidden_items => undef, + } + ); } } } --- a/opac/opac-downloadshelf.pl +++ a/opac/opac-downloadshelf.pl @@ -125,8 +125,16 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { $extension = "txt"; $type = "text/plain"; }elsif ($format =~ /^xsl\.(.*)$/){ - $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, undef, $1, '', 1); - } + $output .= XSLTParse4Display( + { + biblionumber => $biblionumber, + record => $record, + xsl_syspref => "XSLTCustomExport", + fix_amps => 1, + hidden_items => undef, + } + ); + } } } --- a/opac/opac-export.pl +++ a/opac/opac-export.pl @@ -145,7 +145,16 @@ elsif ($format =~ /html/ ) { $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber}); my @hiddenitems; - $marc = XSLTParse4Display($biblionumber, $marc, 'OPACXSLTCustomExport', 1, \@hiddenitems, undef, $xslFile, undef); + $marc = XSLTParse4Display( + { + biblionumber => $biblionumber, + record => $marc, + xsl_syspref => "OPACXSLTCustomExport", + fix_amps => 1, + hidden_items => \@hiddenitems, + xslfilename => $xslFile, + } + ); } } else { --- a/virtualshelves/downloadshelf.pl +++ a/virtualshelves/downloadshelf.pl @@ -82,7 +82,15 @@ if ($shelfid && $format) { $output .= marc2bibtex($record, $biblionumber); } elsif ($format =~ /^xsl\.(.*)$/){ - $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, ,'',$1,''); + $output .= XSLTParse4Display( + { + biblionumber => $biblionumber, + record => $record, + xsl_syspref => 'XSLTCustomExport', + fix_amps => 1, + hidden_items => undef, + } + ); } } } --