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

(-)a/C4/XSLT.pm (-10 / +19 lines)
Lines 259-265 sub XSLTParse4Display { Link Here
259
    if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) {
259
    if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) {
260
        $itemsxml = ""; #We don't use XSLT for items display on these pages
260
        $itemsxml = ""; #We don't use XSLT for items display on these pages
261
    } else {
261
    } else {
262
        $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items, $items_rs);
262
        $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items, $items_rs, $record);
263
    }
263
    }
264
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
264
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
265
265
Lines 319-338 Is only used in this module currently. Link Here
319
=cut
319
=cut
320
320
321
sub buildKohaItemsNamespace {
321
sub buildKohaItemsNamespace {
322
    my ($biblionumber, $hidden_items, $items_rs) = @_;
322
    my ($biblionumber, $hidden_items, $items_rs, $record) = @_;
323
323
324
    $hidden_items ||= [];
324
    $hidden_items ||= [];
325
325
326
    my $query = {};
327
    $query = { 'me.itemnumber' => { not_in => $hidden_items } }
328
      if $hidden_items;
329
330
    unless ( $items_rs && ref($items_rs) eq 'Koha::Items' ) {
326
    unless ( $items_rs && ref($items_rs) eq 'Koha::Items' ) {
331
        $query->{'me.biblionumber'} = $biblionumber;
327
        # adding linked items that belong to host records
332
        $items_rs = Koha::Items->new;
328
        my @linkeditemnumbers;
329
        if ( C4::Context->preference('EasyAnalyticalRecords') ) {
330
            my $analyticsfield = C4::Context->preference("marcflavour") eq 'UNIMARC' ? '461' : '773';
331
            @linkeditemnumbers = map { $_->subfield('9') } $record->field($analyticsfield);
332
        }
333
334
        $items_rs = Koha::Items->search(
335
            [
336
                'me.biblionumber' => $biblionumber,
337
                'me.itemnumber' => { in => \@linkeditemnumbers },
338
            ]
339
        );
333
    }
340
    }
334
341
335
    my $items = $items_rs->search( $query, { prefetch => [ 'branchtransfers', 'reserves' ] } );
342
    my $items = $items_rs->search(
343
        { 'me.itemnumber' => { not_in => $hidden_items } },
344
        { prefetch => [ 'branchtransfers', 'reserves' ] }
345
    );
336
346
337
    my $shelflocations =
347
    my $shelflocations =
338
      { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) };
348
      { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) };
339
- 

Return to bug 29606