Lines 1407-1419
subtest 'ModReserveAffect logging' => sub {
Link Here
|
1407 |
|
1407 |
|
1408 |
subtest 'Waiting item is marked as lost' => sub { |
1408 |
subtest 'Waiting item is marked as lost' => sub { |
1409 |
|
1409 |
|
1410 |
plan tests => 15; |
1410 |
plan tests => 17; |
1411 |
|
1411 |
|
1412 |
# Set up data |
1412 |
# Set up data |
1413 |
my $biblio = $builder->build_sample_biblio(); |
1413 |
my $biblio = $builder->build_sample_biblio(); |
1414 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
1414 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
1415 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
1415 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
1416 |
|
1416 |
t::lib::Mocks::mock_preference( 'SendLostHoldNotices', 0 ); |
|
|
1417 |
$dbh->do(q|DELETE FROM message_queue|); |
1417 |
## TEST 1: BIBLIO-LEVEL HOLD |
1418 |
## TEST 1: BIBLIO-LEVEL HOLD |
1418 |
|
1419 |
|
1419 |
# place biblio-level hold |
1420 |
# place biblio-level hold |
Lines 1424-1429
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1424 |
}); |
1425 |
}); |
1425 |
my $hold = Koha::Holds->find( $reserve_id ); |
1426 |
my $hold = Koha::Holds->find( $reserve_id ); |
1426 |
|
1427 |
|
|
|
1428 |
$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 %]") }); |
1429 |
|
1427 |
is( $hold->item_level_hold, 0, 'Biblio-level hold placed' ); |
1430 |
is( $hold->item_level_hold, 0, 'Biblio-level hold placed' ); |
1428 |
|
1431 |
|
1429 |
# set hold as waiting and assign item |
1432 |
# set hold as waiting and assign item |
Lines 1491-1497
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1491 |
$hold->cancel; |
1494 |
$hold->cancel; |
1492 |
$item->itemlost( 0 ); |
1495 |
$item->itemlost( 0 ); |
1493 |
|
1496 |
|
|
|
1497 |
my $message_count = $dbh->selectall_arrayref(q{ |
1498 |
SELECT COUNT(*) |
1499 |
FROM message_queue |
1500 |
WHERE letter_code = 'LOST_WAITING_HOLD' |
1501 |
}); |
1502 |
is( $message_count->[0]->[0], 0, 'No notices enqueued because SendLostHoldNotices disabled' ); |
1503 |
|
1494 |
# TEST 3: ITEM-LEVEL HOLD, CANCEL |
1504 |
# TEST 3: ITEM-LEVEL HOLD, CANCEL |
|
|
1505 |
t::lib::Mocks::mock_preference( 'SendLostHoldNotices', 1 ); |
1495 |
|
1506 |
|
1496 |
# place item-level hold |
1507 |
# place item-level hold |
1497 |
$reserve_id = AddReserve({ |
1508 |
$reserve_id = AddReserve({ |
Lines 1525-1530
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1525 |
C4::Circulation::LostItem( $item->itemnumber, 'test', 0, { cancel_reserve => 1 }); |
1536 |
C4::Circulation::LostItem( $item->itemnumber, 'test', 0, { cancel_reserve => 1 }); |
1526 |
$hold = Koha::Holds->find( $reserve_id ); |
1537 |
$hold = Koha::Holds->find( $reserve_id ); |
1527 |
is( Koha::Holds->find( $reserve_id ), undef, 'Hold has been cancelled with RevertLostBibLevelHolds enabled' ); |
1538 |
is( Koha::Holds->find( $reserve_id ), undef, 'Hold has been cancelled with RevertLostBibLevelHolds enabled' ); |
|
|
1539 |
|
1540 |
$message_count = $dbh->selectall_arrayref(q{ |
1541 |
SELECT COUNT(*) |
1542 |
FROM message_queue |
1543 |
WHERE letter_code = 'LOST_WAITING_HOLD' |
1544 |
}); |
1545 |
is( $message_count->[0]->[0], 2, 'LOST_WAITING_HOLD notice enqueued with each call to LostItem' ); |
1528 |
}; |
1546 |
}; |
1529 |
|
1547 |
|
1530 |
sub count_hold_print_messages { |
1548 |
sub count_hold_print_messages { |
1531 |
- |
|
|