Bugzilla – Attachment 156117 Details for
Bug 33794
Holds Queue builder skips least cost branch unless target item's homebranch is patron's homebranch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33794: Move relevent code to it's own subroutine
Bug-33794-Move-relevent-code-to-its-own-subroutine.patch (text/plain), 3.35 KB, created by
Kyle M Hall (khall)
on 2023-09-22 16:41:36 UTC
(
hide
)
Description:
Bug 33794: Move relevent code to it's own subroutine
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-09-22 16:41:36 UTC
Size:
3.35 KB
patch
obsolete
>From f677ecabd84f9ace1f0c2cb8be85b29fa3e011c6 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 22 Sep 2023 15:18:38 +0000 >Subject: [PATCH] Bug 33794: Move relevent code to it's own subroutine > >--- > C4/HoldsQueue.pm | 52 +++++++++++++++++++++++++++--------------------- > 1 file changed, 29 insertions(+), 23 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index 4b811627eb8..d2c0d721a7a 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -577,29 +577,7 @@ sub MapItemsToHoldRequests { > $pull_branches = [keys %items_by_branch]; > $holdingbranch = least_cost_branch( $pickup_branch, $pull_branches, $transport_cost_matrix ); > if ( $holdingbranch ) { >- >- my $holding_branch_items = $items_by_branch{$holdingbranch}; >- foreach my $item (@$holding_branch_items) { >- next if $request->{borrowerbranch} ne $item->{$priority_branch}; >- next unless $items_by_itemnumber{ $item->{itemnumber} }->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } ); >- >- # Don't fill item level holds that contravene the hold pickup policy at this time >- next unless _checkHoldPolicy($item, $request); >- >- # If hold itemtype is set, item's itemtype must match >- next unless ( !$request->{itemtype} >- || $item->{itype} eq $request->{itemtype} ); >- >- # If hold item_group is set, item's item_group must match >- next unless ( >- !$request->{item_group_id} >- || ( $item->{_object}->item_group >- && $item->{_object}->item_group->id eq $request->{item_group_id} ) >- ); >- >- $itemnumber = $item->{itemnumber}; >- last; >- } >+ $itemnumber = get_least_cost_item( $priority_branch, $holdingbranch, \%items_by_branch, \%items_by_itemnumber, $libraries, $request ); > } > else { > next; >@@ -959,4 +937,32 @@ sub update_queue_for_biblio { > return $result; > } > >+sub get_least_cost_item { >+ my ( $priority_branch, $holdingbranch, $items_by_branch, $items_by_itemnumber, $libraries, $request ) = @_; >+ my $holding_branch_items = $items_by_branch->{$holdingbranch}; >+ foreach my $item (@$holding_branch_items) { >+ next if $request->{borrowerbranch} ne $item->{$priority_branch}; >+ next >+ unless $items_by_itemnumber->{ $item->{itemnumber} }->{_object} >+ ->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } ); >+ >+ # Don't fill item level holds that contravene the hold pickup policy at this time >+ next unless _checkHoldPolicy( $item, $request ); >+ >+ # If hold itemtype is set, item's itemtype must match >+ next unless ( !$request->{itemtype} >+ || $item->{itype} eq $request->{itemtype} ); >+ >+ # If hold item_group is set, item's item_group must match >+ next >+ unless ( >+ !$request->{item_group_id} >+ || ( $item->{_object}->item_group >+ && $item->{_object}->item_group->id eq $request->{item_group_id} ) >+ ); >+ >+ return $item->{itemnumber}; >+ } >+} >+ > 1; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33794
:
151712
|
151987
|
156105
|
156115
| 156117 |
156118