Bug 3213 - UNIMARC/MARC21 selection
Modify how XSLT stylesheet are choosen depending on 'marcflavour' syspref. DOCUMENTATION: XSLTResultsDisplay and XSLTDetailsDisplay sysprefs aren't MARC21-only anymore. Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
parent
852bb18b1f
commit
5ef1d6ff9e
|
|
@ -1504,8 +1504,8 @@ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g;
|
|||
|
||||
# XSLT processing of some stuff
|
||||
if (C4::Context->preference("XSLTResultsDisplay") && !$scan) {
|
||||
my $newxmlrecord = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACResults.xsl");
|
||||
$oldbiblio->{XSLTResultsRecord} = $newxmlrecord;
|
||||
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display(
|
||||
$oldbiblio->{biblionumber}, $marcrecord, 'Results' );
|
||||
}
|
||||
|
||||
# last check for norequest : if itemtype is notforloan, it can't be reserved either, whatever the items
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ C4::XSLT - Functions for displaying XSLT-generated content
|
|||
sub transformMARCXML4XSLT {
|
||||
my ($biblionumber, $orig_record) = @_;
|
||||
my $record = $orig_record->clone(); # not updating original record; this may be unnecessarily paranoid
|
||||
my $biblio = GetBiblioData($biblionumber);
|
||||
my $frameworkcode = GetFrameworkCode($biblionumber);
|
||||
my $tagslib = &GetMarcStructure(1,$frameworkcode);
|
||||
my @fields;
|
||||
|
|
@ -80,7 +79,7 @@ sub transformMARCXML4XSLT {
|
|||
$authvalue->{tagfield},
|
||||
$field->indicator(1),
|
||||
$field->indicator(2),
|
||||
$authvalue->{tagsubfield} => @newSubfields
|
||||
@newSubfields
|
||||
);
|
||||
$field->replace_with($newField);
|
||||
}
|
||||
|
|
@ -120,7 +119,7 @@ sub getAuthorisedValues4MARCSubfields {
|
|||
my $stylesheet;
|
||||
|
||||
sub XSLTParse4Display {
|
||||
my ($biblionumber, $orig_record, $xslfile) = @_;
|
||||
my ( $biblionumber, $orig_record, $xsl_suffix ) = @_;
|
||||
# grab the XML, run it through our stylesheet, push it out to the browser
|
||||
my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
|
||||
my $itemsxml = buildKohaItemsNamespace($biblionumber);
|
||||
|
|
@ -132,6 +131,10 @@ sub XSLTParse4Display {
|
|||
my $source = $parser->parse_string($xmlrecord);
|
||||
unless ( $stylesheet ) {
|
||||
my $xslt = XML::LibXSLT->new();
|
||||
my $xslfile = C4::Context->config('opachtdocs') .
|
||||
"/prog/en/xslt/" .
|
||||
C4::Context->preference('marcflavour') .
|
||||
"slim2OPAC$xsl_suffix.xsl";
|
||||
my $style_doc = $parser->parse_file($xslfile);
|
||||
$stylesheet = $xslt->parse_stylesheet($style_doc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ my $record = GetMarcBiblio($biblionumber);
|
|||
$template->param( biblionumber => $biblionumber );
|
||||
# XSLT processing of some stuff
|
||||
if (C4::Context->preference("XSLTDetailsDisplay") ) {
|
||||
my $newxmlrecord = XSLTParse4Display($biblionumber, $record, C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACDetail.xsl");
|
||||
$template->param('XSLTBloc' => $newxmlrecord);
|
||||
$template->param(
|
||||
'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail') );
|
||||
}
|
||||
|
||||
$template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") );
|
||||
|
|
|
|||
Loading…
Reference in New Issue