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

(-)a/C4/Search.pm (-3 / +10 lines)
Lines 1864-1869 sub searchResults { Link Here
1864
    # We get the biblionumber position in MARC
1864
    # We get the biblionumber position in MARC
1865
    my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
1865
    my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
1866
1866
1867
    # set stuff for XSLT processing here once, not later again for every record we retrieved
1868
    my $interface = $search_context eq 'opac' ? 'OPAC' : '';
1869
    my $xslsyspref = $interface . "XSLTResultsDisplay";
1870
    my $xslfile = C4::Context->preference($xslsyspref);
1871
    my $lang = C4::Languages::getlanguage();
1872
    my ($sysxml) = C4::XSLT::_get_xslt_sysprefs();
1873
1867
    # loop through all of the records we've retrieved
1874
    # loop through all of the records we've retrieved
1868
    for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) {
1875
    for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) {
1869
1876
Lines 2192-2200 sub searchResults { Link Here
2192
        }
2199
        }
2193
2200
2194
        # XSLT processing of some stuff
2201
        # XSLT processing of some stuff
2195
        my $interface = $search_context eq 'opac' ? 'OPAC' : '';
2202
        # we fetched the sysprefs already before the loop through all retrieved record!
2196
        if (!$scan && C4::Context->preference($interface . "XSLTResultsDisplay")) {
2203
        if (!$scan && $xslfile) {
2197
            $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $interface."XSLTResultsDisplay", 1, \@hiddenitems);
2204
            $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile);
2198
        # the last parameter tells Koha to clean up the problematic ampersand entities that Zebra outputs
2205
        # the last parameter tells Koha to clean up the problematic ampersand entities that Zebra outputs
2199
        }
2206
        }
2200
2207
(-)a/C4/XSLT.pm (-25 / +29 lines)
Lines 157-169 sub _get_best_default_xslt_filename { Link Here
157
    return $xslfilename;
157
    return $xslfilename;
158
}
158
}
159
159
160
sub _get_xslt_sysprefs {
161
    my $sysxml = "<sysprefs>\n";
162
    foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
163
                              DisplayOPACiconsXSLT URLLinkText viewISBD
164
                              OPACBaseURL TraceCompleteSubfields UseICU
165
                              UseAuthoritiesForTracings TraceSubjectSubdivisions
166
                              Display856uAsImage OPACDisplay856uAsImage
167
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
168
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
169
                              AlternateHoldingsField AlternateHoldingsSeparator
170
                              TrackClicks opacthemes IdRef / )
171
    {
172
        my $sp = C4::Context->preference( $syspref );
173
        next unless defined($sp);
174
        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
175
    }
176
177
    # singleBranchMode was a system preference, but no longer is
178
    # we can retain it here for compatibility
179
    my $singleBranchMode = Koha::Libraries->search->count == 1;
180
    $sysxml .= "<syspref name=\"singleBranchMode\">$singleBranchMode</syspref>\n";
181
182
    $sysxml .= "</sysprefs>\n";
183
    return $sysxml;
184
}
185
160
sub XSLTParse4Display {
186
sub XSLTParse4Display {
161
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_;
187
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang ) = @_;
162
    my $xslfilename = C4::Context->preference($xslsyspref);
188
    #my $xslfilename = C4::Context->preference($xslsyspref);
163
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
189
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
164
        my $htdocs;
190
        my $htdocs;
165
        my $theme;
191
        my $theme;
166
        my $lang = C4::Languages::getlanguage();
192
        # my $lang = C4::Languages::getlanguage();
167
        my $xslfile;
193
        my $xslfile;
168
        if ($xslsyspref eq "XSLTDetailsDisplay") {
194
        if ($xslsyspref eq "XSLTDetailsDisplay") {
169
            $htdocs  = C4::Context->config('intrahtdocs');
195
            $htdocs  = C4::Context->config('intrahtdocs');
Lines 198-225 sub XSLTParse4Display { Link Here
198
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
224
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
199
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
225
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
200
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
226
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
201
    my $sysxml = "<sysprefs>\n";
202
    foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
203
                              DisplayOPACiconsXSLT URLLinkText viewISBD
204
                              OPACBaseURL TraceCompleteSubfields UseICU
205
                              UseAuthoritiesForTracings TraceSubjectSubdivisions
206
                              Display856uAsImage OPACDisplay856uAsImage 
207
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
208
                              OPACItemLocation DisplayIconsXSLT
209
                              AlternateHoldingsField AlternateHoldingsSeparator
210
                              TrackClicks opacthemes IdRef / )
211
    {
212
        my $sp = C4::Context->preference( $syspref );
213
        next unless defined($sp);
214
        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
215
    }
216
217
    # singleBranchMode was a system preference, but no longer is
218
    # we can retain it here for compatibility
219
    my $singleBranchMode = Koha::Libraries->search->count == 1;
220
    $sysxml .= "<syspref name=\"singleBranchMode\">$singleBranchMode</syspref>\n";
221
227
222
    $sysxml .= "</sysprefs>\n";
223
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
228
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
224
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
229
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
225
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
230
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
226
- 

Return to bug 15263