|
Lines 9-25
use C4::Context;
Link Here
|
| 9 |
|
9 |
|
| 10 |
use Test::More tests => 57; |
10 |
use Test::More tests => 57; |
| 11 |
use MARC::Record; |
11 |
use MARC::Record; |
| 12 |
use C4::Items; |
12 |
|
| 13 |
use C4::Biblio; |
13 |
use C4::Biblio; |
| 14 |
use C4::Reserves; |
|
|
| 15 |
use C4::Calendar; |
14 |
use C4::Calendar; |
|
|
15 |
use C4::Items; |
| 16 |
use C4::Reserves; |
| 16 |
|
17 |
|
| 17 |
use Koha::Database; |
|
|
| 18 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
| 19 |
use Koha::Biblios; |
18 |
use Koha::Biblios; |
| 20 |
use Koha::CirculationRules; |
19 |
use Koha::CirculationRules; |
|
|
20 |
use Koha::Database; |
| 21 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
| 21 |
use Koha::Holds; |
22 |
use Koha::Holds; |
| 22 |
use Koha::IssuingRules; |
23 |
use Koha::IssuingRules; |
|
|
24 |
use Koha::Item::Transfer::Limits; |
| 23 |
use Koha::Items; |
25 |
use Koha::Items; |
| 24 |
use Koha::Libraries; |
26 |
use Koha::Libraries; |
| 25 |
use Koha::Patrons; |
27 |
use Koha::Patrons; |
|
Lines 490-496
subtest 'Test max_holds per library/patron category' => sub {
Link Here
|
| 490 |
}; |
492 |
}; |
| 491 |
|
493 |
|
| 492 |
subtest 'Pickup location availability tests' => sub { |
494 |
subtest 'Pickup location availability tests' => sub { |
| 493 |
plan tests => 3; |
495 |
plan tests => 4; |
| 494 |
|
496 |
|
| 495 |
my ( $bibnum, $title, $bibitemnum ) = create_helper_biblio('ONLY1'); |
497 |
my ( $bibnum, $title, $bibitemnum ) = create_helper_biblio('ONLY1'); |
| 496 |
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) |
498 |
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) |
|
Lines 505-517
subtest 'Pickup location availability tests' => sub {
Link Here
|
| 505 |
my $item = Koha::Items->find($itemnumber); |
507 |
my $item = Koha::Items->find($itemnumber); |
| 506 |
my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode }; |
508 |
my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode }; |
| 507 |
my $library = Koha::Libraries->find($branch_to); |
509 |
my $library = Koha::Libraries->find($branch_to); |
|
|
510 |
$library->pickup_location('1')->store; |
| 508 |
my $patron = $builder->build({ source => 'Borrower' })->{ borrowernumber }; |
511 |
my $patron = $builder->build({ source => 'Borrower' })->{ borrowernumber }; |
| 509 |
|
512 |
|
| 510 |
t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1); |
513 |
t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1); |
| 511 |
t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype'); |
514 |
t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype'); |
|
|
515 |
|
| 512 |
$library->pickup_location('1')->store; |
516 |
$library->pickup_location('1')->store; |
| 513 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to)->{status}, |
517 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to)->{status}, |
| 514 |
'OK', 'Library is a pickup location'); |
518 |
'OK', 'Library is a pickup location'); |
|
|
519 |
|
| 520 |
my $limit = Koha::Item::Transfer::Limit->new({ |
| 521 |
fromBranch => $item->holdingbranch, |
| 522 |
toBranch => $branch_to, |
| 523 |
itemtype => $item->effective_itemtype, |
| 524 |
})->store; |
| 525 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to), |
| 526 |
'cannotBeTransferred', 'Item cannot be transferred'); |
| 527 |
$limit->delete; |
| 528 |
|
| 515 |
$library->pickup_location('0')->store; |
529 |
$library->pickup_location('0')->store; |
| 516 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to)->{status}, |
530 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to)->{status}, |
| 517 |
'libraryNotPickupLocation', 'Library is not a pickup location'); |
531 |
'libraryNotPickupLocation', 'Library is not a pickup location'); |
| 518 |
- |
|
|