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

(-)a/C4/XSLT.pm (-9 / +16 lines)
Lines 297-310 Is only used in this module currently. Link Here
297
sub buildKohaItemsNamespace {
297
sub buildKohaItemsNamespace {
298
    my ($biblionumber, $hidden_items) = @_;
298
    my ($biblionumber, $hidden_items) = @_;
299
299
300
    $hidden_items ||= [];
300
    if ( ref $hidden_items eq 'Koha::Items' ) {
301
    my @items = Koha::Items->search(
301
        $items = $items->search(
302
        {
302
            {},
303
            'me.biblionumber' => $biblionumber,
303
            { prefetch => [ 'branchtransfers', 'reserves' ] }
304
            'me.itemnumber'   => { not_in => $hidden_items }
304
        );
305
        },
305
    } else {
306
        { prefetch => [ 'branchtransfers', 'reserves' ] }
306
        $hidden_items ||= [];
307
    );
307
308
        $items = Koha::Items->search(
309
            {
310
                'me.biblionumber' => $biblionumber,
311
                'me.itemnumber'   => { not_in => $hidden_items }
312
            { prefetch => [ 'branchtransfers', 'reserves' ] }
313
        );
314
    }
308
315
309
    my $shelflocations =
316
    my $shelflocations =
310
      { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) };
317
      { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) };
Lines 318-324 sub buildKohaItemsNamespace { Link Here
318
    my %descs = map { $_->{authorised_value} => $_ } Koha::AuthorisedValues->get_descriptions_by_koha_field( { kohafield => 'items.notforloan' } );
325
    my %descs = map { $_->{authorised_value} => $_ } Koha::AuthorisedValues->get_descriptions_by_koha_field( { kohafield => 'items.notforloan' } );
319
    my $ref_status = C4::Context->preference('Reference_NFL_Statuses') || '1|2';
326
    my $ref_status = C4::Context->preference('Reference_NFL_Statuses') || '1|2';
320
327
321
    for my $item (@items) {
328
    while ( my $item = $items->next ) {
322
        my $status;
329
        my $status;
323
        my $substatus = '';
330
        my $substatus = '';
324
331
(-)a/opac/opac-shelves.pl (-11 / +5 lines)
Lines 346-368 if ( $op eq 'view' ) { Link Here
346
                    });
346
                    });
347
                }
347
                }
348
348
349
                my @items;
349
                my $items = $biblio->items->filter_by_visible_in_opac({ patron => $patron });
350
                my $items = $biblio->items;
351
                my $allow_onshelf_holds;
350
                my $allow_onshelf_holds;
352
                my @hidden_items;
353
                while ( my $item = $items->next ) {
351
                while ( my $item = $items->next ) {
354
                    if ( $item->hidden_in_opac({rules => C4::Context->yaml_preference('OpacHiddenItems')} ) ) {
355
                        push @hidden_items, $item->itemnumber;
356
                        next;
357
                    }
358
352
353
                    # This method must take a Koha::Items rs
359
                    $allow_onshelf_holds ||= Koha::CirculationRules->get_onshelfholds_policy(
354
                    $allow_onshelf_holds ||= Koha::CirculationRules->get_onshelfholds_policy(
360
                        { item => $item, patron => $patron } );
355
                        { item => $item, patron => $patron } );
361
356
362
                    push @items, $item; # This is for non-xslt only
363
                }
357
                }
358
364
                $this_item->{allow_onshelf_holds} = $allow_onshelf_holds;
359
                $this_item->{allow_onshelf_holds} = $allow_onshelf_holds;
365
                $this_item->{'ITEM_RESULTS'} = \@items;
360
                $this_item->{'ITEM_RESULTS'} = $items;
366
361
367
                if ($xslfile) {
362
                if ($xslfile) {
368
                    my $variables = {
363
                    my $variables = {
Lines 371-377 if ( $op eq 'view' ) { Link Here
371
                    $this_item->{XSLTBloc} = XSLTParse4Display(
366
                    $this_item->{XSLTBloc} = XSLTParse4Display(
372
                        $biblionumber,          $record,
367
                        $biblionumber,          $record,
373
                        "OPACXSLTListsDisplay", 1,
368
                        "OPACXSLTListsDisplay", 1,
374
                        \@hidden_items,         $sysxml,
369
                        $items,                 $sysxml,
375
                        $xslfile,               $lang,
370
                        $xslfile,               $lang,
376
                        $variables
371
                        $variables
377
                    );
372
                    );
378
- 

Return to bug 28299