Lines 303-308
sub CanItemBeReserved {
Link Here
|
303 |
my $ruleitemtype; # itemtype of the matching issuing rule |
303 |
my $ruleitemtype; # itemtype of the matching issuing rule |
304 |
my $allowedreserves = 0; # Total number of holds allowed across all records |
304 |
my $allowedreserves = 0; # Total number of holds allowed across all records |
305 |
my $holds_per_record = 1; # Total number of holds allowed for this one given record |
305 |
my $holds_per_record = 1; # Total number of holds allowed for this one given record |
|
|
306 |
my $holds_per_day = 0; # Total number of holds allowed per day for the given patron |
306 |
|
307 |
|
307 |
# we retrieve borrowers and items informations # |
308 |
# we retrieve borrowers and items informations # |
308 |
# item->{itype} will come for biblioitems if necessery |
309 |
# item->{itype} will come for biblioitems if necessery |
Lines 353-358
sub CanItemBeReserved {
Link Here
|
353 |
$ruleitemtype = $rights->{itemtype}; |
354 |
$ruleitemtype = $rights->{itemtype}; |
354 |
$allowedreserves = $rights->{reservesallowed}; |
355 |
$allowedreserves = $rights->{reservesallowed}; |
355 |
$holds_per_record = $rights->{holds_per_record}; |
356 |
$holds_per_record = $rights->{holds_per_record}; |
|
|
357 |
$holds_per_day = $rights->{holds_per_day}; |
356 |
} |
358 |
} |
357 |
else { |
359 |
else { |
358 |
$ruleitemtype = '*'; |
360 |
$ruleitemtype = '*'; |
Lines 370-375
sub CanItemBeReserved {
Link Here
|
370 |
return "tooManyHoldsForThisRecord"; |
372 |
return "tooManyHoldsForThisRecord"; |
371 |
} |
373 |
} |
372 |
|
374 |
|
|
|
375 |
my $today_holds = Koha::Holds->search({ |
376 |
borrowernumber => $borrowernumber, |
377 |
reservedate => dt_from_string->date |
378 |
}); |
379 |
|
380 |
if ( defined $holds_per_day && |
381 |
( ( $holds_per_day > 0 && $today_holds->count() >= $holds_per_day ) |
382 |
or ( $holds_per_day == 0 ) ) |
383 |
) { |
384 |
return "tooManyReservesToday"; |
385 |
} |
386 |
|
373 |
# we retrieve count |
387 |
# we retrieve count |
374 |
|
388 |
|
375 |
$querycount .= "AND $branchfield = ?"; |
389 |
$querycount .= "AND $branchfield = ?"; |
Lines 2148-2154
sub GetHoldRule {
Link Here
|
2148 |
|
2162 |
|
2149 |
my $sth = $dbh->prepare( |
2163 |
my $sth = $dbh->prepare( |
2150 |
q{ |
2164 |
q{ |
2151 |
SELECT categorycode, itemtype, branchcode, reservesallowed, holds_per_record |
2165 |
SELECT categorycode, itemtype, branchcode, reservesallowed, holds_per_record, holds_per_day |
2152 |
FROM issuingrules |
2166 |
FROM issuingrules |
2153 |
WHERE (categorycode in (?,'*') ) |
2167 |
WHERE (categorycode in (?,'*') ) |
2154 |
AND (itemtype IN (?,'*')) |
2168 |
AND (itemtype IN (?,'*')) |
2155 |
- |
|
|