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

(-)a/Koha/Biblio.pm (-5 / +6 lines)
Lines 205-214 sub can_be_transferred { Link Here
205
205
206
=head3 pickup_locations
206
=head3 pickup_locations
207
207
208
@pickup_locations = $biblio->pickup_locations( {patron => $patron } )
208
    my $pickup_locations = $biblio->pickup_locations( {patron => $patron } );
209
209
210
Returns possible pickup locations for this biblio items, according to patron's home library (if patron is defined and holds are allowed only from hold groups)
210
Returns an I<arrayref> of possible pickup locations for this biblio's items,
211
and if item can be transferred to each pickup location.
211
according to patron's home library (if patron is defined and holds are allowed
212
only from hold groups) and if item can be transferred to each pickup location.
212
213
213
=cut
214
=cut
214
215
Lines 219-232 sub pickup_locations { Link Here
219
220
220
    my @pickup_locations;
221
    my @pickup_locations;
221
    foreach my $item_of_bib ($self->items->as_list) {
222
    foreach my $item_of_bib ($self->items->as_list) {
222
        push @pickup_locations, $item_of_bib->pickup_locations( {patron => $patron} );
223
        push @pickup_locations, @{ $item_of_bib->pickup_locations( {patron => $patron} ) };
223
    }
224
    }
224
225
225
    my %seen;
226
    my %seen;
226
    @pickup_locations =
227
    @pickup_locations =
227
      grep { !$seen{ $_->branchcode }++ } @pickup_locations;
228
      grep { !$seen{ $_->branchcode }++ } @pickup_locations;
228
229
229
    return wantarray ? @pickup_locations : \@pickup_locations;
230
    return \@pickup_locations;
230
}
231
}
231
232
232
=head3 hidden_in_opac
233
=head3 hidden_in_opac
(-)a/Koha/Item.pm (-3 / +3 lines)
Lines 551-558 sub pickup_locations { Link Here
551
551
552
    my @libs;
552
    my @libs;
553
    if(defined $patron) {
553
    if(defined $patron) {
554
        return @libs if $branchitemrule->{holdallowed} == 3 && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} );
554
        return \@libs if $branchitemrule->{holdallowed} == 3 && !$self->home_branch->validate_hold_sibling( {branchcode => $patron->branchcode} );
555
        return @libs if $branchitemrule->{holdallowed} == 1 && $self->home_branch->branchcode ne $patron->branchcode;
555
        return \@libs if $branchitemrule->{holdallowed} == 1 && $self->home_branch->branchcode ne $patron->branchcode;
556
    }
556
    }
557
557
558
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
558
    if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup') {
Lines 581-587 sub pickup_locations { Link Here
581
        }
581
        }
582
    }
582
    }
583
583
584
    return wantarray ? @pickup_locations : \@pickup_locations;
584
    return \@pickup_locations;
585
}
585
}
586
586
587
=head3 article_request_type
587
=head3 article_request_type
(-)a/t/db_dependent/Koha/Biblio.t (-1 / +1 lines)
Lines 398-404 subtest 'pickup_locations' => sub { Link Here
398
        my ( $cbranch, $biblio, $patron, $results ) = @_;
398
        my ( $cbranch, $biblio, $patron, $results ) = @_;
399
        t::lib::Mocks::mock_preference('ReservesControlBranch', $cbranch);
399
        t::lib::Mocks::mock_preference('ReservesControlBranch', $cbranch);
400
400
401
        my @pl = $biblio->pickup_locations( { patron => $patron} );
401
        my @pl = @{ $biblio->pickup_locations( { patron => $patron} ) };
402
402
403
        foreach my $pickup_location (@pl) {
403
        foreach my $pickup_location (@pl) {
404
            is( ref($pickup_location), 'Koha::Library', 'Object type is correct' );
404
            is( ref($pickup_location), 'Koha::Library', 'Object type is correct' );
(-)a/t/db_dependent/Koha/Item.t (-2 / +1 lines)
Lines 292-298 subtest 'pickup_locations' => sub { Link Here
292
                }
292
                }
293
            }
293
            }
294
        );
294
        );
295
        my @pl = $item->pickup_locations( { patron => $patron} );
295
        my @pl = @{ $item->pickup_locations( { patron => $patron} ) };
296
        my $ha_value=$ha==3?'holdgroup':($ha==2?'any':'homebranch');
296
        my $ha_value=$ha==3?'holdgroup':($ha==2?'any':'homebranch');
297
297
298
        foreach my $pickup_location (@pl) {
298
        foreach my $pickup_location (@pl) {
299
- 

Return to bug 25421