Make _GetCircControlBranch() default to the item's home library in the case where it otherwise would have returned the item's holding library but that field is null.
Signed-off-by: Galen Charlton <[email protected]> --- C4/Circulation.pm | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 371dad9..5930bed 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1791,7 +1791,7 @@ C<$borrower> is a hashref to borrower. Only {branchcode} is used. =cut sub _GetCircControlBranch { - my ($iteminfos, $borrower) = @_; + my ($item, $borrower) = @_; my $circcontrol = C4::Context->preference('CircControl'); my $branch; @@ -1801,7 +1801,12 @@ sub _GetCircControlBranch { $branch=$borrower->{branchcode}; } else { my $branchfield = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch'; - $branch = $iteminfos->{$branchfield}; + $branch = $item->{$branchfield}; + # default to item home branch if holdingbranch is used + # and is not defined + if (!defined($branch) && $branchfield eq 'holdingbranch') { + $branch = $item->{homebranch}; + } } return $branch; } -- 1.6.3.3 _______________________________________________ Koha-patches mailing list [email protected] http://lists.koha.org/mailman/listinfo/koha-patches
