|
Lines 327-332
sub CanItemBeReserved {
Link Here
|
| 327 |
my $ruleitemtype; # itemtype of the matching issuing rule |
327 |
my $ruleitemtype; # itemtype of the matching issuing rule |
| 328 |
my $allowedreserves = 0; # Total number of holds allowed across all records |
328 |
my $allowedreserves = 0; # Total number of holds allowed across all records |
| 329 |
my $holds_per_record = 1; # Total number of holds allowed for this one given record |
329 |
my $holds_per_record = 1; # Total number of holds allowed for this one given record |
|
|
330 |
my $holds_per_day = 0; # Total number of holds allowed per day for the given patron |
| 330 |
|
331 |
|
| 331 |
# we retrieve borrowers and items informations # |
332 |
# we retrieve borrowers and items informations # |
| 332 |
# item->{itype} will come for biblioitems if necessery |
333 |
# item->{itype} will come for biblioitems if necessery |
|
Lines 377-382
sub CanItemBeReserved {
Link Here
|
| 377 |
$ruleitemtype = $rights->{itemtype}; |
378 |
$ruleitemtype = $rights->{itemtype}; |
| 378 |
$allowedreserves = $rights->{reservesallowed}; |
379 |
$allowedreserves = $rights->{reservesallowed}; |
| 379 |
$holds_per_record = $rights->{holds_per_record}; |
380 |
$holds_per_record = $rights->{holds_per_record}; |
|
|
381 |
$holds_per_day = $rights->{holds_per_day} // 0; |
| 380 |
} |
382 |
} |
| 381 |
else { |
383 |
else { |
| 382 |
$ruleitemtype = '*'; |
384 |
$ruleitemtype = '*'; |
|
Lines 394-399
sub CanItemBeReserved {
Link Here
|
| 394 |
return "tooManyHoldsForThisRecord"; |
396 |
return "tooManyHoldsForThisRecord"; |
| 395 |
} |
397 |
} |
| 396 |
|
398 |
|
|
|
399 |
my $today_holds = Koha::Holds->search({ |
| 400 |
borrowernumber => $borrowernumber, |
| 401 |
reservedate => dt_from_string->date |
| 402 |
}); |
| 403 |
|
| 404 |
if ( $holds_per_day > 0 |
| 405 |
&& $today_holds->count() >= $holds_per_day ) { |
| 406 |
return "tooManyReservesToday"; |
| 407 |
} |
| 408 |
|
| 397 |
# we retrieve count |
409 |
# we retrieve count |
| 398 |
|
410 |
|
| 399 |
$querycount .= "AND $branchfield = ?"; |
411 |
$querycount .= "AND $branchfield = ?"; |
|
Lines 2345-2351
sub GetHoldRule {
Link Here
|
| 2345 |
|
2357 |
|
| 2346 |
my $sth = $dbh->prepare( |
2358 |
my $sth = $dbh->prepare( |
| 2347 |
q{ |
2359 |
q{ |
| 2348 |
SELECT categorycode, itemtype, branchcode, reservesallowed, holds_per_record |
2360 |
SELECT categorycode, itemtype, branchcode, reservesallowed, holds_per_record, holds_per_day |
| 2349 |
FROM issuingrules |
2361 |
FROM issuingrules |
| 2350 |
WHERE (categorycode in (?,'*') ) |
2362 |
WHERE (categorycode in (?,'*') ) |
| 2351 |
AND (itemtype IN (?,'*')) |
2363 |
AND (itemtype IN (?,'*')) |
| 2352 |
- |
|
|