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