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

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 285-291 sub CanBookBeReserved{ Link Here
285
    my $canReserve;
285
    my $canReserve;
286
    foreach my $itemnumber (@itemnumbers) {
286
    foreach my $itemnumber (@itemnumbers) {
287
        $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode );
287
        $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode );
288
        return $canReserve if $canReserve->{status} eq 'OK';
288
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
289
    }
289
    }
290
    return $canReserve;
290
    return $canReserve;
291
}
291
}
(-)a/t/db_dependent/Holds.t (-5 / +11 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 55;
10
use Test::More tests => 56;
11
use MARC::Record;
11
use MARC::Record;
12
use Koha::Patrons;
12
use Koha::Patrons;
13
use C4::Items;
13
use C4::Items;
Lines 487-492 subtest 'Pickup location availability tests' => sub { Link Here
487
    my ( $bibnum, $title, $bibitemnum ) = create_helper_biblio('ONLY1');
487
    my ( $bibnum, $title, $bibitemnum ) = create_helper_biblio('ONLY1');
488
    my ( $item_bibnum, $item_bibitemnum, $itemnumber )
488
    my ( $item_bibnum, $item_bibitemnum, $itemnumber )
489
    = AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 }, $bibnum );
489
    = AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 }, $bibnum );
490
    #Add a default rule to allow some holds
491
    $dbh->do(
492
        q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
493
          VALUES (?, ?, ?, ?, ?)},
494
        {},
495
        '*', '*', '*', 25, 99
496
    );
490
    my $item = Koha::Items->find($itemnumber);
497
    my $item = Koha::Items->find($itemnumber);
491
    my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode };
498
    my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode };
492
    my $library = Koha::Libraries->find($branch_to);
499
    my $library = Koha::Libraries->find($branch_to);
Lines 495-506 subtest 'Pickup location availability tests' => sub { Link Here
495
    t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1);
502
    t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1);
496
    t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype');
503
    t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype');
497
    $library->pickup_location('1')->store;
504
    $library->pickup_location('1')->store;
498
    is(CanItemBeReserved($patron, $item->itemnumber, $branch_to),
505
    is(CanItemBeReserved($patron, $item->itemnumber, $branch_to)->{status},
499
       'OK', 'Library is a pickup location');
506
       'OK', 'Library is a pickup location');
500
    $library->pickup_location('0')->store;
507
    $library->pickup_location('0')->store;
501
    is(CanItemBeReserved($patron, $item->itemnumber, $branch_to),
508
    is(CanItemBeReserved($patron, $item->itemnumber, $branch_to)->{status},
502
       'libraryNotPickupLocation', 'Library is not a pickup location');
509
       'libraryNotPickupLocation', 'Library is not a pickup location');
503
    is(CanItemBeReserved($patron, $item->itemnumber, 'nonexistent'),
510
    is(CanItemBeReserved($patron, $item->itemnumber, 'nonexistent')->{status},
504
       'libraryNotFound', 'Cannot set unknown library as pickup location');
511
       'libraryNotFound', 'Cannot set unknown library as pickup location');
505
};
512
};
506
513
507
- 

Return to bug 7534