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

(-)a/C4/ILSDI/Services.pm (-13 / +16 lines)
Lines 419-444 sub GetPatronInfo { Link Here
419
        my $holds = $patron->holds;
419
        my $holds = $patron->holds;
420
        while ( my $hold = $holds->next ) {
420
        while ( my $hold = $holds->next ) {
421
421
422
            my $unblessed_hold = $hold->unblessed;
422
            my ( $item, $biblio, $biblioitem ) = ( {}, {}, {} );
423
            # Get additional informations
423
            # Get additional informations
424
            my $item = Koha::Items->find( $hold->itemnumber );
424
            if ( $hold->itemnumber ) {    # item level holds
425
            my $biblio = $item->biblio;
425
                $item       = Koha::Items->find( $hold->itemnumber );
426
            my $biblioitem = $biblio->biblioitem;
426
                $biblio     = $item->biblio;
427
            my $library = Koha::Libraries->find( $hold->branchcode ); # Should $hold->get_library
427
                $biblioitem = $biblio->biblioitem;
428
            my $branchname = $library ? $library->branchname : '';
428
429
429
                # Remove unwanted fields
430
            # Remove unwanted fields
430
                $item = $item->unblessed;
431
            $item = $item->unblessed;
431
                delete $item->{more_subfields_xml};
432
            delete $item->{'more_subfields_xml'};
432
                $biblio     = $biblio->unblessed;
433
            $biblio = $biblio->unblessed;
433
                $biblioitem = $biblioitem->unblessed;
434
            $biblioitem = $biblioitem->unblessed;
434
            }
435
435
436
            # Add additional fields
436
            # Add additional fields
437
            my $unblessed_hold = $hold->unblessed;
437
            $unblessed_hold->{item}       = { %$item, %$biblio, %$biblioitem };
438
            $unblessed_hold->{item}       = { %$item, %$biblio, %$biblioitem };
439
            my $library = Koha::Libraries->find( $hold->branchcode );
440
            my $branchname = $library ? $library->branchname : '';
438
            $unblessed_hold->{branchname} = $branchname;
441
            $unblessed_hold->{branchname} = $branchname;
439
            $unblessed_hold->{title}      = GetBiblio( $hold->biblionumber )->{'title'}; # Should be $hold->get_biblio
442
            $unblessed_hold->{title}      = GetBiblio( $hold->biblionumber )->{'title'}; # Should be $hold->get_biblio
440
443
441
            push @{ $borrower->{holds}{hold} }, $unblessed_hold;
444
            push @{ $borrower->{holds}{hold} }, $unblessed_hold;
445
442
        }
446
        }
443
    }
447
    }
444
448
445
- 

Return to bug 18276