|
Lines 192-197
sub AddReserve {
Link Here
|
| 192 |
my $itemtype = $params->{itemtype}; |
192 |
my $itemtype = $params->{itemtype}; |
| 193 |
my $non_priority = $params->{non_priority}; |
193 |
my $non_priority = $params->{non_priority}; |
| 194 |
my $item_group_id = $params->{item_group_id}; |
194 |
my $item_group_id = $params->{item_group_id}; |
|
|
195 |
my $hold_group_id = $params->{hold_group_id}; |
| 195 |
|
196 |
|
| 196 |
$resdate ||= dt_from_string; |
197 |
$resdate ||= dt_from_string; |
| 197 |
|
198 |
|
|
Lines 254-259
sub AddReserve {
Link Here
|
| 254 |
itemtype => $itemtype, |
255 |
itemtype => $itemtype, |
| 255 |
item_level_hold => $checkitem ? 1 : 0, |
256 |
item_level_hold => $checkitem ? 1 : 0, |
| 256 |
non_priority => $non_priority ? 1 : 0, |
257 |
non_priority => $non_priority ? 1 : 0, |
|
|
258 |
hold_group_id => $hold_group_id, |
| 257 |
} |
259 |
} |
| 258 |
)->store(); |
260 |
)->store(); |
| 259 |
$hold->set_waiting() if $found && $found eq 'W'; |
261 |
$hold->set_waiting() if $found && $found eq 'W'; |
|
Lines 567-587
sub CanItemBeReserved {
Link Here
|
| 567 |
borrowernumber => $patron->borrowernumber, |
569 |
borrowernumber => $patron->borrowernumber, |
| 568 |
biblionumber => $item->biblionumber, |
570 |
biblionumber => $item->biblionumber, |
| 569 |
}; |
571 |
}; |
| 570 |
my $holds = Koha::Holds->search($search_params); |
572 |
my $holds_count = Koha::Holds->count_holds($search_params); |
| 571 |
return _cache { status => "tooManyHoldsForThisRecord", limit => $holds_per_record } |
573 |
return _cache { status => "tooManyHoldsForThisRecord", limit => $holds_per_record } |
| 572 |
if $holds->count() >= $holds_per_record; |
574 |
if $holds_count >= $holds_per_record; |
| 573 |
} |
575 |
} |
| 574 |
} |
576 |
} |
| 575 |
|
577 |
|
| 576 |
if ( !$params->{ignore_hold_counts} && defined $holds_per_day && $holds_per_day ne '' ) { |
578 |
if ( !$params->{ignore_hold_counts} && defined $holds_per_day && $holds_per_day ne '' ) { |
| 577 |
my $today_holds = Koha::Holds->search( |
579 |
my $today_holds_count = Koha::Holds->count_holds( |
| 578 |
{ |
580 |
{ |
| 579 |
borrowernumber => $patron->borrowernumber, |
581 |
borrowernumber => $patron->borrowernumber, |
| 580 |
reservedate => dt_from_string->date |
582 |
reservedate => dt_from_string->date |
| 581 |
} |
583 |
} |
| 582 |
); |
584 |
); |
| 583 |
return _cache { status => 'tooManyReservesToday', limit => $holds_per_day } |
585 |
return _cache { status => 'tooManyReservesToday', limit => $holds_per_day } |
| 584 |
if $today_holds->count() >= $holds_per_day; |
586 |
if $today_holds_count >= $holds_per_day; |
| 585 |
} |
587 |
} |
| 586 |
|
588 |
|
| 587 |
# we check if it's ok or not |
589 |
# we check if it's ok or not |
|
Lines 1237-1242
sub ModReserveAffect {
Link Here
|
| 1237 |
|
1239 |
|
| 1238 |
$hold->itemnumber($itemnumber); |
1240 |
$hold->itemnumber($itemnumber); |
| 1239 |
|
1241 |
|
|
|
1242 |
my @reserve_ids; |
| 1243 |
push @reserve_ids, $hold->reserve_id; |
| 1244 |
|
| 1240 |
if ($transferToDo) { |
1245 |
if ($transferToDo) { |
| 1241 |
$hold->set_transfer(); |
1246 |
$hold->set_transfer(); |
| 1242 |
} elsif ( C4::Context->preference('HoldsNeedProcessingSIP') |
1247 |
} elsif ( C4::Context->preference('HoldsNeedProcessingSIP') |
|
Lines 1251-1256
sub ModReserveAffect {
Link Here
|
| 1251 |
# Complete transfer if one exists |
1256 |
# Complete transfer if one exists |
| 1252 |
my $transfer = $hold->item->get_transfer; |
1257 |
my $transfer = $hold->item->get_transfer; |
| 1253 |
$transfer->receive if $transfer; |
1258 |
$transfer->receive if $transfer; |
|
|
1259 |
|
| 1260 |
# if this hold was part of a group, cancel other holds in the group |
| 1261 |
if ( $hold->hold_group_id ) { |
| 1262 |
my @holds = $hold->hold_group->holds->as_list; |
| 1263 |
foreach my $h (@holds) { |
| 1264 |
push @reserve_ids, $h->reserve_id; |
| 1265 |
$h->cancel unless $h->reserve_id == $hold->reserve_id; |
| 1266 |
} |
| 1267 |
} |
| 1254 |
} |
1268 |
} |
| 1255 |
|
1269 |
|
| 1256 |
_koha_notify_hold_changed($hold) if $notify_library; |
1270 |
_koha_notify_hold_changed($hold) if $notify_library; |
|
Lines 1264-1271
sub ModReserveAffect {
Link Here
|
| 1264 |
CartToShelf($itemnumber); |
1278 |
CartToShelf($itemnumber); |
| 1265 |
} |
1279 |
} |
| 1266 |
|
1280 |
|
| 1267 |
my $std = $dbh->prepare( |
1281 |
foreach my $id (@reserve_ids) { |
| 1268 |
q{ |
1282 |
my $std = $dbh->prepare( |
|
|
1283 |
q{ |
| 1269 |
DELETE q, t |
1284 |
DELETE q, t |
| 1270 |
FROM tmp_holdsqueue q |
1285 |
FROM tmp_holdsqueue q |
| 1271 |
INNER JOIN hold_fill_targets t |
1286 |
INNER JOIN hold_fill_targets t |
|
Lines 1275-1283
sub ModReserveAffect {
Link Here
|
| 1275 |
AND q.item_level_request = t.item_level_request |
1290 |
AND q.item_level_request = t.item_level_request |
| 1276 |
AND q.holdingbranch = t.source_branchcode |
1291 |
AND q.holdingbranch = t.source_branchcode |
| 1277 |
WHERE t.reserve_id = ? |
1292 |
WHERE t.reserve_id = ? |
|
|
1293 |
} |
| 1294 |
); |
| 1295 |
$std->execute($id); |
| 1278 |
} |
1296 |
} |
| 1279 |
); |
|
|
| 1280 |
$std->execute( $hold->reserve_id ); |
| 1281 |
|
1297 |
|
| 1282 |
logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original ) |
1298 |
logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original ) |
| 1283 |
if C4::Context->preference('HoldsLog'); |
1299 |
if C4::Context->preference('HoldsLog'); |