Lines 1220-1232
subtest 'MergeHolds' => sub {
Link Here
|
1220 |
|
1220 |
|
1221 |
subtest 'Waiting item is marked as lost' => sub { |
1221 |
subtest 'Waiting item is marked as lost' => sub { |
1222 |
|
1222 |
|
1223 |
plan tests => 15; |
1223 |
plan tests => 17; |
1224 |
|
1224 |
|
1225 |
# Set up data |
1225 |
# Set up data |
1226 |
my $biblio = $builder->build_sample_biblio(); |
1226 |
my $biblio = $builder->build_sample_biblio(); |
1227 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
1227 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
1228 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
1228 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
1229 |
|
1229 |
t::lib::Mocks::mock_preference( 'SendLostHoldNotices', 0 ); |
|
|
1230 |
$dbh->do(q|DELETE FROM message_queue|); |
1230 |
## TEST 1: BIBLIO-LEVEL HOLD |
1231 |
## TEST 1: BIBLIO-LEVEL HOLD |
1231 |
|
1232 |
|
1232 |
# place biblio-level hold |
1233 |
# place biblio-level hold |
Lines 1237-1242
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1237 |
}); |
1238 |
}); |
1238 |
my $hold = Koha::Holds->find( $reserve_id ); |
1239 |
my $hold = Koha::Holds->find( $reserve_id ); |
1239 |
|
1240 |
|
|
|
1241 |
$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 %]") }); |
1242 |
|
1240 |
is( $hold->item_level_hold, 0, 'Biblio-level hold placed' ); |
1243 |
is( $hold->item_level_hold, 0, 'Biblio-level hold placed' ); |
1241 |
|
1244 |
|
1242 |
# set hold as waiting and assign item |
1245 |
# set hold as waiting and assign item |
Lines 1304-1310
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1304 |
$hold->cancel; |
1307 |
$hold->cancel; |
1305 |
$item->itemlost( 0 ); |
1308 |
$item->itemlost( 0 ); |
1306 |
|
1309 |
|
|
|
1310 |
my $message_count = $dbh->selectall_arrayref(q{ |
1311 |
SELECT COUNT(*) |
1312 |
FROM message_queue |
1313 |
WHERE letter_code = 'LOST_WAITING_HOLD' |
1314 |
}); |
1315 |
is( $message_count->[0]->[0], 0, 'No notices enqueued because SendLostHoldNotices disabled' ); |
1316 |
|
1307 |
# TEST 3: ITEM-LEVEL HOLD, CANCEL |
1317 |
# TEST 3: ITEM-LEVEL HOLD, CANCEL |
|
|
1318 |
t::lib::Mocks::mock_preference( 'SendLostHoldNotices', 1 ); |
1308 |
|
1319 |
|
1309 |
# place item-level hold |
1320 |
# place item-level hold |
1310 |
$reserve_id = AddReserve({ |
1321 |
$reserve_id = AddReserve({ |
Lines 1338-1343
subtest 'Waiting item is marked as lost' => sub {
Link Here
|
1338 |
C4::Circulation::LostItem( $item->itemnumber, 'test', 0, { cancel_reserve => 1 }); |
1349 |
C4::Circulation::LostItem( $item->itemnumber, 'test', 0, { cancel_reserve => 1 }); |
1339 |
$hold = Koha::Holds->find( $reserve_id ); |
1350 |
$hold = Koha::Holds->find( $reserve_id ); |
1340 |
is( Koha::Holds->find( $reserve_id ), undef, 'Hold has been cancelled with RevertLostBibLevelHolds enabled' ); |
1351 |
is( Koha::Holds->find( $reserve_id ), undef, 'Hold has been cancelled with RevertLostBibLevelHolds enabled' ); |
|
|
1352 |
|
1353 |
$message_count = $dbh->selectall_arrayref(q{ |
1354 |
SELECT COUNT(*) |
1355 |
FROM message_queue |
1356 |
WHERE letter_code = 'LOST_WAITING_HOLD' |
1357 |
}); |
1358 |
is( $message_count->[0]->[0], 2, 'LOST_WAITING_HOLD notice enqueued with each call to LostItem' ); |
1341 |
}; |
1359 |
}; |
1342 |
|
1360 |
|
1343 |
sub count_hold_print_messages { |
1361 |
sub count_hold_print_messages { |
1344 |
- |
|
|