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

(-)a/Koha/REST/V1/Holds.pm (-1 / +1 lines)
Lines 419-425 sub pickup_locations { Link Here
419
        my @pickup_locations =
419
        my @pickup_locations =
420
            $hold->itemnumber
420
            $hold->itemnumber
421
          ? @{ $hold->item->pickup_locations( { patron => $hold->patron } )->as_list() }
421
          ? @{ $hold->item->pickup_locations( { patron => $hold->patron } )->as_list() }
422
          : @{ $hold->biblio->pickup_locations( { patron => $hold->patron } ) };
422
          : @{ $hold->biblio->pickup_locations( { patron => $hold->patron } )->as_list() };
423
423
424
        @pickup_locations = map { $_->to_api } @pickup_locations;
424
        @pickup_locations = map { $_->to_api } @pickup_locations;
425
425
(-)a/Koha/Template/Plugin/Branches.pm (-2 / +2 lines)
Lines 123-135 sub pickup_locations { Link Here
123
        elsif ($biblio) {
123
        elsif ($biblio) {
124
            $biblio = Koha::Biblios->find($biblio)
124
            $biblio = Koha::Biblios->find($biblio)
125
              unless ref($biblio) eq 'Koha::Biblio';
125
              unless ref($biblio) eq 'Koha::Biblio';
126
            @libraries = @{ $biblio->pickup_locations( { patron => $patron } ) }
126
            @libraries = $biblio->pickup_locations( { patron => $patron } )
127
              if defined $biblio;
127
              if defined $biblio;
128
        }
128
        }
129
    }
129
    }
130
130
131
    @libraries = Koha::Libraries->search( { pickup_location => 1 },
131
    @libraries = Koha::Libraries->search( { pickup_location => 1 },
132
        { order_by => ['branchname'] } )->as_list
132
        { order_by => ['branchname'] } )
133
      unless @libraries;
133
      unless @libraries;
134
134
135
    @libraries = map { $_->unblessed } @libraries;
135
    @libraries = map { $_->unblessed } @libraries;
(-)a/t/db_dependent/Koha/Biblio.t (-1 / +1 lines)
Lines 387-393 subtest 'pickup_locations' => sub { Link Here
387
        my ( $cbranch, $biblio, $patron, $results ) = @_;
387
        my ( $cbranch, $biblio, $patron, $results ) = @_;
388
        t::lib::Mocks::mock_preference('ReservesControlBranch', $cbranch);
388
        t::lib::Mocks::mock_preference('ReservesControlBranch', $cbranch);
389
389
390
        my @pl = @{ $biblio->pickup_locations( { patron => $patron} ) };
390
        my @pl = $biblio->pickup_locations( { patron => $patron } );
391
391
392
        foreach my $pickup_location (@pl) {
392
        foreach my $pickup_location (@pl) {
393
            is( ref($pickup_location), 'Koha::Library', 'Object type is correct' );
393
            is( ref($pickup_location), 'Koha::Library', 'Object type is correct' );
(-)a/t/db_dependent/Template/Plugin/Branches.t (-2 / +2 lines)
Lines 155-161 subtest 'pickup_locations() tests' => sub { Link Here
155
    $biblio_class->mock(
155
    $biblio_class->mock(
156
        'pickup_locations',
156
        'pickup_locations',
157
        sub {
157
        sub {
158
            return [$library_2];
158
            return Koha::Libraries->search(
159
                { branchcode => $library_2->branchcode } );
159
        }
160
        }
160
    );
161
    );
161
162
162
- 

Return to bug 27002