|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 53; |
20 |
use Test::More tests => 54; |
| 21 |
|
21 |
|
| 22 |
use MARC::Record; |
22 |
use MARC::Record; |
| 23 |
use DateTime::Duration; |
23 |
use DateTime::Duration; |
|
Lines 153-158
$requesters{'CPL'} = AddMember(
Link Here
|
| 153 |
categorycode => 'PT', |
153 |
categorycode => 'PT', |
| 154 |
surname => 'borrower from CPL', |
154 |
surname => 'borrower from CPL', |
| 155 |
); |
155 |
); |
|
|
156 |
for my $i ( 2 .. 5 ) { |
| 157 |
$requesters{"CPL$i"} = AddMember( |
| 158 |
branchcode => 'CPL', |
| 159 |
categorycode => 'PT', |
| 160 |
surname => 'borrower $i from CPL', |
| 161 |
); |
| 162 |
} |
| 156 |
$requesters{'FPL'} = AddMember( |
163 |
$requesters{'FPL'} = AddMember( |
| 157 |
branchcode => 'FPL', |
164 |
branchcode => 'FPL', |
| 158 |
categorycode => 'PT', |
165 |
categorycode => 'PT', |
|
Lines 389-399
ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0); #confirm hold
Link Here
|
| 389 |
is(defined $results[3]?1:0, 1, 'GetReservesFromItemnumber returns a future wait (confirmed future hold)'); |
396 |
is(defined $results[3]?1:0, 1, 'GetReservesFromItemnumber returns a future wait (confirmed future hold)'); |
| 390 |
# End of tests for bug 9788 |
397 |
# End of tests for bug 9788 |
| 391 |
|
398 |
|
|
|
399 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
| 392 |
# Tests for CalculatePriority (bug 8918) |
400 |
# Tests for CalculatePriority (bug 8918) |
| 393 |
my $p = C4::Reserves::CalculatePriority($bibnum2); |
401 |
my $p = C4::Reserves::CalculatePriority($bibnum2); |
| 394 |
is($p, 4, 'CalculatePriority should now return priority 4'); |
402 |
is($p, 4, 'CalculatePriority should now return priority 4'); |
| 395 |
$resdate=undef; |
403 |
$resdate=undef; |
| 396 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
404 |
AddReserve('CPL', $requesters{'CPL2'}, $bibnum2, |
| 397 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
405 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
| 398 |
$title, $checkitem, $found); |
406 |
$title, $checkitem, $found); |
| 399 |
$p = C4::Reserves::CalculatePriority($bibnum2); |
407 |
$p = C4::Reserves::CalculatePriority($bibnum2); |
|
Lines 412-418
ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0);
Link Here
|
| 412 |
$p = C4::Reserves::CalculatePriority($bibnum); |
420 |
$p = C4::Reserves::CalculatePriority($bibnum); |
| 413 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
421 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
| 414 |
#add another biblio hold, no resdate |
422 |
#add another biblio hold, no resdate |
| 415 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
423 |
AddReserve('CPL', $requesters{'CPL3'}, $bibnum, |
| 416 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
424 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
| 417 |
$title, $checkitem, $found); |
425 |
$title, $checkitem, $found); |
| 418 |
$p = C4::Reserves::CalculatePriority($bibnum); |
426 |
$p = C4::Reserves::CalculatePriority($bibnum); |
|
Lines 421-427
is($p, 2, 'CalculatePriority should now return priority 2');
Link Here
|
| 421 |
C4::Context->set_preference('AllowHoldDateInFuture', 1); |
429 |
C4::Context->set_preference('AllowHoldDateInFuture', 1); |
| 422 |
$resdate= dt_from_string(); |
430 |
$resdate= dt_from_string(); |
| 423 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
431 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
| 424 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
432 |
AddReserve('CPL', $requesters{'CPL4'}, $bibnum, |
| 425 |
$constraint, $bibitems, $p, output_pref($resdate), $expdate, $notes, |
433 |
$constraint, $bibitems, $p, output_pref($resdate), $expdate, $notes, |
| 426 |
$title, $checkitem, $found); |
434 |
$title, $checkitem, $found); |
| 427 |
$p = C4::Reserves::CalculatePriority($bibnum); |
435 |
$p = C4::Reserves::CalculatePriority($bibnum); |
|
Lines 506-511
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 'OK', "Res
Link Here
|
| 506 |
####### EO Bug 13113 <<< |
514 |
####### EO Bug 13113 <<< |
| 507 |
#### |
515 |
#### |
| 508 |
|
516 |
|
|
|
517 |
AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, |
| 518 |
$constraint, $bibitems, 1, undef, $expdate, $notes, |
| 519 |
$title, $checkitem, ''); |
| 520 |
my ($count) = C4::Context->dbh->selectrow_array( |
| 521 |
'SELECT COUNT(*) FROM reserves WHERE biblionumber = ? AND borrowernumber = ?', |
| 522 |
undef, |
| 523 |
( $item_bibnum, $requesters{'CPL'} ) |
| 524 |
); |
| 525 |
ok( $count == 1, 'Duplicate hold not placed (Bug 5144)' ); |
| 526 |
|
| 509 |
$dbh->rollback; |
527 |
$dbh->rollback; |
| 510 |
|
528 |
|
| 511 |
sub count_hold_print_messages { |
529 |
sub count_hold_print_messages { |
| 512 |
- |
|
|