Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 119; |
20 |
use Test::More tests => 120; |
21 |
|
21 |
|
22 |
use Data::Dumper; |
22 |
use Data::Dumper; |
23 |
use DateTime; |
23 |
use DateTime; |
Lines 2279-2284
subtest '_FixAccountForLostAndReturned' => sub {
Link Here
|
2279 |
'The patron balance is the difference between the PF and the credit' |
2279 |
'The patron balance is the difference between the PF and the credit' |
2280 |
); |
2280 |
); |
2281 |
}; |
2281 |
}; |
|
|
2282 |
|
2282 |
}; |
2283 |
}; |
2283 |
|
2284 |
|
2284 |
subtest '_FixOverduesOnReturn' => sub { |
2285 |
subtest '_FixOverduesOnReturn' => sub { |
Lines 2406-2411
subtest 'Set waiting flag' => sub {
Link Here
|
2406 |
is( $status, 'Waiting', 'Now the hold is waiting'); |
2407 |
is( $status, 'Waiting', 'Now the hold is waiting'); |
2407 |
}; |
2408 |
}; |
2408 |
|
2409 |
|
|
|
2410 |
subtest 'Cancel transfers on lost items' => sub { |
2411 |
plan tests => 5; |
2412 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
2413 |
my $patron_1 = $builder->build( { source => 'Borrower', value => { branchcode => $library_1->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
2414 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
2415 |
my $patron_2 = $builder->build( { source => 'Borrower', value => { branchcode => $library_2->{branchcode}, categorycode => $patron_category->{categorycode} } } ); |
2416 |
my $biblio = $builder->build( { source => 'Biblio' } ); |
2417 |
my $biblioitem = $builder->build( { source => 'Biblioitem', value => { biblionumber => $biblio->{biblionumber} } } ); |
2418 |
my $item = $builder->build( |
2419 |
{ |
2420 |
source => 'Item', |
2421 |
value => { |
2422 |
homebranch => $library_1->{branchcode}, |
2423 |
holdingbranch => $library_1->{branchcode}, |
2424 |
notforloan => 0, |
2425 |
itemlost => 0, |
2426 |
withdrawn => 0, |
2427 |
biblionumber => $biblioitem->{biblionumber}, |
2428 |
} |
2429 |
} |
2430 |
); |
2431 |
|
2432 |
set_userenv( $library_2 ); |
2433 |
my $reserve_id = AddReserve( |
2434 |
$library_2->{branchcode}, $patron_2->{borrowernumber}, $biblioitem->{biblionumber}, '', 1, undef, undef, '', undef, $item->{itemnumber}, |
2435 |
); |
2436 |
|
2437 |
#Return book and add transfer |
2438 |
set_userenv( $library_1 ); |
2439 |
my $do_transfer = 1; |
2440 |
my ( $res, $rr ) = AddReturn( $item->{barcode}, $library_1->{branchcode} ); |
2441 |
ModReserveAffect( $item->{itemnumber}, undef, $do_transfer, $reserve_id ); |
2442 |
C4::Circulation::transferbook( $library_2->{branchcode}, $item->{barcode} ); |
2443 |
my $hold = Koha::Holds->find( $reserve_id ); |
2444 |
is( $hold->found, 'T', 'Hold is in transit' ); |
2445 |
|
2446 |
#Check transfer exists and the items holding branch is the transfer destination branch before marking it as lost |
2447 |
my ($datesent,$frombranch,$tobranch) = GetTransfers($item->{itemnumber}); |
2448 |
is( $tobranch, $library_2->{branchcode}, 'The transfer record exists in the branchtransfers table'); |
2449 |
my $itemcheck = GetItem($item->{itemnumber}); |
2450 |
is( $itemcheck->{holdingbranch}, $library_2->{branchcode}, 'Items holding branch is the transfers destination branch before it is marked as lost' ); |
2451 |
|
2452 |
#Simulate item being marked as lost and confirm the transfer is deleted and the items holding branch is the transfers source branch |
2453 |
ModItem( { itemlost => 1 }, $biblio->{biblionumber}, $item->{itemnumber} ); |
2454 |
LostItem( $item->{itemnumber}, 'test', 1 ); |
2455 |
($datesent,$frombranch,$tobranch) = GetTransfers($item->{itemnumber}); |
2456 |
is( $tobranch, undef, 'The transfer on the lost item has been deleted as the LostItemCancelOutstandingTransfer is enabled'); |
2457 |
my $itemcheck = GetItem($item->{itemnumber}); |
2458 |
is( $itemcheck->{holdingbranch}, $library_1->{branchcode}, 'Lost item with cancelled hold has holding branch equallying the transfers source branch' ); |
2459 |
}; |
2460 |
|
2409 |
subtest 'CanBookBeIssued | is_overdue' => sub { |
2461 |
subtest 'CanBookBeIssued | is_overdue' => sub { |
2410 |
plan tests => 3; |
2462 |
plan tests => 3; |
2411 |
|
2463 |
|
2412 |
- |
|
|