View | Details | Raw Unified | Return to bug 9809
Collapse All | Expand All

(-)a/t/db_dependent/Circulation.t (-3 / +2 lines)
Lines 262-268 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
262
262
263
    my $renewing_borrower = GetMember( borrowernumber => $renewing_borrowernumber );
263
    my $renewing_borrower = GetMember( borrowernumber => $renewing_borrowernumber );
264
264
265
    my $constraint     = 'a';
266
    my $bibitems       = '';
265
    my $bibitems       = '';
267
    my $priority       = '1';
266
    my $priority       = '1';
268
    my $resdate        = undef;
267
    my $resdate        = undef;
Lines 289-295 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
289
    # Biblio-level hold, renewal test
288
    # Biblio-level hold, renewal test
290
    AddReserve(
289
    AddReserve(
291
        $branch, $reserving_borrowernumber, $biblionumber,
290
        $branch, $reserving_borrowernumber, $biblionumber,
292
        $constraint, $bibitems,  $priority, $resdate, $expdate, $notes,
291
        $bibitems,  $priority, $resdate, $expdate, $notes,
293
        $title, $checkitem, $found
292
        $title, $checkitem, $found
294
    );
293
    );
295
294
Lines 354-360 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
354
    # Item-level hold, renewal test
353
    # Item-level hold, renewal test
355
    AddReserve(
354
    AddReserve(
356
        $branch, $reserving_borrowernumber, $biblionumber,
355
        $branch, $reserving_borrowernumber, $biblionumber,
357
        $constraint, $bibitems,  $priority, $resdate, $expdate, $notes,
356
        $bibitems,  $priority, $resdate, $expdate, $notes,
358
        $title, $itemnumber, $found
357
        $title, $itemnumber, $found
359
    );
358
    );
360
359
(-)a/t/db_dependent/Holds.t (-6 lines)
Lines 68-74 foreach my $borrowernumber ( @borrowernumbers ) { Link Here
68
        $branch,
68
        $branch,
69
        $borrowernumber,
69
        $borrowernumber,
70
        $biblionumber,
70
        $biblionumber,
71
        my $constraint = 'a',
72
        my $bibitems = q{},
71
        my $bibitems = q{},
73
        my $priority,
72
        my $priority,
74
        my $resdate,
73
        my $resdate,
Lines 148-154 AddReserve( Link Here
148
    $branch,
147
    $branch,
149
    $borrowernumber,
148
    $borrowernumber,
150
    $biblionumber,
149
    $biblionumber,
151
    my $constraint = 'a',
152
    my $bibitems = q{},
150
    my $bibitems = q{},
153
    my $priority,
151
    my $priority,
154
    my $resdate,
152
    my $resdate,
Lines 254-260 AddReserve( Link Here
254
    $branch,
252
    $branch,
255
    $borrowernumbers[0],
253
    $borrowernumbers[0],
256
    $bibnum,
254
    $bibnum,
257
    'a',
258
    '',
255
    '',
259
    1,
256
    1,
260
);
257
);
Lines 271-277 AddReserve( Link Here
271
    $branch,
268
    $branch,
272
    $borrowernumbers[1],
269
    $borrowernumbers[1],
273
    $bibnum,
270
    $bibnum,
274
    'a',
275
    '',
271
    '',
276
    2,
272
    2,
277
);
273
);
Lines 292-298 AddReserve( Link Here
292
    $branch,
288
    $branch,
293
    $borrowernumbers[0],
289
    $borrowernumbers[0],
294
    $bibnum,
290
    $bibnum,
295
    'a',
296
    '',
291
    '',
297
    2,
292
    2,
298
);
293
);
Lines 325-331 AddReserve( Link Here
325
    $branch,
320
    $branch,
326
    $borrowernumbers[0],
321
    $borrowernumbers[0],
327
    $bibnum,
322
    $bibnum,
328
    'a',
329
    '',
323
    '',
330
    1,
324
    1,
331
);
325
);
(-)a/t/db_dependent/Holds/LocalHoldsPriority.t (-1 lines)
Lines 58-64 foreach my $borrowernumber (@borrowernumbers) { Link Here
58
        $branchcodes[$i],
58
        $branchcodes[$i],
59
        $borrowernumber,
59
        $borrowernumber,
60
        $biblionumber,
60
        $biblionumber,
61
        my $constraint = 'a',
62
        my $bibitems   = q{},
61
        my $bibitems   = q{},
63
        my $priority = $i,
62
        my $priority = $i,
64
        my $resdate,
63
        my $resdate,
(-)a/t/db_dependent/Holds/RevertWaitingStatus.t (-1 lines)
Lines 67-73 foreach my $borrowernumber (@borrowernumbers) { Link Here
67
        $branch,
67
        $branch,
68
        $borrowernumber,
68
        $borrowernumber,
69
        $biblionumber,
69
        $biblionumber,
70
        my $constraint = 'a',
71
        my $bibitems   = q{},
70
        my $bibitems   = q{},
72
        my $priority,
71
        my $priority,
73
        my $resdate,
72
        my $resdate,
(-)a/t/db_dependent/HoldsQueue.t (-2 / +1 lines)
Lines 95-105 foreach ( $borrower_branchcode, $least_cost_branch_code, @other_branches ) { Link Here
95
95
96
# Remove existing reserves, makes debugging easier
96
# Remove existing reserves, makes debugging easier
97
$dbh->do("DELETE FROM reserves");
97
$dbh->do("DELETE FROM reserves");
98
my $constraint = undef;
99
my $bibitems = undef;
98
my $bibitems = undef;
100
my $priority = 1;
99
my $priority = 1;
101
# Make a reserve
100
# Make a reserve
102
AddReserve ( $borrower_branchcode, $borrowernumber, $biblionumber, $constraint, $bibitems,  $priority );
101
AddReserve ( $borrower_branchcode, $borrowernumber, $biblionumber, $bibitems,  $priority );
103
#                           $resdate, $expdate, $notes, $title, $checkitem, $found
102
#                           $resdate, $expdate, $notes, $title, $checkitem, $found
104
$dbh->do("UPDATE reserves SET reservedate = DATE_SUB( reservedate, INTERVAL 1 DAY )");
103
$dbh->do("UPDATE reserves SET reservedate = DATE_SUB( reservedate, INTERVAL 1 DAY )");
105
104
(-)a/t/db_dependent/Reserves.t (-19 / +17 lines)
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
- 

Return to bug 9809