Lines 2-8
Link Here
|
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
|
4 |
|
5 |
use Test::More tests => 25; |
5 |
use Test::More tests => 31; |
6 |
use MARC::Record; |
6 |
use MARC::Record; |
7 |
use DateTime::Duration; |
7 |
use DateTime::Duration; |
8 |
|
8 |
|
Lines 319-330
is(defined $results[3]?1:0, 1, 'GetReservesFromItemnumber returns a future wait
Link Here
|
319 |
|
319 |
|
320 |
# Tests for CalculatePriority (bug 8918) |
320 |
# Tests for CalculatePriority (bug 8918) |
321 |
my $p = C4::Reserves::CalculatePriority($bibnum2); |
321 |
my $p = C4::Reserves::CalculatePriority($bibnum2); |
322 |
is($p, 4, 'CalculatePriority should now return priority 4'); |
322 |
is($p, 4, 'CalculatePriority should now return priority 4'); |
|
|
323 |
$resdate=undef; |
323 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
324 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
324 |
$constraint, $bibitems, $p, undef, $expdate, $notes, |
325 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
325 |
$title, $checkitem, $found); |
326 |
$title, $checkitem, $found); |
326 |
$p = C4::Reserves::CalculatePriority($bibnum2); |
327 |
$p = C4::Reserves::CalculatePriority($bibnum2); |
327 |
is($p, 5, 'CalculatePriority should now return priority 5'); |
328 |
is($p, 5, 'CalculatePriority should now return priority 5'); |
|
|
329 |
#some tests on bibnum |
330 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
331 |
$p = C4::Reserves::CalculatePriority($bibnum); |
332 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
333 |
#add a new reserve and confirm it to waiting |
334 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
335 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
336 |
$title, $itemnumber, $found); |
337 |
$p = C4::Reserves::CalculatePriority($bibnum); |
338 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
339 |
ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0); |
340 |
$p = C4::Reserves::CalculatePriority($bibnum); |
341 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
342 |
#add another biblio hold, no resdate |
343 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
344 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
345 |
$title, $checkitem, $found); |
346 |
$p = C4::Reserves::CalculatePriority($bibnum); |
347 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
348 |
#add another future hold |
349 |
C4::Context->set_preference('AllowHoldDateInFuture', 1); |
350 |
$resdate= dt_from_string(); |
351 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
352 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
353 |
$constraint, $bibitems, $p, output_pref($resdate), $expdate, $notes, |
354 |
$title, $checkitem, $found); |
355 |
$p = C4::Reserves::CalculatePriority($bibnum); |
356 |
is($p, 2, 'CalculatePriority should now still return priority 2'); |
357 |
#calc priority with future resdate |
358 |
$p = C4::Reserves::CalculatePriority($bibnum, $resdate); |
359 |
is($p, 3, 'CalculatePriority should now return priority 3'); |
328 |
# End of tests for bug 8918 |
360 |
# End of tests for bug 8918 |
329 |
|
361 |
|
330 |
$dbh->rollback; |
362 |
$dbh->rollback; |
331 |
- |
|
|