Lines 1334-1346
subtest 'ModReserveAffect logging' => sub {
Link Here
|
1334 |
|
1334 |
|
1335 |
subtest 'Waiting item is marked as lost' => sub { |
1335 |
subtest 'Waiting item is marked as lost' => sub { |
1336 |
|
1336 |
|
1337 |
plan tests => 15; |
1337 |
plan tests => 17; |
1338 |
|
1338 |
|
1339 |
# Set up data |
1339 |
# Set up data |
1340 |
my $biblio = $builder->build_sample_biblio(); |
1340 |
my $biblio = $builder->build_sample_biblio(); |
1341 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
1341 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
1342 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
1342 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
1343 |
|
1343 |
t::lib::Mocks::mock_preference( 'SendLostHoldNotices', 0 ); |
|
|
1344 |
$dbh->do(q|DELETE FROM message_queue|); |
1344 |
## TEST 1: BIBLIO-LEVEL HOLD |
1345 |
## TEST 1: BIBLIO-LEVEL HOLD |
1345 |
|
1346 |
|
1346 |
# place biblio-level hold |
1347 |
# place biblio-level hold |
Lines 1351-1356
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1351 |
}); |
1352 |
}); |
1352 |
my $hold = Koha::Holds->find( $reserve_id ); |
1353 |
my $hold = Koha::Holds->find( $reserve_id ); |
1353 |
|
1354 |
|
|
|
1355 |
$dbh->do(q{INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, message_transport_type, content) VALUES ('reserves','LOST_WAITING_HOLD','','Waiting hold marked lost','0','Your waiting hold has been marked lost','email',"Dear [% borrower.firstname %] [% borrowers.surname %],<br><br>Your hold awaiting pickup is no longer available. The item is lost.<br><br>Please contact the library for more information.<br><br>Thank you,<br><br>[% branch.branchname %]") }); |
1356 |
|
1354 |
is( $hold->item_level_hold, 0, 'Biblio-level hold placed' ); |
1357 |
is( $hold->item_level_hold, 0, 'Biblio-level hold placed' ); |
1355 |
|
1358 |
|
1356 |
# set hold as waiting and assign item |
1359 |
# set hold as waiting and assign item |
Lines 1418-1424
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1418 |
$hold->cancel; |
1421 |
$hold->cancel; |
1419 |
$item->itemlost( 0 ); |
1422 |
$item->itemlost( 0 ); |
1420 |
|
1423 |
|
|
|
1424 |
my $message_count = $dbh->selectall_arrayref(q{ |
1425 |
SELECT COUNT(*) |
1426 |
FROM message_queue |
1427 |
WHERE letter_code = 'LOST_WAITING_HOLD' |
1428 |
}); |
1429 |
is( $message_count->[0]->[0], 0, 'No notices enqueued because SendLostHoldNotices disabled' ); |
1430 |
|
1421 |
# TEST 3: ITEM-LEVEL HOLD, CANCEL |
1431 |
# TEST 3: ITEM-LEVEL HOLD, CANCEL |
|
|
1432 |
t::lib::Mocks::mock_preference( 'SendLostHoldNotices', 1 ); |
1422 |
|
1433 |
|
1423 |
# place item-level hold |
1434 |
# place item-level hold |
1424 |
$reserve_id = AddReserve({ |
1435 |
$reserve_id = AddReserve({ |
Lines 1452-1457
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1452 |
C4::Circulation::LostItem( $item->itemnumber, 'test', 0, { cancel_reserve => 1 }); |
1463 |
C4::Circulation::LostItem( $item->itemnumber, 'test', 0, { cancel_reserve => 1 }); |
1453 |
$hold = Koha::Holds->find( $reserve_id ); |
1464 |
$hold = Koha::Holds->find( $reserve_id ); |
1454 |
is( Koha::Holds->find( $reserve_id ), undef, 'Hold has been cancelled with RevertLostBibLevelHolds enabled' ); |
1465 |
is( Koha::Holds->find( $reserve_id ), undef, 'Hold has been cancelled with RevertLostBibLevelHolds enabled' ); |
|
|
1466 |
|
1467 |
$message_count = $dbh->selectall_arrayref(q{ |
1468 |
SELECT COUNT(*) |
1469 |
FROM message_queue |
1470 |
WHERE letter_code = 'LOST_WAITING_HOLD' |
1471 |
}); |
1472 |
is( $message_count->[0]->[0], 2, 'LOST_WAITING_HOLD notice enqueued with each call to LostItem' ); |
1455 |
}; |
1473 |
}; |
1456 |
|
1474 |
|
1457 |
sub count_hold_print_messages { |
1475 |
sub count_hold_print_messages { |
1458 |
- |
|
|