From 0e745c4207991853dd0884700479cfeb10513694 Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Thu, 14 Nov 2019 00:33:59 +0200 Subject: [PATCH] Bug 24027: dbh handler not passed through all chain preparatory fix for next patch to have all parameters aligned: $dbh handler passed through as parameter in AddItem but forgotten in AddItemFromMarc. Added. --- C4/Items.pm | 7 ++++--- cataloguing/additem.pl | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index b81fb0aa17..eb46859c24 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -144,7 +144,7 @@ sub CartToShelf { =head2 AddItemFromMarc my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItemFromMarc($source_item_marc, $biblionumber); + = AddItemFromMarc($source_item_marc, $biblionumber[, $dbh]); Given a MARC::Record object containing an embedded item record and a biblionumber, create a new item record. @@ -152,8 +152,9 @@ record and a biblionumber, create a new item record. =cut sub AddItemFromMarc { - my ( $source_item_marc, $biblionumber ) = @_; - my $dbh = C4::Context->dbh; + my $source_item_marc = shift; + my $biblionumber = shift; + my $dbh = @_ ? shift : C4::Context->dbh; # parse item hash from MARC my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 2c371def28..eded25fc5f 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -501,7 +501,7 @@ if ($op eq "additem") { # if barcode exists, don't create, but report The problem. unless ($exist_itemnumber) { - my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber ); + my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = AddItemFromMarc( $record, $biblionumber, $dbh ); set_item_default_location($oldbibitemnum); # Pushing the last created item cookie back @@ -600,7 +600,7 @@ if ($op eq "additem") { # Adding the item if (!$exist_itemnumber) { - my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc($record,$biblionumber); + my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = AddItemFromMarc( $record, $biblionumber, $dbh); set_item_default_location($oldbibitemnum); # We count the item only if it was really added -- 2.17.1