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

(-)a/C4/ILSDI/Services.pm (-4 / +4 lines)
Lines 624-633 sub HoldTitle { Link Here
624
624
625
    # Add the reserve
625
    # Add the reserve
626
    #    $branch,    $borrowernumber, $biblionumber,
626
    #    $branch,    $borrowernumber, $biblionumber,
627
    #    $constraint, $bibitems,  $priority, $resdate, $expdate, $notes,
627
    #    $constraint,  $priority, $resdate, $expdate, $notes,
628
    #    $title,      $checkitem, $found
628
    #    $title,      $checkitem, $found
629
    my $priority= C4::Reserves::CalculatePriority( $biblionumber );
629
    my $priority= C4::Reserves::CalculatePriority( $biblionumber );
630
    AddReserve( $branch, $borrowernumber, $biblionumber, undef, $priority, undef, undef, undef, $title, undef, undef );
630
    AddReserve( $branch, $borrowernumber, $biblionumber, $priority, undef, undef, undef, $title, undef, undef );
631
631
632
    # Hashref building
632
    # Hashref building
633
    my $out;
633
    my $out;
Lines 701-710 sub HoldItem { Link Here
701
701
702
    # Add the reserve
702
    # Add the reserve
703
    #    $branch,    $borrowernumber, $biblionumber,
703
    #    $branch,    $borrowernumber, $biblionumber,
704
    #    $constraint, $bibitems,  $priority, $resdate, $expdate, $notes,
704
    #    $constraint,  $priority, $resdate, $expdate, $notes,
705
    #    $title,      $checkitem, $found
705
    #    $title,      $checkitem, $found
706
    my $priority= C4::Reserves::CalculatePriority( $biblionumber );
706
    my $priority= C4::Reserves::CalculatePriority( $biblionumber );
707
    AddReserve( $branch, $borrowernumber, $biblionumber, undef, $priority, undef, undef, undef, $title, $itemnumber, undef );
707
    AddReserve( $branch, $borrowernumber, $biblionumber, $priority, undef, undef, undef, $title, $itemnumber, undef );
708
708
709
    # Hashref building
709
    # Hashref building
710
    my $out;
710
    my $out;
(-)a/C4/Reserves.pm (-2 / +2 lines)
Lines 145-158 BEGIN { Link Here
145
145
146
=head2 AddReserve
146
=head2 AddReserve
147
147
148
    AddReserve($branch,$borrowernumber,$biblionumber,$bibitems,$priority,$resdate,$expdate,$notes,$title,$checkitem,$found)
148
    AddReserve($branch,$borrowernumber,$biblionumber,$priority,$resdate,$expdate,$notes,$title,$checkitem,$found)
149
149
150
=cut
150
=cut
151
151
152
sub AddReserve {
152
sub AddReserve {
153
    my (
153
    my (
154
        $branch,    $borrowernumber, $biblionumber,
154
        $branch,    $borrowernumber, $biblionumber,
155
        $bibitems,  $priority, $resdate, $expdate, $notes,
155
        $priority, $resdate, $expdate, $notes,
156
        $title,      $checkitem, $found
156
        $title,      $checkitem, $found
157
    ) = @_;
157
    ) = @_;
158
    my $dbh     = C4::Context->dbh;
158
    my $dbh     = C4::Context->dbh;
(-)a/C4/SIP/ILS/Transaction/Hold.pm (-1 / +1 lines)
Lines 63-69 sub do_hold { Link Here
63
        return $self;
63
        return $self;
64
    }
64
    }
65
    my $bibno = $bib->{biblionumber};
65
    my $bibno = $bib->{biblionumber};
66
    AddReserve( $branch, $borrower->{borrowernumber}, $bibno, GetBiblioItemByBiblioNumber($bibno) );
66
    AddReserve( $branch, $borrower->{borrowernumber}, $bibno );
67
67
68
    # unfortunately no meaningful return value
68
    # unfortunately no meaningful return value
69
    $self->ok(1);
69
    $self->ok(1);
(-)a/opac/opac-reserve.pl (-2 / +1 lines)
Lines 285-292 if ( $query->param('place_reserve') ) { Link Here
285
        if ($canreserve) {
285
        if ($canreserve) {
286
            AddReserve(
286
            AddReserve(
287
                $branch,      $borrowernumber,
287
                $branch,      $borrowernumber,
288
                $biblioNum,
288
                $biblioNum,   $rank,
289
                [$biblioNum], $rank,
290
                $startdate,   $expiration_date,
289
                $startdate,   $expiration_date,
291
                $notes,       $biblioData->{title},
290
                $notes,       $biblioData->{title},
292
                $itemNum,     $found
291
                $itemNum,     $found
(-)a/reserve/placerequest.pl (-17 / +3 lines)
Lines 37-43 my $input = CGI->new(); Link Here
37
37
38
checkauth($input, 0, { reserveforothers => 'place_holds' }, 'intranet');
38
checkauth($input, 0, { reserveforothers => 'place_holds' }, 'intranet');
39
39
40
my @bibitems=$input->param('biblioitem');
41
my @reqbib=$input->param('reqbib'); 
40
my @reqbib=$input->param('reqbib'); 
42
my $biblionumber=$input->param('biblionumber');
41
my $biblionumber=$input->param('biblionumber');
43
my $borrowernumber=$input->param('borrowernumber');
42
my $borrowernumber=$input->param('borrowernumber');
Lines 80-98 if (defined $checkitem && $checkitem ne ''){ Link Here
80
if ($type eq 'str8' && $borrower){
79
if ($type eq 'str8' && $borrower){
81
80
82
    foreach my $biblionumber (keys %bibinfos) {
81
    foreach my $biblionumber (keys %bibinfos) {
83
        my $count=@bibitems;
84
        @bibitems=sort @bibitems;
85
        my $i2=1;
86
        my @realbi;
87
        $realbi[0]=$bibitems[0];
88
        for (my $i=1;$i<$count;$i++) {
89
            my $i3=$i2-1;
90
            if ($realbi[$i3] ne $bibitems[$i]) {
91
                $realbi[$i2]=$bibitems[$i];
92
                $i2++;
93
            }
94
        }
95
        my $const;
96
82
97
    if (defined $checkitem && $checkitem ne ''){
83
    if (defined $checkitem && $checkitem ne ''){
98
		my $item = GetItem($checkitem);
84
		my $item = GetItem($checkitem);
Lines 105-115 if ($type eq 'str8' && $borrower){ Link Here
105
91
106
        if ($multi_hold) {
92
        if ($multi_hold) {
107
            my $bibinfo = $bibinfos{$biblionumber};
93
            my $bibinfo = $bibinfos{$biblionumber};
108
            AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,[$biblionumber],
94
            AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,$bibinfo->{rank},
109
                       $bibinfo->{rank},$startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem,$found);
95
                       $startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem,$found);
110
        } else {
96
        } else {
111
            # place a request on 1st available
97
            # place a request on 1st available
112
            AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem,$found);
98
            AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem,$found);
113
        }
99
        }
114
    }
100
    }
115
101
(-)a/serials/routing-preview.pl (-2 / +1 lines)
Lines 64-70 my ($template, $loggedinuser, $cookie); Link Here
64
if($ok){
64
if($ok){
65
    # get biblio information....
65
    # get biblio information....
66
    my $biblio = $subs->{'biblionumber'};
66
    my $biblio = $subs->{'biblionumber'};
67
	my ($count2,@bibitems) = GetBiblioItemByBiblioNumber($biblio);
68
	my @itemresults = GetItemsInfo( $subs->{biblionumber} );
67
	my @itemresults = GetItemsInfo( $subs->{biblionumber} );
69
	my $branch = $itemresults[0]->{'holdingbranch'};
68
	my $branch = $itemresults[0]->{'holdingbranch'};
70
	my $branchname = GetBranchName($branch);
69
	my $branchname = GetBranchName($branch);
Lines 94-100 if($ok){ Link Here
94
                    branchcode     => $branch
93
                    branchcode     => $branch
95
                });
94
                });
96
            } else {
95
            } else {
97
                AddReserve($branch,$routing->{borrowernumber},$biblio,\@bibitems,$routing->{ranking}, undef, undef, $notes,$title);
96
                AddReserve($branch,$routing->{borrowernumber},$biblio,$routing->{ranking}, undef, undef, $notes,$title);
98
        }
97
        }
99
    }
98
    }
100
	}
99
	}
(-)a/t/db_dependent/Circulation.t (-6 / +5 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 $bibitems       = '';
266
    my $priority       = '1';
265
    my $priority       = '1';
267
    my $resdate        = undef;
266
    my $resdate        = undef;
268
    my $expdate        = undef;
267
    my $expdate        = undef;
Lines 288-295 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
288
    # Biblio-level hold, renewal test
287
    # Biblio-level hold, renewal test
289
    AddReserve(
288
    AddReserve(
290
        $branch, $reserving_borrowernumber, $biblionumber,
289
        $branch, $reserving_borrowernumber, $biblionumber,
291
        $bibitems,  $priority, $resdate, $expdate, $notes,
290
        $priority, $resdate, $expdate, $notes, $title,
292
        $title, $checkitem, $found
291
        $checkitem, $found
293
    );
292
    );
294
293
295
    # Testing of feature to allow the renewal of reserved items if other items on the record can fill all needed holds
294
    # Testing of feature to allow the renewal of reserved items if other items on the record can fill all needed holds
Lines 353-360 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
353
    # Item-level hold, renewal test
352
    # Item-level hold, renewal test
354
    AddReserve(
353
    AddReserve(
355
        $branch, $reserving_borrowernumber, $biblionumber,
354
        $branch, $reserving_borrowernumber, $biblionumber,
356
        $bibitems,  $priority, $resdate, $expdate, $notes,
355
        $priority, $resdate, $expdate, $notes, $title,
357
        $title, $itemnumber, $found
356
        $itemnumber, $found
358
    );
357
    );
359
358
360
    ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber, 1);
359
    ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber, 1);
Lines 654-660 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
654
653
655
    AddReserve(
654
    AddReserve(
656
        'MPL', $borrowernumber2, $biblionumber,
655
        'MPL', $borrowernumber2, $biblionumber,
657
        '',  1, undef, undef, '',
656
        1, undef, undef, '',
658
        undef, undef, undef
657
        undef, undef, undef
659
    );
658
    );
660
659
(-)a/t/db_dependent/Holds.t (-7 / +1 lines)
Lines 69-75 foreach my $borrowernumber ( @borrowernumbers ) { Link Here
69
        $branch,
69
        $branch,
70
        $borrowernumber,
70
        $borrowernumber,
71
        $biblionumber,
71
        $biblionumber,
72
        my $bibitems = q{},
73
        my $priority,
72
        my $priority,
74
        my $resdate,
73
        my $resdate,
75
        my $expdate,
74
        my $expdate,
Lines 148-154 AddReserve( Link Here
148
    $branch,
147
    $branch,
149
    $borrowernumber,
148
    $borrowernumber,
150
    $biblionumber,
149
    $biblionumber,
151
    my $bibitems = q{},
152
    my $priority,
150
    my $priority,
153
    my $resdate,
151
    my $resdate,
154
    my $expdate,
152
    my $expdate,
Lines 253-259 AddReserve( Link Here
253
    $branch,
251
    $branch,
254
    $borrowernumbers[0],
252
    $borrowernumbers[0],
255
    $bibnum,
253
    $bibnum,
256
    '',
257
    1,
254
    1,
258
);
255
);
259
256
Lines 269-275 AddReserve( Link Here
269
    $branch,
266
    $branch,
270
    $borrowernumbers[1],
267
    $borrowernumbers[1],
271
    $bibnum,
268
    $bibnum,
272
    '',
273
    2,
269
    2,
274
);
270
);
275
my $reserveid2 = C4::Reserves::GetReserveId(
271
my $reserveid2 = C4::Reserves::GetReserveId(
Lines 289-295 AddReserve( Link Here
289
    $branch,
285
    $branch,
290
    $borrowernumbers[0],
286
    $borrowernumbers[0],
291
    $bibnum,
287
    $bibnum,
292
    '',
293
    2,
288
    2,
294
);
289
);
295
my $reserveid3 = C4::Reserves::GetReserveId(
290
my $reserveid3 = C4::Reserves::GetReserveId(
Lines 321-327 AddReserve( Link Here
321
    $branch,
316
    $branch,
322
    $borrowernumbers[0],
317
    $borrowernumbers[0],
323
    $bibnum,
318
    $bibnum,
324
    '',
325
    1,
319
    1,
326
);
320
);
327
ok(
321
ok(
Lines 438-444 $dbh->do( Link Here
438
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ),
432
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ),
439
    'OK', 'Patron can reserve item with hold limit of 1, no holds placed' );
433
    'OK', 'Patron can reserve item with hold limit of 1, no holds placed' );
440
434
441
my $res_id = AddReserve( $branch, $borrowernumbers[0], $bibnum, '', 1, );
435
my $res_id = AddReserve( $branch, $borrowernumbers[0], $bibnum, 1, );
442
436
443
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ),
437
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ),
444
    'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' );
438
    'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' );
(-)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 $bibitems   = q{},
62
        my $priority = $i,
61
        my $priority = $i,
63
        my $resdate,
62
        my $resdate,
64
        my $expdate,
63
        my $expdate,
(-)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 $bibitems   = q{},
71
        my $priority,
70
        my $priority,
72
        my $resdate,
71
        my $resdate,
73
        my $expdate,
72
        my $expdate,
(-)a/t/db_dependent/Reserves.t (-22 / +18 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 $bibitems       = '';
104
my $priority       = '1';
103
my $priority       = '1';
105
my $resdate        = undef;
104
my $resdate        = undef;
106
my $expdate        = undef;
105
my $expdate        = undef;
Lines 112-119 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
        $bibitems,  $priority, $resdate, $expdate, $notes,
114
        $priority, $resdate, $expdate, $notes, $title,
116
        $title,      $checkitem, $found);
115
        $checkitem, $found);
117
116
118
my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode);
117
my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode);
119
118
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
           $bibitems,  1, $resdate, $expdate, $notes,
225
           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
           $bibitems,  2, $resdate, $expdate, $notes,
228
           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
           $bibitems,  3, $resdate, $expdate, $notes,
231
           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 248-260 is( $reserves[0]->borrowernumber(), $requesters{'RPL'}, 'GetWaiting got the rese Link Here
248
247
249
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
248
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
250
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
249
AddReserve('RPL',  $requesters{'RPL'}, $bibnum2,
251
           $bibitems,  1, $resdate, $expdate, $notes,
250
           1, $resdate, $expdate, $notes,
252
           $title,      $checkitem, $found);
251
           $title,      $checkitem, $found);
253
AddReserve('FPL',  $requesters{'FPL'}, $bibnum2,
252
AddReserve('FPL',  $requesters{'FPL'}, $bibnum2,
254
           $bibitems,  2, $resdate, $expdate, $notes,
253
           2, $resdate, $expdate, $notes,
255
           $title,      $checkitem, $found);
254
           $title,      $checkitem, $found);
256
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
255
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
257
           $bibitems,  3, $resdate, $expdate, $notes,
256
           3, $resdate, $expdate, $notes,
258
           $title,      $checkitem, $found);
257
           $title,      $checkitem, $found);
259
258
260
# Ensure that the item's home library controls hold policy lookup
259
# Ensure that the item's home library controls hold policy lookup
Lines 304-310 $resdate= undef; #defaults to today in AddReserve Link Here
304
$expdate= undef; #no expdate
303
$expdate= undef; #no expdate
305
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
304
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
306
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
305
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
307
           $bibitems,  1, $resdate, $expdate, $notes,
306
           1, $resdate, $expdate, $notes,
308
           $title,      $checkitem, $found);
307
           $title,      $checkitem, $found);
309
($status)=CheckReserves($itemnumber,undef,undef);
308
($status)=CheckReserves($itemnumber,undef,undef);
310
is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead');
309
is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead');
Lines 319-325 $resdate->add_duration(DateTime::Duration->new(days => 4)); Link Here
319
$resdate=output_pref($resdate);
318
$resdate=output_pref($resdate);
320
$expdate= undef; #no expdate
319
$expdate= undef; #no expdate
321
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
320
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
322
           $bibitems,  1, $resdate, $expdate, $notes,
321
           1, $resdate, $expdate, $notes,
323
           $title,      $checkitem, $found);
322
           $title,      $checkitem, $found);
324
($status)=CheckReserves($itemnumber,undef,undef);
323
($status)=CheckReserves($itemnumber,undef,undef);
325
is( $status, '', 'CheckReserves returns no future reserve without lookahead');
324
is( $status, '', 'CheckReserves returns no future reserve without lookahead');
Lines 376-389 $resdate= dt_from_string(); Link Here
376
$resdate->add_duration(DateTime::Duration->new(days => 2));
375
$resdate->add_duration(DateTime::Duration->new(days => 2));
377
$resdate=output_pref($resdate);
376
$resdate=output_pref($resdate);
378
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
377
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
379
           $bibitems,  1, $resdate, $expdate, $notes,
378
           1, $resdate, $expdate, $notes,
380
           $title,      $checkitem, $found);
379
           $title,      $checkitem, $found);
381
my @results= GetReservesFromItemnumber($itemnumber);
380
my @results= GetReservesFromItemnumber($itemnumber);
382
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future next available hold');
381
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future next available hold');
383
# 9788b: GetReservesFromItemnumber does not return future item level hold
382
# 9788b: GetReservesFromItemnumber does not return future item level hold
384
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
383
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
385
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
384
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
386
           $bibitems,  1, $resdate, $expdate, $notes,
385
           1, $resdate, $expdate, $notes,
387
           $title,      $itemnumber, $found); #item level hold
386
           $title,      $itemnumber, $found); #item level hold
388
@results= GetReservesFromItemnumber($itemnumber);
387
@results= GetReservesFromItemnumber($itemnumber);
389
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future item level hold');
388
is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future item level hold');
Lines 398-404 my $p = C4::Reserves::CalculatePriority($bibnum2); Link Here
398
is($p, 4, 'CalculatePriority should now return priority 4');
397
is($p, 4, 'CalculatePriority should now return priority 4');
399
$resdate=undef;
398
$resdate=undef;
400
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
399
AddReserve('CPL',  $requesters{'CPL'}, $bibnum2,
401
           $bibitems,  $p, $resdate, $expdate, $notes,
400
           $p, $resdate, $expdate, $notes,
402
           $title,      $checkitem, $found);
401
           $title,      $checkitem, $found);
403
$p = C4::Reserves::CalculatePriority($bibnum2);
402
$p = C4::Reserves::CalculatePriority($bibnum2);
404
is($p, 5, 'CalculatePriority should now return priority 5');
403
is($p, 5, 'CalculatePriority should now return priority 5');
Lines 408-414 $p = C4::Reserves::CalculatePriority($bibnum); Link Here
408
is($p, 1, 'CalculatePriority should now return priority 1');
407
is($p, 1, 'CalculatePriority should now return priority 1');
409
#add a new reserve and confirm it to waiting
408
#add a new reserve and confirm it to waiting
410
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
409
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
411
           $bibitems,  $p, $resdate, $expdate, $notes,
410
           $p, $resdate, $expdate, $notes,
412
           $title,      $itemnumber, $found);
411
           $title,      $itemnumber, $found);
413
$p = C4::Reserves::CalculatePriority($bibnum);
412
$p = C4::Reserves::CalculatePriority($bibnum);
414
is($p, 2, 'CalculatePriority should now return priority 2');
413
is($p, 2, 'CalculatePriority should now return priority 2');
Lines 417-423 $p = C4::Reserves::CalculatePriority($bibnum); Link Here
417
is($p, 1, 'CalculatePriority should now return priority 1');
416
is($p, 1, 'CalculatePriority should now return priority 1');
418
#add another biblio hold, no resdate
417
#add another biblio hold, no resdate
419
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
418
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
420
           $bibitems,  $p, $resdate, $expdate, $notes,
419
           $p, $resdate, $expdate, $notes,
421
           $title,      $checkitem, $found);
420
           $title,      $checkitem, $found);
422
$p = C4::Reserves::CalculatePriority($bibnum);
421
$p = C4::Reserves::CalculatePriority($bibnum);
423
is($p, 2, 'CalculatePriority should now return priority 2');
422
is($p, 2, 'CalculatePriority should now return priority 2');
Lines 426-432 C4::Context->set_preference('AllowHoldDateInFuture', 1); Link Here
426
$resdate= dt_from_string();
425
$resdate= dt_from_string();
427
$resdate->add_duration(DateTime::Duration->new(days => 1));
426
$resdate->add_duration(DateTime::Duration->new(days => 1));
428
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
427
AddReserve('CPL',  $requesters{'CPL'}, $bibnum,
429
           $bibitems,  $p, output_pref($resdate), $expdate, $notes,
428
           $p, output_pref($resdate), $expdate, $notes,
430
           $title,      $checkitem, $found);
429
           $title,      $checkitem, $found);
431
$p = C4::Reserves::CalculatePriority($bibnum);
430
$p = C4::Reserves::CalculatePriority($bibnum);
432
is($p, 2, 'CalculatePriority should now still return priority 2');
431
is($p, 2, 'CalculatePriority should now still return priority 2');
Lines 438-444 is($p, 3, 'CalculatePriority should now return priority 3'); Link Here
438
# Tests for cancel reserves by users from OPAC.
437
# Tests for cancel reserves by users from OPAC.
439
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
438
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
440
AddReserve('CPL',  $requesters{'CPL'}, $item_bibnum,
439
AddReserve('CPL',  $requesters{'CPL'}, $item_bibnum,
441
           $bibitems,  1, undef, $expdate, $notes,
440
           1, undef, $expdate, $notes,
442
           $title,      $checkitem, '');
441
           $title,      $checkitem, '');
443
my (undef, $canres, undef) = CheckReserves($itemnumber);
442
my (undef, $canres, undef) = CheckReserves($itemnumber);
444
443
Lines 468-474 is($cancancel, 0, 'Reserve in transfer status cant be canceled'); Link Here
468
467
469
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
468
$dbh->do('DELETE FROM reserves', undef, ($bibnum));
470
AddReserve('CPL',  $requesters{'CPL'}, $item_bibnum,
469
AddReserve('CPL',  $requesters{'CPL'}, $item_bibnum,
471
           $bibitems,  1, undef, $expdate, $notes,
470
           1, undef, $expdate, $notes,
472
           $title,      $checkitem, '');
471
           $title,      $checkitem, '');
473
(undef, $canres, undef) = CheckReserves($itemnumber);
472
(undef, $canres, undef) = CheckReserves($itemnumber);
474
473
Lines 545-551 my $bz14464_reserve = AddReserve( Link Here
545
    'CPL',
544
    'CPL',
546
    $borrowernumber,
545
    $borrowernumber,
547
    $bibnum,
546
    $bibnum,
548
    undef,
549
    '1',
547
    '1',
550
    undef,
548
    undef,
551
    undef,
549
    undef,
Lines 569-575 $bz14464_reserve = AddReserve( Link Here
569
    'CPL',
567
    'CPL',
570
    $borrowernumber,
568
    $borrowernumber,
571
    $bibnum,
569
    $bibnum,
572
    undef,
573
    '1',
570
    '1',
574
    undef,
571
    undef,
575
    undef,
572
    undef,
Lines 591-597 $bz14464_reserve = AddReserve( Link Here
591
    'CPL',
588
    'CPL',
592
    $borrowernumber,
589
    $borrowernumber,
593
    $bibnum,
590
    $bibnum,
594
    undef,
595
    '1',
591
    '1',
596
    undef,
592
    undef,
597
    undef,
593
    undef,
(-)a/t/db_dependent/Reserves/GetReserveFee.t (-2 lines)
Lines 115-121 sub addreserve { Link Here
115
        'CPL',
115
        'CPL',
116
        $_[0],
116
        $_[0],
117
        $biblio->{biblionumber},
117
        $biblio->{biblionumber},
118
        undef,
119
        '1',
118
        '1',
120
        undef,
119
        undef,
121
        undef,
120
        undef,
122
- 

Return to bug 14711