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

(-)a/C4/Reserves.pm (-6 lines)
Lines 274-287 See CanItemBeReserved() for possible return values. Link Here
274
sub CanBookBeReserved{
274
sub CanBookBeReserved{
275
    my ($borrowernumber, $biblionumber, $pickup_branchcode) = @_;
275
    my ($borrowernumber, $biblionumber, $pickup_branchcode) = @_;
276
276
277
    # Check if borrower already has reserved the same biblio.
278
    my $patron = Koha::Patrons->find($borrowernumber);
277
    my $patron = Koha::Patrons->find($borrowernumber);
279
    my $holds = $patron->holds;
278
    my $holds = $patron->holds;
280
    while (my $hold = $holds->next) {
281
        if ($hold->biblionumber == $biblionumber) {
282
            return { status => 'alreadyReserved' };
283
        }
284
    }
285
279
286
    # Check if borrower has reached the maximum number of holds allowed
280
    # Check if borrower has reached the maximum number of holds allowed
287
    my $maxreserves = C4::Context->preference('maxreserves');
281
    my $maxreserves = C4::Context->preference('maxreserves');
(-)a/t/db_dependent/Holds.t (-2 / +1 lines)
Lines 369-375 is( Link Here
369
is(CanBookBeReserved($borrowernumbers[0], $bibnum), 'OK');
369
is(CanBookBeReserved($borrowernumbers[0], $bibnum), 'OK');
370
370
371
C4::Context->set_preference('maxreserves', 1);
371
C4::Context->set_preference('maxreserves', 1);
372
ok(CanBookBeReserved($borrowernumbers[0], $biblionumber) eq 'tooManyReserves');
372
is(CanBookBeReserved($borrowernumbers[0], $biblionumber), 'tooManyReserves');
373
373
374
C4::Context->set_preference('maxreserves', 0);
374
C4::Context->set_preference('maxreserves', 0);
375
t::lib::Mocks::mock_preference('IndependentBranches', 1);
375
t::lib::Mocks::mock_preference('IndependentBranches', 1);
376
- 

Return to bug 11999