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

(-)a/C4/XSLT.pm (-17 / +24 lines)
Lines 190-196 sub get_xslt_sysprefs { Link Here
190
}
190
}
191
191
192
sub XSLTParse4Display {
192
sub XSLTParse4Display {
193
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables ) = @_;
193
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables, $items_rs ) = @_;
194
194
195
    $sysxml ||= C4::Context->preference($xslsyspref);
195
    $sysxml ||= C4::Context->preference($xslsyspref);
196
    $xslfilename ||= C4::Context->preference($xslsyspref);
196
    $xslfilename ||= C4::Context->preference($xslsyspref);
Lines 246-252 sub XSLTParse4Display { Link Here
246
    if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) {
246
    if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) {
247
        $itemsxml = ""; #We don't use XSLT for items display on these pages
247
        $itemsxml = ""; #We don't use XSLT for items display on these pages
248
    } else {
248
    } else {
249
        $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items);
249
        $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items, $items_rs);
250
    }
250
    }
251
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
251
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
252
252
Lines 289-316 sub XSLTParse4Display { Link Here
289
289
290
=head2 buildKohaItemsNamespace
290
=head2 buildKohaItemsNamespace
291
291
292
Returns XML for items.
292
    my $items_xml = buildKohaItemsNamespace( $biblionumber, [ $hidden_items, $items ] );
293
294
Returns XML for items. It accepts two optional parameters:
295
- I<$hidden_items>: An arrayref of itemnumber values, for items that should be hidden
296
- I<$items>: A Koha::Items resultset, for the items to be returned
297
298
If both parameters are passed, I<$items> is used as the basis resultset, and I<$hidden_items>
299
are filtered out of it.
300
293
Is only used in this module currently.
301
Is only used in this module currently.
294
302
295
=cut
303
=cut
296
304
297
sub buildKohaItemsNamespace {
305
sub buildKohaItemsNamespace {
298
    my ($biblionumber, $hidden_items) = @_;
306
    my ($biblionumber, $hidden_items, $items_rs) = @_;
307
308
    $hidden_items ||= [];
309
310
    my $query = {};
311
    $query = { 'me.itemnumber' => { not_in => $hidden_items } }
312
      if $hidden_items;
313
314
    my $items;
299
315
300
    if ( ref $hidden_items eq 'Koha::Items' ) {
316
    if ( $items_rs && ref($items_rs) eq 'Koha::Items' ) {
301
        $items = $items->search(
317
        $items = $items_rs->search( $query, { prefetch => [ 'branchtransfers', 'reserves' ] } );
302
            {},
303
            { prefetch => [ 'branchtransfers', 'reserves' ] }
304
        );
305
    } else {
318
    } else {
306
        $hidden_items ||= [];
319
        $query->{'me.biblionumber'} = $biblionumber;
307
320
        $items = Koha::Items->search( $query, { prefetch => [ 'branchtransfers', 'reserves' ] } );
308
        $items = Koha::Items->search(
309
            {
310
                'me.biblionumber' => $biblionumber,
311
                'me.itemnumber'   => { not_in => $hidden_items }
312
            { prefetch => [ 'branchtransfers', 'reserves' ] }
313
        );
314
    }
321
    }
315
322
316
    my $shelflocations =
323
    my $shelflocations =
(-)a/opac/opac-shelves.pl (-4 / +3 lines)
Lines 366-374 if ( $op eq 'view' ) { Link Here
366
                    $this_item->{XSLTBloc} = XSLTParse4Display(
366
                    $this_item->{XSLTBloc} = XSLTParse4Display(
367
                        $biblionumber,          $record,
367
                        $biblionumber,          $record,
368
                        "OPACXSLTListsDisplay", 1,
368
                        "OPACXSLTListsDisplay", 1,
369
                        $items,                 $sysxml,
369
                        undef,                 $sysxml,
370
                        $xslfile,               $lang,
370
                        $xslfile,              $lang,
371
                        $variables
371
                        $variables,            $items->reset
372
                    );
372
                    );
373
                }
373
                }
374
374
375
- 

Return to bug 28299