|
Lines 452-469
sub MapItemsToHoldRequests {
Link Here
|
| 452 |
my $LocalHoldsPriorityItemControl = |
452 |
my $LocalHoldsPriorityItemControl = |
| 453 |
C4::Context->preference('LocalHoldsPriorityItemControl'); |
453 |
C4::Context->preference('LocalHoldsPriorityItemControl'); |
| 454 |
|
454 |
|
|
|
455 |
REQUEST: |
| 455 |
foreach my $request (@$hold_requests) { |
456 |
foreach my $request (@$hold_requests) { |
|
|
457 |
my $patron; |
| 456 |
last if $num_items_remaining == 0; |
458 |
last if $num_items_remaining == 0; |
| 457 |
my $patron = Koha::Patrons->find($request->{borrowernumber}); |
|
|
| 458 |
next if $patron->category->exclude_from_local_holds_priority; |
| 459 |
|
| 460 |
my $local_hold_match; |
459 |
my $local_hold_match; |
| 461 |
foreach my $item (@$available_items) { |
460 |
foreach my $item (@$available_items) { |
| 462 |
next if $item->{_object}->exclude_from_local_holds_priority; |
|
|
| 463 |
|
| 464 |
next unless _can_item_fill_request( $item, $request, $libraries ); |
| 465 |
|
| 466 |
next if $request->{itemnumber} && $request->{itemnumber} != $item->{itemnumber}; |
| 467 |
|
461 |
|
| 468 |
my $local_holds_priority_item_branchcode = |
462 |
my $local_holds_priority_item_branchcode = |
| 469 |
$item->{$LocalHoldsPriorityItemControl}; |
463 |
$item->{$LocalHoldsPriorityItemControl}; |
|
Lines 480-485
sub MapItemsToHoldRequests {
Link Here
|
| 480 |
$local_holds_priority_patron_branchcode; |
474 |
$local_holds_priority_patron_branchcode; |
| 481 |
|
475 |
|
| 482 |
if ($local_hold_match) { |
476 |
if ($local_hold_match) { |
|
|
477 |
next if $item->{_object}->exclude_from_local_holds_priority; |
| 478 |
|
| 479 |
if ( !defined $patron ) { |
| 480 |
$patron = Koha::Patrons->find( $request->{borrowernumber} ); |
| 481 |
|
| 482 |
next REQUEST if $patron->category->exclude_from_local_holds_priority; |
| 483 |
} |
| 484 |
|
| 485 |
next unless _can_item_fill_request( $item, $request, $libraries ); |
| 486 |
|
| 487 |
next if $request->{itemnumber} && $request->{itemnumber} != $item->{itemnumber}; |
| 488 |
|
| 489 |
next |
| 490 |
if $request->{item_group_id} |
| 491 |
&& $item->{_object}->item_group |
| 492 |
&& $item->{_object}->item_group->id ne $request->{item_group_id}; |
| 493 |
|
| 494 |
next |
| 495 |
unless $item->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } ); |
| 496 |
|
| 483 |
if ( exists $items_by_itemnumber{ $item->{itemnumber} } |
497 |
if ( exists $items_by_itemnumber{ $item->{itemnumber} } |
| 484 |
and not exists $allocated_items{ $item->{itemnumber} } |
498 |
and not exists $allocated_items{ $item->{itemnumber} } |
| 485 |
and not $request->{allocated}) |
499 |
and not $request->{allocated}) |
| 486 |
- |
|
|