From 386284d2d5a773e274d30e7ecf1deb137593734e Mon Sep 17 00:00:00 2001 From: Ian Walls Date: Sat, 10 Mar 2012 08:02:26 -0500 Subject: [PATCH] Bug 6875 Followup: De-nesting C4::Items breaks bulkmarcimport Removing 'use C4::Branch' in favour of a subroutine-specific 'require C4::Branch' causes the GetBranchName subroutine to return an error, as it's not defined in C4::Items. Adding "C4::Branch::" scoping fixes the error, which is what's done here. To confirm problem: 1. Attempt to run bulkmarcimport.pl before applying the patch. You should get ERROR: Adding items to bib 435 failed: Undefined subroutine &C4::Items::GetBranchName called at /home/sekjal/kohaclone/C4/Items.pm line 656, line 435. To test: 2. apply patch 3. run bulkmarcimport again. Error should disappear. Signed-off-by: Ian Walls Signed-off-by: Jared Camins-Esakov Note that this problem only appears when importing records with item (952) fields. Signed-off-by: Paul Poulain --- C4/Items.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 1107db9e15..3b8ed8751b 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -653,7 +653,7 @@ sub CheckItemPreSave { # check for valid home branch if (exists $item_ref->{'homebranch'} and defined $item_ref->{'homebranch'}) { - my $branch_name = GetBranchName($item_ref->{'homebranch'}); + my $branch_name = C4::Branch::GetBranchName($item_ref->{'homebranch'}); unless (defined $branch_name) { # relies on fact that branches.branchname is a non-NULL column, # so GetBranchName returns undef only if branch does not exist @@ -663,7 +663,7 @@ sub CheckItemPreSave { # check for valid holding branch if (exists $item_ref->{'holdingbranch'} and defined $item_ref->{'holdingbranch'}) { - my $branch_name = GetBranchName($item_ref->{'holdingbranch'}); + my $branch_name = C4::Branch::GetBranchName($item_ref->{'holdingbranch'}); unless (defined $branch_name) { # relies on fact that branches.branchname is a non-NULL column, # so GetBranchName returns undef only if branch does not exist -- 2.39.5