View | Details | Raw Unified | Return to bug 28371
Collapse All | Expand All

(-)a/C4/Search.pm (-1 / +1 lines)
Lines 2019-2025 sub searchResults { Link Here
2019
            });
2019
            });
2020
2020
2021
            $record_processor->process($marcrecord);
2021
            $record_processor->process($marcrecord);
2022
            $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang, $xslt_variables);
2022
            $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang, $xslt_variables, $fw);
2023
        }
2023
        }
2024
2024
2025
        # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
2025
        # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
(-)a/C4/XSLT.pm (-7 / +14 lines)
Lines 40-45 use vars qw(@ISA @EXPORT); Link Here
40
40
41
my $engine; #XSLT Handler object
41
my $engine; #XSLT Handler object
42
my %authval_per_framework;
42
my %authval_per_framework;
43
my %authval_descs;
43
    # Cache for tagfield-tagsubfield to decode per framework.
44
    # Cache for tagfield-tagsubfield to decode per framework.
44
    # Should be preferably be placed in Koha-core...
45
    # Should be preferably be placed in Koha-core...
45
46
Lines 66-73 Is only used in this module currently. Link Here
66
=cut
67
=cut
67
68
68
sub transformMARCXML4XSLT {
69
sub transformMARCXML4XSLT {
69
    my ($biblionumber, $record) = @_;
70
    my ($biblionumber, $record, $frameworkcode ) = @_;
70
    my $frameworkcode = GetFrameworkCode($biblionumber) || '';
71
    $frameworkcode //= GetFrameworkCode($biblionumber) || '';
71
    my $tagslib = &GetMarcStructure(1, $frameworkcode, { unsafe => 1 });
72
    my $tagslib = &GetMarcStructure(1, $frameworkcode, { unsafe => 1 });
72
    my @fields;
73
    my @fields;
73
    # FIXME: wish there was a better way to handle exceptions
74
    # FIXME: wish there was a better way to handle exceptions
Lines 85-92 sub transformMARCXML4XSLT { Link Here
85
                    my ( $letter, $value ) = @$subfield;
86
                    my ( $letter, $value ) = @$subfield;
86
                    # Replace the field value with the authorised value *except* for MARC21/NORMARC field 942$n (suppression in opac)
87
                    # Replace the field value with the authorised value *except* for MARC21/NORMARC field 942$n (suppression in opac)
87
                    if ( !( $tag eq '942' && $subfield->[0] eq 'n' ) || $marcflavour eq 'UNIMARC' ) {
88
                    if ( !( $tag eq '942' && $subfield->[0] eq 'n' ) || $marcflavour eq 'UNIMARC' ) {
88
                        $value = GetAuthorisedValueDesc( $tag, $letter, $value, '', $tagslib )
89
                        if( defined $authval_descs{$frameworkcode.$tag.$letter.$value} ){
89
                            if $av->{ $tag }->{ $letter };
90
                            $value = $authval_descs{$frameworkcode.$tag.$letter.$value};
91
                        } else {
92
                            if( $av->{$tag}->{$letter} ){
93
                                my $orig_val = $value;
94
                                $value = GetAuthorisedValueDesc( $tag, $letter, $value, '', $tagslib );
95
                                $authval_descs{$frameworkcode.$tag.$letter.$orig_val} = $value;
96
                            }
97
                        }
90
                    }
98
                    }
91
                    push( @new_subfields, $letter, $value );
99
                    push( @new_subfields, $letter, $value );
92
                } 
100
                } 
Lines 190-196 sub get_xslt_sysprefs { Link Here
190
}
198
}
191
199
192
sub XSLTParse4Display {
200
sub XSLTParse4Display {
193
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables ) = @_;
201
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables, $frameworkcode ) = @_;
194
202
195
    $sysxml ||= C4::Context->preference($xslsyspref);
203
    $sysxml ||= C4::Context->preference($xslsyspref);
196
    $xslfilename ||= C4::Context->preference($xslsyspref);
204
    $xslfilename ||= C4::Context->preference($xslsyspref);
Lines 241-247 sub XSLTParse4Display { Link Here
241
    }
249
    }
242
250
243
    # grab the XML, run it through our stylesheet, push it out to the browser
251
    # grab the XML, run it through our stylesheet, push it out to the browser
244
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
252
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record, $frameworkcode);
245
    my $itemsxml;
253
    my $itemsxml;
246
    if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) {
254
    if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) {
247
        $itemsxml = ""; #We don't use XSLT for items display on these pages
255
        $itemsxml = ""; #We don't use XSLT for items display on these pages
248
- 

Return to bug 28371