|
Lines 2-8
Link Here
|
| 2 |
|
2 |
|
| 3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
| 4 |
|
4 |
|
| 5 |
use Test::More tests => 35; |
5 |
use Test::More tests => 36; |
| 6 |
|
6 |
|
| 7 |
use MARC::Record; |
7 |
use MARC::Record; |
| 8 |
use DateTime::Duration; |
8 |
use DateTime::Duration; |
|
Lines 137-142
$requesters{'CPL'} = AddMember(
Link Here
|
| 137 |
categorycode => 'PT', |
137 |
categorycode => 'PT', |
| 138 |
surname => 'borrower from CPL', |
138 |
surname => 'borrower from CPL', |
| 139 |
); |
139 |
); |
|
|
140 |
for my $i ( 2 .. 5 ) { |
| 141 |
$requesters{"CPL$i"} = AddMember( |
| 142 |
branchcode => 'CPL', |
| 143 |
categorycode => 'PT', |
| 144 |
surname => 'borrower $i from CPL', |
| 145 |
); |
| 146 |
} |
| 140 |
$requesters{'FPL'} = AddMember( |
147 |
$requesters{'FPL'} = AddMember( |
| 141 |
branchcode => 'FPL', |
148 |
branchcode => 'FPL', |
| 142 |
categorycode => 'PT', |
149 |
categorycode => 'PT', |
|
Lines 353-363
ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0); #confirm hold
Link Here
|
| 353 |
is(defined $results[3]?1:0, 1, 'GetReservesFromItemnumber returns a future wait (confirmed future hold)'); |
360 |
is(defined $results[3]?1:0, 1, 'GetReservesFromItemnumber returns a future wait (confirmed future hold)'); |
| 354 |
# End of tests for bug 9788 |
361 |
# End of tests for bug 9788 |
| 355 |
|
362 |
|
|
|
363 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
| 356 |
# Tests for CalculatePriority (bug 8918) |
364 |
# Tests for CalculatePriority (bug 8918) |
| 357 |
my $p = C4::Reserves::CalculatePriority($bibnum2); |
365 |
my $p = C4::Reserves::CalculatePriority($bibnum2); |
| 358 |
is($p, 4, 'CalculatePriority should now return priority 4'); |
366 |
is($p, 4, 'CalculatePriority should now return priority 4'); |
| 359 |
$resdate=undef; |
367 |
$resdate=undef; |
| 360 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
368 |
AddReserve('CPL', $requesters{'CPL2'}, $bibnum2, |
| 361 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
369 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
| 362 |
$title, $checkitem, $found); |
370 |
$title, $checkitem, $found); |
| 363 |
$p = C4::Reserves::CalculatePriority($bibnum2); |
371 |
$p = C4::Reserves::CalculatePriority($bibnum2); |
|
Lines 376-382
ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0);
Link Here
|
| 376 |
$p = C4::Reserves::CalculatePriority($bibnum); |
384 |
$p = C4::Reserves::CalculatePriority($bibnum); |
| 377 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
385 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
| 378 |
#add another biblio hold, no resdate |
386 |
#add another biblio hold, no resdate |
| 379 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
387 |
AddReserve('CPL', $requesters{'CPL3'}, $bibnum, |
| 380 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
388 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
| 381 |
$title, $checkitem, $found); |
389 |
$title, $checkitem, $found); |
| 382 |
$p = C4::Reserves::CalculatePriority($bibnum); |
390 |
$p = C4::Reserves::CalculatePriority($bibnum); |
|
Lines 385-391
is($p, 2, 'CalculatePriority should now return priority 2');
Link Here
|
| 385 |
C4::Context->set_preference('AllowHoldDateInFuture', 1); |
393 |
C4::Context->set_preference('AllowHoldDateInFuture', 1); |
| 386 |
$resdate= dt_from_string(); |
394 |
$resdate= dt_from_string(); |
| 387 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
395 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
| 388 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
396 |
AddReserve('CPL', $requesters{'CPL4'}, $bibnum, |
| 389 |
$constraint, $bibitems, $p, output_pref($resdate), $expdate, $notes, |
397 |
$constraint, $bibitems, $p, output_pref($resdate), $expdate, $notes, |
| 390 |
$title, $checkitem, $found); |
398 |
$title, $checkitem, $found); |
| 391 |
$p = C4::Reserves::CalculatePriority($bibnum); |
399 |
$p = C4::Reserves::CalculatePriority($bibnum); |
|
Lines 395-400
$p = C4::Reserves::CalculatePriority($bibnum, $resdate);
Link Here
|
| 395 |
is($p, 3, 'CalculatePriority should now return priority 3'); |
403 |
is($p, 3, 'CalculatePriority should now return priority 3'); |
| 396 |
# End of tests for bug 8918 |
404 |
# End of tests for bug 8918 |
| 397 |
|
405 |
|
|
|
406 |
AddReserve( 'CPL', $requesters{'CPL4'}, $bibnum, $constraint, $bibitems, $p, |
| 407 |
output_pref($resdate), $expdate, $notes, $title, $checkitem, $found ); |
| 408 |
my ($count) = C4::Context->dbh->selectrow_array( |
| 409 |
'SELECT COUNT(*) FROM reserves WHERE biblionumber = ? AND borrowernumber = ?', |
| 410 |
undef, |
| 411 |
( $bibnum, $requesters{'CPL4'} ) |
| 412 |
); |
| 413 |
ok( $count == 1, 'Duplicate hold not placed (Bug 5144)' ); |
| 414 |
|
| 398 |
$dbh->rollback; |
415 |
$dbh->rollback; |
| 399 |
|
416 |
|
| 400 |
sub count_hold_print_messages { |
417 |
sub count_hold_print_messages { |
| 401 |
- |
|
|