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

(-)a/C4/Reserves.pm (-3 / +16 lines)
Lines 313-322 sub CanItemBeReserved { Link Here
313
    my $ruleitemtype;    # itemtype of the matching issuing rule
313
    my $ruleitemtype;    # itemtype of the matching issuing rule
314
    my $allowedreserves  = 0; # Total number of holds allowed across all records
314
    my $allowedreserves  = 0; # Total number of holds allowed across all records
315
    my $holds_per_record = 1; # Total number of holds allowed for this one given record
315
    my $holds_per_record = 1; # Total number of holds allowed for this one given record
316
    my $holds_per_day    = 0; # Total number of holds allowed per day for the given patron
316
317
317
    # we retrieve borrowers and items informations #
318
    # we retrieve borrowers and items informations #
318
    # item->{itype} will come for biblioitems if necessery
319
    # item->{itype} will come for biblioitems if necessery
319
    my $item       = GetItem($itemnumber);
320
    my $item       = C4::Items::GetItem($itemnumber);
320
    my $biblio     = Koha::Biblios->find( $item->{biblionumber} );
321
    my $biblio     = Koha::Biblios->find( $item->{biblionumber} );
321
    my $patron = Koha::Patrons->find( $borrowernumber );
322
    my $patron = Koha::Patrons->find( $borrowernumber );
322
    my $borrower = $patron->unblessed;
323
    my $borrower = $patron->unblessed;
Lines 363-368 sub CanItemBeReserved { Link Here
363
        $ruleitemtype     = $rights->{itemtype};
364
        $ruleitemtype     = $rights->{itemtype};
364
        $allowedreserves  = $rights->{reservesallowed};
365
        $allowedreserves  = $rights->{reservesallowed};
365
        $holds_per_record = $rights->{holds_per_record};
366
        $holds_per_record = $rights->{holds_per_record};
367
        $holds_per_day    = $rights->{holds_per_day};
366
    }
368
    }
367
    else {
369
    else {
368
        $ruleitemtype = '*';
370
        $ruleitemtype = '*';
Lines 380-385 sub CanItemBeReserved { Link Here
380
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
382
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
381
    }
383
    }
382
384
385
    my $today_holds = Koha::Holds->search({
386
        borrowernumber => $borrowernumber,
387
        reservedate    => dt_from_string->date
388
    });
389
390
    if ( defined $holds_per_day &&
391
          (   ( $holds_per_day > 0 && $today_holds->count() >= $holds_per_day )
392
           or ( $holds_per_day == 0 ) )
393
        )  {
394
        return { status => 'tooManyReservesToday', limit => $holds_per_day };
395
    }
396
383
    # we retrieve count
397
    # we retrieve count
384
398
385
    $querycount .= "AND $branchfield = ?";
399
    $querycount .= "AND $branchfield = ?";
Lines 2126-2132 sub GetHoldRule { Link Here
2126
2140
2127
    my $sth = $dbh->prepare(
2141
    my $sth = $dbh->prepare(
2128
        q{
2142
        q{
2129
         SELECT categorycode, itemtype, branchcode, reservesallowed, holds_per_record
2143
         SELECT categorycode, itemtype, branchcode, reservesallowed, holds_per_record, holds_per_day
2130
           FROM issuingrules
2144
           FROM issuingrules
2131
          WHERE (categorycode in (?,'*') )
2145
          WHERE (categorycode in (?,'*') )
2132
            AND (itemtype IN (?,'*'))
2146
            AND (itemtype IN (?,'*'))
2133
- 

Return to bug 15486