[Koha-patches] [PATCH 3/6] bug 3409 follow: fix crash if holdingbranch is undef
Galen Charlton
gmcharlt at gmail.com
Sun Aug 23 16:04:21 CEST 2009
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 <gmcharlt at gmail.com>
---
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
More information about the Koha-patches
mailing list