|
Lines 19-24
use Koha::Database;
Link Here
|
| 19 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
19 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
| 20 |
use Koha::Biblios; |
20 |
use Koha::Biblios; |
| 21 |
use Koha::Holds; |
21 |
use Koha::Holds; |
|
|
22 |
use Koha::Item::Transfer::Limits; |
| 22 |
use Koha::Items; |
23 |
use Koha::Items; |
| 23 |
use Koha::Libraries; |
24 |
use Koha::Libraries; |
| 24 |
|
25 |
|
|
Lines 422-441
subtest 'Pickup location availability tests' => sub {
Link Here
|
| 422 |
my $item = Koha::Items->find($itemnumber); |
423 |
my $item = Koha::Items->find($itemnumber); |
| 423 |
my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode }; |
424 |
my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode }; |
| 424 |
my $library = Koha::Libraries->find($branch_to); |
425 |
my $library = Koha::Libraries->find($branch_to); |
|
|
426 |
$library->pickup_location('1')->store; |
| 425 |
my $patron = $builder->build({ source => 'Borrower' })->{ borrowernumber }; |
427 |
my $patron = $builder->build({ source => 'Borrower' })->{ borrowernumber }; |
| 426 |
|
428 |
|
| 427 |
t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1); |
429 |
t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1); |
| 428 |
t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype'); |
430 |
t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype'); |
| 429 |
$library->pickup_location('1')->store; |
431 |
|
|
|
432 |
my $limit = Koha::Item::Transfer::Limit->new({ |
| 433 |
fromBranch => $item->holdingbranch, |
| 434 |
toBranch => $branch_to, |
| 435 |
itemtype => $item->effective_itemtype, |
| 436 |
})->store; |
| 430 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to), |
437 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to), |
| 431 |
'OK', 'Library is a pickup location'); |
438 |
'cannotBeTransferred', 'Item cannot be transferred'); |
|
|
439 |
$limit->delete; |
| 432 |
$library->pickup_location('0')->store; |
440 |
$library->pickup_location('0')->store; |
| 433 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to), |
441 |
is(CanItemBeReserved($patron, $item->itemnumber, $branch_to), |
| 434 |
'libraryNotPickupLocation', 'Library is not a pickup location'); |
442 |
'libraryNotPickupLocation', 'Library is not a pickup location'); |
| 435 |
is(CanItemBeReserved($patron, $item->itemnumber, 'nonexistent'), |
443 |
is(CanItemBeReserved($patron, $item->itemnumber, 'nonexistent'), |
| 436 |
'libraryNotFound', 'Cannot set unknown library as pickup location'); |
444 |
'libraryNotFound', 'Cannot set unknown library as pickup location'); |
| 437 |
}; |
445 |
}; |
| 438 |
|
446 |
my ( $bibnum, $title, $bibitemnum ); |
| 439 |
# Helper method to set up a Biblio. |
447 |
# Helper method to set up a Biblio. |
| 440 |
sub create_helper_biblio { |
448 |
sub create_helper_biblio { |
| 441 |
my $itemtype = shift; |
449 |
my $itemtype = shift; |
| 442 |
- |
|
|