Lines 100-106
my $borrower = GetMember( borrowernumber => $borrowernumber );
Link Here
|
100 |
my $biblionumber = $bibnum; |
100 |
my $biblionumber = $bibnum; |
101 |
my $barcode = $testbarcode; |
101 |
my $barcode = $testbarcode; |
102 |
|
102 |
|
103 |
my $constraint = 'a'; |
|
|
104 |
my $bibitems = ''; |
103 |
my $bibitems = ''; |
105 |
my $priority = '1'; |
104 |
my $priority = '1'; |
106 |
my $resdate = undef; |
105 |
my $resdate = undef; |
Lines 113-119
my @branches = GetBranchesLoop();
Link Here
|
113 |
my $branch = $branches[0][0]{value}; |
112 |
my $branch = $branches[0][0]{value}; |
114 |
|
113 |
|
115 |
AddReserve($branch, $borrowernumber, $biblionumber, |
114 |
AddReserve($branch, $borrowernumber, $biblionumber, |
116 |
$constraint, $bibitems, $priority, $resdate, $expdate, $notes, |
115 |
$bibitems, $priority, $resdate, $expdate, $notes, |
117 |
$title, $checkitem, $found); |
116 |
$title, $checkitem, $found); |
118 |
|
117 |
|
119 |
my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode); |
118 |
my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode); |
Lines 224-236
my ($itemnum_cpl, $itemnum_fpl);
Link Here
|
224 |
# (bug 11947) |
223 |
# (bug 11947) |
225 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); |
224 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); |
226 |
AddReserve('RPL', $requesters{'RPL'}, $bibnum2, |
225 |
AddReserve('RPL', $requesters{'RPL'}, $bibnum2, |
227 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
226 |
$bibitems, 1, $resdate, $expdate, $notes, |
228 |
$title, $checkitem, $found); |
227 |
$title, $checkitem, $found); |
229 |
AddReserve('FPL', $requesters{'FPL'}, $bibnum2, |
228 |
AddReserve('FPL', $requesters{'FPL'}, $bibnum2, |
230 |
$constraint, $bibitems, 2, $resdate, $expdate, $notes, |
229 |
$bibitems, 2, $resdate, $expdate, $notes, |
231 |
$title, $checkitem, $found); |
230 |
$title, $checkitem, $found); |
232 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
231 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
233 |
$constraint, $bibitems, 3, $resdate, $expdate, $notes, |
232 |
$bibitems, 3, $resdate, $expdate, $notes, |
234 |
$title, $checkitem, $found); |
233 |
$title, $checkitem, $found); |
235 |
ModReserveAffect($itemnum_cpl, $requesters{'RPL'}, 0); |
234 |
ModReserveAffect($itemnum_cpl, $requesters{'RPL'}, 0); |
236 |
|
235 |
|
Lines 249-261
is( $reserves[0]->borrowernumber(), $requesters{'RPL'}, 'GetWaiting got the rese
Link Here
|
249 |
|
248 |
|
250 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); |
249 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); |
251 |
AddReserve('RPL', $requesters{'RPL'}, $bibnum2, |
250 |
AddReserve('RPL', $requesters{'RPL'}, $bibnum2, |
252 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
251 |
$bibitems, 1, $resdate, $expdate, $notes, |
253 |
$title, $checkitem, $found); |
252 |
$title, $checkitem, $found); |
254 |
AddReserve('FPL', $requesters{'FPL'}, $bibnum2, |
253 |
AddReserve('FPL', $requesters{'FPL'}, $bibnum2, |
255 |
$constraint, $bibitems, 2, $resdate, $expdate, $notes, |
254 |
$bibitems, 2, $resdate, $expdate, $notes, |
256 |
$title, $checkitem, $found); |
255 |
$title, $checkitem, $found); |
257 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
256 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
258 |
$constraint, $bibitems, 3, $resdate, $expdate, $notes, |
257 |
$bibitems, 3, $resdate, $expdate, $notes, |
259 |
$title, $checkitem, $found); |
258 |
$title, $checkitem, $found); |
260 |
|
259 |
|
261 |
# Ensure that the item's home library controls hold policy lookup |
260 |
# Ensure that the item's home library controls hold policy lookup |
Lines 305-311
$resdate= undef; #defaults to today in AddReserve
Link Here
|
305 |
$expdate= undef; #no expdate |
304 |
$expdate= undef; #no expdate |
306 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
305 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
307 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
306 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
308 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
307 |
$bibitems, 1, $resdate, $expdate, $notes, |
309 |
$title, $checkitem, $found); |
308 |
$title, $checkitem, $found); |
310 |
($status)=CheckReserves($itemnumber,undef,undef); |
309 |
($status)=CheckReserves($itemnumber,undef,undef); |
311 |
is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead'); |
310 |
is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead'); |
Lines 320-326
$resdate->add_duration(DateTime::Duration->new(days => 4));
Link Here
|
320 |
$resdate=output_pref($resdate); |
319 |
$resdate=output_pref($resdate); |
321 |
$expdate= undef; #no expdate |
320 |
$expdate= undef; #no expdate |
322 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
321 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
323 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
322 |
$bibitems, 1, $resdate, $expdate, $notes, |
324 |
$title, $checkitem, $found); |
323 |
$title, $checkitem, $found); |
325 |
($status)=CheckReserves($itemnumber,undef,undef); |
324 |
($status)=CheckReserves($itemnumber,undef,undef); |
326 |
is( $status, '', 'CheckReserves returns no future reserve without lookahead'); |
325 |
is( $status, '', 'CheckReserves returns no future reserve without lookahead'); |
Lines 377-390
$resdate= dt_from_string();
Link Here
|
377 |
$resdate->add_duration(DateTime::Duration->new(days => 2)); |
376 |
$resdate->add_duration(DateTime::Duration->new(days => 2)); |
378 |
$resdate=output_pref($resdate); |
377 |
$resdate=output_pref($resdate); |
379 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
378 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
380 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
379 |
$bibitems, 1, $resdate, $expdate, $notes, |
381 |
$title, $checkitem, $found); |
380 |
$title, $checkitem, $found); |
382 |
my @results= GetReservesFromItemnumber($itemnumber); |
381 |
my @results= GetReservesFromItemnumber($itemnumber); |
383 |
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future next available hold'); |
382 |
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future next available hold'); |
384 |
# 9788b: GetReservesFromItemnumber does not return future item level hold |
383 |
# 9788b: GetReservesFromItemnumber does not return future item level hold |
385 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
384 |
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); |
386 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
385 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
387 |
$constraint, $bibitems, 1, $resdate, $expdate, $notes, |
386 |
$bibitems, 1, $resdate, $expdate, $notes, |
388 |
$title, $itemnumber, $found); #item level hold |
387 |
$title, $itemnumber, $found); #item level hold |
389 |
@results= GetReservesFromItemnumber($itemnumber); |
388 |
@results= GetReservesFromItemnumber($itemnumber); |
390 |
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future item level hold'); |
389 |
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future item level hold'); |
Lines 399-405
my $p = C4::Reserves::CalculatePriority($bibnum2);
Link Here
|
399 |
is($p, 4, 'CalculatePriority should now return priority 4'); |
398 |
is($p, 4, 'CalculatePriority should now return priority 4'); |
400 |
$resdate=undef; |
399 |
$resdate=undef; |
401 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
400 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum2, |
402 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
401 |
$bibitems, $p, $resdate, $expdate, $notes, |
403 |
$title, $checkitem, $found); |
402 |
$title, $checkitem, $found); |
404 |
$p = C4::Reserves::CalculatePriority($bibnum2); |
403 |
$p = C4::Reserves::CalculatePriority($bibnum2); |
405 |
is($p, 5, 'CalculatePriority should now return priority 5'); |
404 |
is($p, 5, 'CalculatePriority should now return priority 5'); |
Lines 409-415
$p = C4::Reserves::CalculatePriority($bibnum);
Link Here
|
409 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
408 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
410 |
#add a new reserve and confirm it to waiting |
409 |
#add a new reserve and confirm it to waiting |
411 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
410 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
412 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
411 |
$bibitems, $p, $resdate, $expdate, $notes, |
413 |
$title, $itemnumber, $found); |
412 |
$title, $itemnumber, $found); |
414 |
$p = C4::Reserves::CalculatePriority($bibnum); |
413 |
$p = C4::Reserves::CalculatePriority($bibnum); |
415 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
414 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
Lines 418-424
$p = C4::Reserves::CalculatePriority($bibnum);
Link Here
|
418 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
417 |
is($p, 1, 'CalculatePriority should now return priority 1'); |
419 |
#add another biblio hold, no resdate |
418 |
#add another biblio hold, no resdate |
420 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
419 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
421 |
$constraint, $bibitems, $p, $resdate, $expdate, $notes, |
420 |
$bibitems, $p, $resdate, $expdate, $notes, |
422 |
$title, $checkitem, $found); |
421 |
$title, $checkitem, $found); |
423 |
$p = C4::Reserves::CalculatePriority($bibnum); |
422 |
$p = C4::Reserves::CalculatePriority($bibnum); |
424 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
423 |
is($p, 2, 'CalculatePriority should now return priority 2'); |
Lines 427-433
C4::Context->set_preference('AllowHoldDateInFuture', 1);
Link Here
|
427 |
$resdate= dt_from_string(); |
426 |
$resdate= dt_from_string(); |
428 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
427 |
$resdate->add_duration(DateTime::Duration->new(days => 1)); |
429 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
428 |
AddReserve('CPL', $requesters{'CPL'}, $bibnum, |
430 |
$constraint, $bibitems, $p, output_pref($resdate), $expdate, $notes, |
429 |
$bibitems, $p, output_pref($resdate), $expdate, $notes, |
431 |
$title, $checkitem, $found); |
430 |
$title, $checkitem, $found); |
432 |
$p = C4::Reserves::CalculatePriority($bibnum); |
431 |
$p = C4::Reserves::CalculatePriority($bibnum); |
433 |
is($p, 2, 'CalculatePriority should now still return priority 2'); |
432 |
is($p, 2, 'CalculatePriority should now still return priority 2'); |
Lines 439-445
is($p, 3, 'CalculatePriority should now return priority 3');
Link Here
|
439 |
# Tests for cancel reserves by users from OPAC. |
438 |
# Tests for cancel reserves by users from OPAC. |
440 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
439 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
441 |
AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, |
440 |
AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, |
442 |
$constraint, $bibitems, 1, undef, $expdate, $notes, |
441 |
$bibitems, 1, undef, $expdate, $notes, |
443 |
$title, $checkitem, ''); |
442 |
$title, $checkitem, ''); |
444 |
my (undef, $canres, undef) = CheckReserves($itemnumber); |
443 |
my (undef, $canres, undef) = CheckReserves($itemnumber); |
445 |
|
444 |
|
Lines 469-475
is($cancancel, 0, 'Reserve in transfer status cant be canceled');
Link Here
|
469 |
|
468 |
|
470 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
469 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
471 |
AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, |
470 |
AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, |
472 |
$constraint, $bibitems, 1, undef, $expdate, $notes, |
471 |
$bibitems, 1, undef, $expdate, $notes, |
473 |
$title, $checkitem, ''); |
472 |
$title, $checkitem, ''); |
474 |
(undef, $canres, undef) = CheckReserves($itemnumber); |
473 |
(undef, $canres, undef) = CheckReserves($itemnumber); |
475 |
|
474 |
|
476 |
- |
|
|