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 65-71 foreach my $borrowernumber ( @borrowernumbers ) { Link Here
65
        $branch,
65
        $branch,
66
        $borrowernumber,
66
        $borrowernumber,
67
        $biblionumber,
67
        $biblionumber,
68
        my $constraint = 'a',
69
        my $bibitems = q{},
68
        my $bibitems = q{},
70
        my $priority,
69
        my $priority,
71
        my $resdate,
70
        my $resdate,
Lines 131-137 AddReserve( Link Here
131
    $branch,
130
    $branch,
132
    $borrowernumber,
131
    $borrowernumber,
133
    $biblionumber,
132
    $biblionumber,
134
    my $constraint = 'a',
135
    my $bibitems = q{},
133
    my $bibitems = q{},
136
    my $priority,
134
    my $priority,
137
    my $resdate,
135
    my $resdate,
Lines 237-243 AddReserve( Link Here
237
    $branch,
235
    $branch,
238
    $borrowernumbers[0],
236
    $borrowernumbers[0],
239
    $bibnum,
237
    $bibnum,
240
    'a',
241
    '',
238
    '',
242
    1,
239
    1,
243
);
240
);
Lines 254-260 AddReserve( Link Here
254
    $branch,
251
    $branch,
255
    $borrowernumbers[1],
252
    $borrowernumbers[1],
256
    $bibnum,
253
    $bibnum,
257
    'a',
258
    '',
254
    '',
259
    2,
255
    2,
260
);
256
);
Lines 275-281 AddReserve( Link Here
275
    $branch,
271
    $branch,
276
    $borrowernumbers[0],
272
    $borrowernumbers[0],
277
    $bibnum,
273
    $bibnum,
278
    'a',
279
    '',
274
    '',
280
    2,
275
    2,
281
);
276
);
Lines 308-314 AddReserve( Link Here
308
    $branch,
303
    $branch,
309
    $borrowernumbers[0],
304
    $borrowernumbers[0],
310
    $bibnum,
305
    $bibnum,
311
    'a',
312
    '',
306
    '',
313
    1,
307
    1,
314
);
308
);
(-)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 99-105 my $borrower = GetMember( borrowernumber => $borrowernumber ); Link Here
99
my $biblionumber   = $bibnum;
99
my $biblionumber   = $bibnum;
100
my $barcode        = $testbarcode;
100
my $barcode        = $testbarcode;
101
101
102
my $constraint     = 'a';
103
my $bibitems       = '';
102
my $bibitems       = '';
104
my $priority       = '1';
103
my $priority       = '1';
105
my $resdate        = undef;
104
my $resdate        = undef;
Lines 112-118 my @branches = GetBranchesLoop(); Link Here
112
my $branch = $branches[0][0]{value};
111
my $branch = $branches[0][0]{value};
113
112
114
AddReserve($branch,    $borrowernumber, $biblionumber,
113
AddReserve($branch,    $borrowernumber, $biblionumber,
115
        $constraint, $bibitems,  $priority, $resdate, $expdate, $notes,
114
        $bibitems,  $priority, $resdate, $expdate, $notes,
116
        $title,      $checkitem, $found);
115
        $title,      $checkitem, $found);
117
116
118
my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode);
117
my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode);
Lines 223-235 my ($itemnum_cpl, $itemnum_fpl); Link Here
223
# (bug 11947)
222
# (bug 11947)
224
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
223
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
225
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
224
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
226
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
225
           $bibitems,  1, $resdate, $expdate, $notes,
227
           $title,      $checkitem, $found);
226
           $title,      $checkitem, $found);
228
AddReserve('FPL',  $requesters{'FPL'}, $bibnum2,
227
AddReserve('FPL',  $requesters{'FPL'}, $bibnum2,
229
           $constraint, $bibitems,  2, $resdate, $expdate, $notes,
228
           $bibitems,  2, $resdate, $expdate, $notes,
230
           $title,      $checkitem, $found);
229
           $title,      $checkitem, $found);
231
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
230
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
232
           $constraint, $bibitems,  3, $resdate, $expdate, $notes,
231
           $bibitems,  3, $resdate, $expdate, $notes,
233
           $title,      $checkitem, $found);
232
           $title,      $checkitem, $found);
234
ModReserveAffect($itemnum_cpl, $requesters{'RPL'}, 0);
233
ModReserveAffect($itemnum_cpl, $requesters{'RPL'}, 0);
235
234
Lines 244-256 is($reserves[2]{priority}, 2, 'Item is correctly priority 2'); Link Here
244
243
245
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
244
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
246
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
245
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
247
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
246
           $bibitems,  1, $resdate, $expdate, $notes,
248
           $title,      $checkitem, $found);
247
           $title,      $checkitem, $found);
249
AddReserve('FPL',  $requesters{'FPL'}, $bibnum2,
248
AddReserve('FPL',  $requesters{'FPL'}, $bibnum2,
250
           $constraint, $bibitems,  2, $resdate, $expdate, $notes,
249
           $bibitems,  2, $resdate, $expdate, $notes,
251
           $title,      $checkitem, $found);
250
           $title,      $checkitem, $found);
252
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
251
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
253
           $constraint, $bibitems,  3, $resdate, $expdate, $notes,
252
           $bibitems,  3, $resdate, $expdate, $notes,
254
           $title,      $checkitem, $found);
253
           $title,      $checkitem, $found);
255
254
256
# Ensure that the item's home library controls hold policy lookup
255
# Ensure that the item's home library controls hold policy lookup
Lines 300-306 $resdate= undef; #defaults to today in AddReserve Link Here
300
$expdate= undef; #no expdate
299
$expdate= undef; #no expdate
301
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
300
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
302
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
301
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
303
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
302
           $bibitems,  1, $resdate, $expdate, $notes,
304
           $title,      $checkitem, $found);
303
           $title,      $checkitem, $found);
305
($status)=CheckReserves($itemnumber,undef,undef);
304
($status)=CheckReserves($itemnumber,undef,undef);
306
is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead');
305
is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead');
Lines 315-321 $resdate->add_duration(DateTime::Duration->new(days => 4)); Link Here
315
$resdate=output_pref($resdate);
314
$resdate=output_pref($resdate);
316
$expdate= undef; #no expdate
315
$expdate= undef; #no expdate
317
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
316
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
318
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
317
           $bibitems,  1, $resdate, $expdate, $notes,
319
           $title,      $checkitem, $found);
318
           $title,      $checkitem, $found);
320
($status)=CheckReserves($itemnumber,undef,undef);
319
($status)=CheckReserves($itemnumber,undef,undef);
321
is( $status, '', 'CheckReserves returns no future reserve without lookahead');
320
is( $status, '', 'CheckReserves returns no future reserve without lookahead');
Lines 372-385 $resdate= dt_from_string(); Link Here
372
$resdate->add_duration(DateTime::Duration->new(days => 2));
371
$resdate->add_duration(DateTime::Duration->new(days => 2));
373
$resdate=output_pref($resdate);
372
$resdate=output_pref($resdate);
374
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
373
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
375
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
374
           $bibitems,  1, $resdate, $expdate, $notes,
376
           $title,      $checkitem, $found);
375
           $title,      $checkitem, $found);
377
my @results= GetReservesFromItemnumber($itemnumber);
376
my @results= GetReservesFromItemnumber($itemnumber);
378
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future next available hold');
377
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future next available hold');
379
# 9788b: GetReservesFromItemnumber does not return future item level hold
378
# 9788b: GetReservesFromItemnumber does not return future item level hold
380
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
379
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
381
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
380
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
382
           $constraint, $bibitems,  1, $resdate, $expdate, $notes,
381
           $bibitems,  1, $resdate, $expdate, $notes,
383
           $title,      $itemnumber, $found); #item level hold
382
           $title,      $itemnumber, $found); #item level hold
384
@results= GetReservesFromItemnumber($itemnumber);
383
@results= GetReservesFromItemnumber($itemnumber);
385
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future item level hold');
384
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future item level hold');
Lines 394-400 my $p = C4::Reserves::CalculatePriority($bibnum2); Link Here
394
is($p, 4, 'CalculatePriority should now return priority 4');
393
is($p, 4, 'CalculatePriority should now return priority 4');
395
$resdate=undef;
394
$resdate=undef;
396
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
395
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
397
           $constraint, $bibitems,  $p, $resdate, $expdate, $notes,
396
           $bibitems,  $p, $resdate, $expdate, $notes,
398
           $title,      $checkitem, $found);
397
           $title,      $checkitem, $found);
399
$p = C4::Reserves::CalculatePriority($bibnum2);
398
$p = C4::Reserves::CalculatePriority($bibnum2);
400
is($p, 5, 'CalculatePriority should now return priority 5');
399
is($p, 5, 'CalculatePriority should now return priority 5');
Lines 404-410 $p = C4::Reserves::CalculatePriority($bibnum); Link Here
404
is($p, 1, 'CalculatePriority should now return priority 1');
403
is($p, 1, 'CalculatePriority should now return priority 1');
405
#add a new reserve and confirm it to waiting
404
#add a new reserve and confirm it to waiting
406
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
405
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
407
           $constraint, $bibitems,  $p, $resdate, $expdate, $notes,
406
           $bibitems,  $p, $resdate, $expdate, $notes,
408
           $title,      $itemnumber, $found);
407
           $title,      $itemnumber, $found);
409
$p = C4::Reserves::CalculatePriority($bibnum);
408
$p = C4::Reserves::CalculatePriority($bibnum);
410
is($p, 2, 'CalculatePriority should now return priority 2');
409
is($p, 2, 'CalculatePriority should now return priority 2');
Lines 413-419 $p = C4::Reserves::CalculatePriority($bibnum); Link Here
413
is($p, 1, 'CalculatePriority should now return priority 1');
412
is($p, 1, 'CalculatePriority should now return priority 1');
414
#add another biblio hold, no resdate
413
#add another biblio hold, no resdate
415
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
414
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
416
           $constraint, $bibitems,  $p, $resdate, $expdate, $notes,
415
           $bibitems,  $p, $resdate, $expdate, $notes,
417
           $title,      $checkitem, $found);
416
           $title,      $checkitem, $found);
418
$p = C4::Reserves::CalculatePriority($bibnum);
417
$p = C4::Reserves::CalculatePriority($bibnum);
419
is($p, 2, 'CalculatePriority should now return priority 2');
418
is($p, 2, 'CalculatePriority should now return priority 2');
Lines 422-428 C4::Context->set_preference('AllowHoldDateInFuture', 1); Link Here
422
$resdate= dt_from_string();
421
$resdate= dt_from_string();
423
$resdate->add_duration(DateTime::Duration->new(days => 1));
422
$resdate->add_duration(DateTime::Duration->new(days => 1));
424
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
423
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
425
           $constraint, $bibitems,  $p, output_pref($resdate), $expdate, $notes,
424
           $bibitems,  $p, output_pref($resdate), $expdate, $notes,
426
           $title,      $checkitem, $found);
425
           $title,      $checkitem, $found);
427
$p = C4::Reserves::CalculatePriority($bibnum);
426
$p = C4::Reserves::CalculatePriority($bibnum);
428
is($p, 2, 'CalculatePriority should now still return priority 2');
427
is($p, 2, 'CalculatePriority should now still return priority 2');
Lines 434-440 is($p, 3, 'CalculatePriority should now return priority 3'); Link Here
434
# Tests for cancel reserves by users from OPAC.
433
# Tests for cancel reserves by users from OPAC.
435
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
434
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
436
AddReserve('CPL',  $requesters{'CPL'}, $item_bibnum,
435
AddReserve('CPL',  $requesters{'CPL'}, $item_bibnum,
437
           $constraint, $bibitems,  1, undef, $expdate, $notes,
436
           $bibitems,  1, undef, $expdate, $notes,
438
           $title,      $checkitem, '');
437
           $title,      $checkitem, '');
439
my (undef, $canres, undef) = CheckReserves($itemnumber);
438
my (undef, $canres, undef) = CheckReserves($itemnumber);
440
439
Lines 464-470 is($cancancel, 0, 'Reserve in transfer status cant be canceled'); Link Here
464
463
465
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
464
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
466
AddReserve('CPL',  $requesters{'CPL'}, $item_bibnum,
465
AddReserve('CPL',  $requesters{'CPL'}, $item_bibnum,
467
           $constraint, $bibitems,  1, undef, $expdate, $notes,
466
           $bibitems,  1, undef, $expdate, $notes,
468
           $title,      $checkitem, '');
467
           $title,      $checkitem, '');
469
(undef, $canres, undef) = CheckReserves($itemnumber);
468
(undef, $canres, undef) = CheckReserves($itemnumber);
470
469
471
- 

Return to bug 9809