|
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} // 0; |
| 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 ( $holds_per_day > 0 |
| 381 |
&& $today_holds->count() >= $holds_per_day ) { |
| 382 |
return "tooManyReservesToday"; |
| 383 |
} |
| 384 |
|
| 373 |
# we retrieve count |
385 |
# we retrieve count |
| 374 |
|
386 |
|
| 375 |
$querycount .= "AND $branchfield = ?"; |
387 |
$querycount .= "AND $branchfield = ?"; |
|
Lines 2148-2154
sub GetHoldRule {
Link Here
|
| 2148 |
|
2160 |
|
| 2149 |
my $sth = $dbh->prepare( |
2161 |
my $sth = $dbh->prepare( |
| 2150 |
q{ |
2162 |
q{ |
| 2151 |
SELECT categorycode, itemtype, branchcode, reservesallowed, holds_per_record |
2163 |
SELECT categorycode, itemtype, branchcode, reservesallowed, holds_per_record, holds_per_day |
| 2152 |
FROM issuingrules |
2164 |
FROM issuingrules |
| 2153 |
WHERE (categorycode in (?,'*') ) |
2165 |
WHERE (categorycode in (?,'*') ) |
| 2154 |
AND (itemtype IN (?,'*')) |
2166 |
AND (itemtype IN (?,'*')) |
| 2155 |
- |
|
|