|
Lines 85-97
t::lib::Mocks::mock_userenv({ branchcode => $branch_1 });
Link Here
|
| 85 |
my $bibnum = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber; |
85 |
my $bibnum = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber; |
| 86 |
|
86 |
|
| 87 |
# Create a helper item instance for testing |
87 |
# Create a helper item instance for testing |
| 88 |
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( |
88 |
my $itemnumber = $builder->build_sample_item({ biblionumber => $bibnum, library => $branch_1, itype => $itemtype })->itemnumber; |
| 89 |
{ homebranch => $branch_1, |
|
|
| 90 |
holdingbranch => $branch_1, |
| 91 |
itype => $itemtype |
| 92 |
}, |
| 93 |
$bibnum |
| 94 |
); |
| 95 |
|
89 |
|
| 96 |
my $biblio_with_no_item = $builder->build({ |
90 |
my $biblio_with_no_item = $builder->build({ |
| 97 |
source => 'Biblio' |
91 |
source => 'Biblio' |
|
Lines 130-142
AddReserve($branchcode, $borrowernumber, $biblionumber,
Link Here
|
| 130 |
$bibitems, $priority, $resdate, $expdate, $notes, |
124 |
$bibitems, $priority, $resdate, $expdate, $notes, |
| 131 |
'a title', $checkitem, $found); |
125 |
'a title', $checkitem, $found); |
| 132 |
|
126 |
|
| 133 |
my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode); |
127 |
my ($status, $reserve, $all_reserves) = CheckReserves($item->itemnumber, $barcode); |
| 134 |
|
128 |
|
| 135 |
is($status, "Reserved", "CheckReserves Test 1"); |
129 |
is($status, "Reserved", "CheckReserves Test 1"); |
| 136 |
|
130 |
|
| 137 |
ok(exists($reserve->{reserve_id}), 'CheckReserves() include reserve_id in its response'); |
131 |
ok(exists($reserve->{reserve_id}), 'CheckReserves() include reserve_id in its response'); |
| 138 |
|
132 |
|
| 139 |
($status, $reserve, $all_reserves) = CheckReserves($itemnumber); |
133 |
($status, $reserve, $all_reserves) = CheckReserves($item->itemnumber); |
| 140 |
is($status, "Reserved", "CheckReserves Test 2"); |
134 |
is($status, "Reserved", "CheckReserves Test 2"); |
| 141 |
|
135 |
|
| 142 |
($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); |
136 |
($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); |
|
Lines 227-249
Koha::CirculationRules->set_rules(
Link Here
|
| 227 |
my $bibnum2 = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber; |
221 |
my $bibnum2 = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber; |
| 228 |
|
222 |
|
| 229 |
my ($itemnum_cpl, $itemnum_fpl); |
223 |
my ($itemnum_cpl, $itemnum_fpl); |
| 230 |
( undef, undef, $itemnum_cpl ) = AddItem( |
224 |
$itemnum_cpl = $builder->build_sample_item( |
| 231 |
{ homebranch => $branch_1, |
225 |
{ |
| 232 |
holdingbranch => $branch_1, |
226 |
biblionumber => $bibnum2, |
| 233 |
barcode => 'bug10272_CPL', |
227 |
library => $branch_1, |
| 234 |
itype => $itemtype |
228 |
barcode => 'bug10272_CPL', |
| 235 |
}, |
229 |
itype => $itemtype |
| 236 |
$bibnum2 |
230 |
} |
| 237 |
); |
231 |
)->itemnumber; |
| 238 |
( undef, undef, $itemnum_fpl ) = AddItem( |
232 |
$itemnum_fpl = $builder->build_sample_item( |
| 239 |
{ homebranch => $branch_2, |
233 |
{ |
| 240 |
holdingbranch => $branch_2, |
234 |
biblionumber => $bibnum2, |
| 241 |
barcode => 'bug10272_FPL', |
235 |
library => $branch_2, |
| 242 |
itype => $itemtype |
236 |
barcode => 'bug10272_FPL', |
| 243 |
}, |
237 |
itype => $itemtype |
| 244 |
$bibnum2 |
238 |
} |
| 245 |
); |
239 |
)->itemnumber; |
| 246 |
|
|
|
| 247 |
|
240 |
|
| 248 |
# Ensure that priorities are numbered correcly when a hold is moved to waiting |
241 |
# Ensure that priorities are numbered correcly when a hold is moved to waiting |
| 249 |
# (bug 11947) |
242 |
# (bug 11947) |
|
Lines 320-328
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
Link Here
|
| 320 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
313 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
| 321 |
$bibitems, 1, $resdate, $expdate, $notes, |
314 |
$bibitems, 1, $resdate, $expdate, $notes, |
| 322 |
'a title', $checkitem, $found); |
315 |
'a title', $checkitem, $found); |
| 323 |
($status)=CheckReserves($itemnumber,undef,undef); |
316 |
($status)=CheckReserves($item->itemnumber,undef,undef); |
| 324 |
is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead'); |
317 |
is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead'); |
| 325 |
($status)=CheckReserves($itemnumber,undef,7); |
318 |
($status)=CheckReserves($item->itemnumber,undef,7); |
| 326 |
is( $status, 'Reserved', 'CheckReserves also returns reserve with lookahead'); |
319 |
is( $status, 'Reserved', 'CheckReserves also returns reserve with lookahead'); |
| 327 |
|
320 |
|
| 328 |
# Test 9761b: Add a reserve with future date, CheckReserve should not return it |
321 |
# Test 9761b: Add a reserve with future date, CheckReserve should not return it |
|
Lines 335-347
$expdate= undef; #no expdate
Link Here
|
| 335 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
328 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
| 336 |
$bibitems, 1, $resdate, $expdate, $notes, |
329 |
$bibitems, 1, $resdate, $expdate, $notes, |
| 337 |
'a title', $checkitem, $found); |
330 |
'a title', $checkitem, $found); |
| 338 |
($status)=CheckReserves($itemnumber,undef,undef); |
331 |
($status)=CheckReserves($item->itemnumber,undef,undef); |
| 339 |
is( $status, '', 'CheckReserves returns no future reserve without lookahead'); |
332 |
is( $status, '', 'CheckReserves returns no future reserve without lookahead'); |
| 340 |
|
333 |
|
| 341 |
# Test 9761c: Add a reserve with future date, CheckReserve should return it if lookahead is high enough |
334 |
# Test 9761c: Add a reserve with future date, CheckReserve should return it if lookahead is high enough |
| 342 |
($status)=CheckReserves($itemnumber,undef,3); |
335 |
($status)=CheckReserves($item->itemnumber,undef,3); |
| 343 |
is( $status, '', 'CheckReserves returns no future reserve with insufficient lookahead'); |
336 |
is( $status, '', 'CheckReserves returns no future reserve with insufficient lookahead'); |
| 344 |
($status)=CheckReserves($itemnumber,undef,4); |
337 |
($status)=CheckReserves($item->itemnumber,undef,4); |
| 345 |
is( $status, 'Reserved', 'CheckReserves returns future reserve with sufficient lookahead'); |
338 |
is( $status, 'Reserved', 'CheckReserves returns future reserve with sufficient lookahead'); |
| 346 |
|
339 |
|
| 347 |
# Test 9761d: Check ResFound message of AddReturn for future hold |
340 |
# Test 9761d: Check ResFound message of AddReturn for future hold |
|
Lines 361-372
is(exists $messages->{ResFound}?1:0, 1, 'AddReturn considers future reserve with
Link Here
|
| 361 |
|
354 |
|
| 362 |
# test marking a hold as captured |
355 |
# test marking a hold as captured |
| 363 |
my $hold_notice_count = count_hold_print_messages(); |
356 |
my $hold_notice_count = count_hold_print_messages(); |
| 364 |
ModReserveAffect($itemnumber, $requesters{$branch_1}, 0); |
357 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 0); |
| 365 |
my $new_count = count_hold_print_messages(); |
358 |
my $new_count = count_hold_print_messages(); |
| 366 |
is($new_count, $hold_notice_count + 1, 'patron notified when item set to waiting'); |
359 |
is($new_count, $hold_notice_count + 1, 'patron notified when item set to waiting'); |
| 367 |
|
360 |
|
| 368 |
# test that duplicate notices aren't generated |
361 |
# test that duplicate notices aren't generated |
| 369 |
ModReserveAffect($itemnumber, $requesters{$branch_1}, 0); |
362 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 0); |
| 370 |
$new_count = count_hold_print_messages(); |
363 |
$new_count = count_hold_print_messages(); |
| 371 |
is($new_count, $hold_notice_count + 1, 'patron not notified a second time (bug 11445)'); |
364 |
is($new_count, $hold_notice_count + 1, 'patron not notified a second time (bug 11445)'); |
| 372 |
|
365 |
|
|
Lines 392-398
$resdate=output_pref($resdate);
Link Here
|
| 392 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
385 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
| 393 |
$bibitems, 1, $resdate, $expdate, $notes, |
386 |
$bibitems, 1, $resdate, $expdate, $notes, |
| 394 |
'a title', $checkitem, $found); |
387 |
'a title', $checkitem, $found); |
| 395 |
my $item = Koha::Items->find( $itemnumber ); |
|
|
| 396 |
$holds = $item->current_holds; |
388 |
$holds = $item->current_holds; |
| 397 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
389 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
| 398 |
my $future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
390 |
my $future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
|
Lines 401-411
is( $future_holds->count, 0, 'current_holds does not return a future next availa
Link Here
|
| 401 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
393 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
| 402 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
394 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
| 403 |
$bibitems, 1, $resdate, $expdate, $notes, |
395 |
$bibitems, 1, $resdate, $expdate, $notes, |
| 404 |
'a title', $itemnumber, $found); #item level hold |
396 |
'a title', $item->itemnumber, $found); #item level hold |
| 405 |
$future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
397 |
$future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
| 406 |
is( $future_holds->count, 0, 'current_holds does not return a future item level hold' ); |
398 |
is( $future_holds->count, 0, 'current_holds does not return a future item level hold' ); |
| 407 |
# 9788c: current_holds returns future wait (confirmed future hold) |
399 |
# 9788c: current_holds returns future wait (confirmed future hold) |
| 408 |
ModReserveAffect( $itemnumber, $requesters{$branch_1} , 0); #confirm hold |
400 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1} , 0); #confirm hold |
| 409 |
$future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
401 |
$future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); |
| 410 |
is( $future_holds->count, 1, 'current_holds returns a future wait (confirmed future hold)' ); |
402 |
is( $future_holds->count, 1, 'current_holds returns a future wait (confirmed future hold)' ); |
| 411 |
# End of tests for bug 9788 |
403 |
# End of tests for bug 9788 |
|
Lines 427-436
is($p, 1, 'CalculatePriority should now return priority 1');
Link Here
|
| 427 |
#add a new reserve and confirm it to waiting |
419 |
#add a new reserve and confirm it to waiting |
| 428 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
420 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
| 429 |
$bibitems, $p, $resdate, $expdate, $notes, |
421 |
$bibitems, $p, $resdate, $expdate, $notes, |
| 430 |
'a title', $itemnumber, $found); |
422 |
'a title', $item->itemnumber, $found); |
| 431 |
$p = C4::Reserves::CalculatePriority($bibnum); |
423 |
$p = C4::Reserves::CalculatePriority($bibnum); |
| 432 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
424 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
| 433 |
ModReserveAffect( $itemnumber, $requesters{$branch_1} , 0); |
425 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1} , 0); |
| 434 |
$p = C4::Reserves::CalculatePriority($bibnum); |
426 |
$p = C4::Reserves::CalculatePriority($bibnum); |
| 435 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
427 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
| 436 |
#add another biblio hold, no resdate |
428 |
#add another biblio hold, no resdate |
|
Lines 455-464
is($p, 3, 'CalculatePriority should now return priority 3');
Link Here
|
| 455 |
|
447 |
|
| 456 |
# Tests for cancel reserves by users from OPAC. |
448 |
# Tests for cancel reserves by users from OPAC. |
| 457 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
449 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 458 |
AddReserve($branch_1, $requesters{$branch_1}, $item_bibnum, |
450 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
| 459 |
$bibitems, 1, undef, $expdate, $notes, |
451 |
$bibitems, 1, undef, $expdate, $notes, |
| 460 |
'a title', $checkitem, ''); |
452 |
'a title', $checkitem, ''); |
| 461 |
my (undef, $canres, undef) = CheckReserves($itemnumber); |
453 |
my (undef, $canres, undef) = CheckReserves($item->itemnumber); |
| 462 |
|
454 |
|
| 463 |
is( CanReserveBeCanceledFromOpac(), undef, |
455 |
is( CanReserveBeCanceledFromOpac(), undef, |
| 464 |
'CanReserveBeCanceledFromOpac should return undef if called without any parameter' |
456 |
'CanReserveBeCanceledFromOpac should return undef if called without any parameter' |
|
Lines 480-496
is($cancancel, 1, 'Can user cancel its own reserve');
Link Here
|
| 480 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_2}); |
472 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_2}); |
| 481 |
is($cancancel, 0, 'Other user cant cancel reserve'); |
473 |
is($cancancel, 0, 'Other user cant cancel reserve'); |
| 482 |
|
474 |
|
| 483 |
ModReserveAffect($itemnumber, $requesters{$branch_1}, 1); |
475 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 1); |
| 484 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_1}); |
476 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_1}); |
| 485 |
is($cancancel, 0, 'Reserve in transfer status cant be canceled'); |
477 |
is($cancancel, 0, 'Reserve in transfer status cant be canceled'); |
| 486 |
|
478 |
|
| 487 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
479 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 488 |
AddReserve($branch_1, $requesters{$branch_1}, $item_bibnum, |
480 |
AddReserve($branch_1, $requesters{$branch_1}, $bibnum, |
| 489 |
$bibitems, 1, undef, $expdate, $notes, |
481 |
$bibitems, 1, undef, $expdate, $notes, |
| 490 |
'a title', $checkitem, ''); |
482 |
'a title', $checkitem, ''); |
| 491 |
(undef, $canres, undef) = CheckReserves($itemnumber); |
483 |
(undef, $canres, undef) = CheckReserves($item->itemnumber); |
| 492 |
|
484 |
|
| 493 |
ModReserveAffect($itemnumber, $requesters{$branch_1}, 0); |
485 |
ModReserveAffect($item->itemnumber, $requesters{$branch_1}, 0); |
| 494 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_1}); |
486 |
$cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{$branch_1}); |
| 495 |
is($cancancel, 0, 'Reserve in waiting status cant be canceled'); |
487 |
is($cancancel, 0, 'Reserve in waiting status cant be canceled'); |
| 496 |
|
488 |
|
|
Lines 529-536
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblio_with_no_item->{bibl
Link Here
|
| 529 |
####### EO Bug 13113 <<< |
521 |
####### EO Bug 13113 <<< |
| 530 |
#### |
522 |
#### |
| 531 |
|
523 |
|
| 532 |
$item = Koha::Items->find($itemnumber); |
|
|
| 533 |
|
| 534 |
ok( C4::Reserves::IsAvailableForItemLevelRequest($item, $patron), "Reserving a book on item level" ); |
524 |
ok( C4::Reserves::IsAvailableForItemLevelRequest($item, $patron), "Reserving a book on item level" ); |
| 535 |
|
525 |
|
| 536 |
my $pickup_branch = $builder->build({ source => 'Branch' })->{ branchcode }; |
526 |
my $pickup_branch = $builder->build({ source => 'Branch' })->{ branchcode }; |
|
Lines 551-598
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits', '0' );
Link Here
|
| 551 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
541 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 552 |
t::lib::Mocks::mock_preference('ConfirmFutureHolds', 0); |
542 |
t::lib::Mocks::mock_preference('ConfirmFutureHolds', 0); |
| 553 |
t::lib::Mocks::mock_preference('AllowHoldDateInFuture', 1); |
543 |
t::lib::Mocks::mock_preference('AllowHoldDateInFuture', 1); |
| 554 |
AddReserve($branch_1, $borrowernumber, $item_bibnum, |
544 |
AddReserve($branch_1, $borrowernumber, $bibnum, |
| 555 |
$bibitems, 1, undef, $expdate, $notes, 'a title', $checkitem, ''); |
545 |
$bibitems, 1, undef, $expdate, $notes, 'a title', $checkitem, ''); |
| 556 |
MoveReserve( $itemnumber, $borrowernumber ); |
546 |
MoveReserve( $item->itemnumber, $borrowernumber ); |
| 557 |
($status)=CheckReserves( $itemnumber ); |
547 |
($status)=CheckReserves( $item->itemnumber ); |
| 558 |
is( $status, '', 'MoveReserve filled hold'); |
548 |
is( $status, '', 'MoveReserve filled hold'); |
| 559 |
# hold from A waiting, today, no fut holds: MoveReserve should fill it |
549 |
# hold from A waiting, today, no fut holds: MoveReserve should fill it |
| 560 |
AddReserve($branch_1, $borrowernumber, $item_bibnum, |
550 |
AddReserve($branch_1, $borrowernumber, $bibnum, |
| 561 |
$bibitems, 1, undef, $expdate, $notes, 'a title', $checkitem, 'W'); |
551 |
$bibitems, 1, undef, $expdate, $notes, 'a title', $checkitem, 'W'); |
| 562 |
MoveReserve( $itemnumber, $borrowernumber ); |
552 |
MoveReserve( $item->itemnumber, $borrowernumber ); |
| 563 |
($status)=CheckReserves( $itemnumber ); |
553 |
($status)=CheckReserves( $item->itemnumber ); |
| 564 |
is( $status, '', 'MoveReserve filled waiting hold'); |
554 |
is( $status, '', 'MoveReserve filled waiting hold'); |
| 565 |
# hold from A pos 1, tomorrow, no fut holds: not filled |
555 |
# hold from A pos 1, tomorrow, no fut holds: not filled |
| 566 |
$resdate= dt_from_string(); |
556 |
$resdate= dt_from_string(); |
| 567 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
557 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
| 568 |
$resdate=output_pref($resdate); |
558 |
$resdate=output_pref($resdate); |
| 569 |
AddReserve($branch_1, $borrowernumber, $item_bibnum, |
559 |
AddReserve($branch_1, $borrowernumber, $bibnum, |
| 570 |
$bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); |
560 |
$bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); |
| 571 |
MoveReserve( $itemnumber, $borrowernumber ); |
561 |
MoveReserve( $item->itemnumber, $borrowernumber ); |
| 572 |
($status)=CheckReserves( $itemnumber, undef, 1 ); |
562 |
($status)=CheckReserves( $item->itemnumber, undef, 1 ); |
| 573 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold'); |
563 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold'); |
| 574 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
564 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 575 |
# hold from A pos 1, tomorrow, fut holds=2: MoveReserve should fill it |
565 |
# hold from A pos 1, tomorrow, fut holds=2: MoveReserve should fill it |
| 576 |
t::lib::Mocks::mock_preference('ConfirmFutureHolds', 2); |
566 |
t::lib::Mocks::mock_preference('ConfirmFutureHolds', 2); |
| 577 |
AddReserve($branch_1, $borrowernumber, $item_bibnum, |
567 |
AddReserve($branch_1, $borrowernumber, $bibnum, |
| 578 |
$bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); |
568 |
$bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); |
| 579 |
MoveReserve( $itemnumber, $borrowernumber ); |
569 |
MoveReserve( $item->itemnumber, $borrowernumber ); |
| 580 |
($status)=CheckReserves( $itemnumber, undef, 2 ); |
570 |
($status)=CheckReserves( $item->itemnumber, undef, 2 ); |
| 581 |
is( $status, '', 'MoveReserve filled future hold now'); |
571 |
is( $status, '', 'MoveReserve filled future hold now'); |
| 582 |
# hold from A waiting, tomorrow, fut holds=2: MoveReserve should fill it |
572 |
# hold from A waiting, tomorrow, fut holds=2: MoveReserve should fill it |
| 583 |
AddReserve($branch_1, $borrowernumber, $item_bibnum, |
573 |
AddReserve($branch_1, $borrowernumber, $bibnum, |
| 584 |
$bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, 'W'); |
574 |
$bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, 'W'); |
| 585 |
MoveReserve( $itemnumber, $borrowernumber ); |
575 |
MoveReserve( $item->itemnumber, $borrowernumber ); |
| 586 |
($status)=CheckReserves( $itemnumber, undef, 2 ); |
576 |
($status)=CheckReserves( $item->itemnumber, undef, 2 ); |
| 587 |
is( $status, '', 'MoveReserve filled future waiting hold now'); |
577 |
is( $status, '', 'MoveReserve filled future waiting hold now'); |
| 588 |
# hold from A pos 1, today+3, fut holds=2: MoveReserve should not fill it |
578 |
# hold from A pos 1, today+3, fut holds=2: MoveReserve should not fill it |
| 589 |
$resdate= dt_from_string(); |
579 |
$resdate= dt_from_string(); |
| 590 |
$resdate->add_duration(DateTime::Duration->new(days => 3)); |
580 |
$resdate->add_duration(DateTime::Duration->new(days => 3)); |
| 591 |
$resdate=output_pref($resdate); |
581 |
$resdate=output_pref($resdate); |
| 592 |
AddReserve($branch_1, $borrowernumber, $item_bibnum, |
582 |
AddReserve($branch_1, $borrowernumber, $bibnum, |
| 593 |
$bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); |
583 |
$bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); |
| 594 |
MoveReserve( $itemnumber, $borrowernumber ); |
584 |
MoveReserve( $item->itemnumber, $borrowernumber ); |
| 595 |
($status)=CheckReserves( $itemnumber, undef, 3 ); |
585 |
($status)=CheckReserves( $item->itemnumber, undef, 3 ); |
| 596 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); |
586 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); |
| 597 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
587 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 598 |
|
588 |
|