From 007b10446ff76982b3d4d27b4e758af69f0a364a Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 25 Sep 2009 03:09:30 +0200 Subject: [PATCH] bug Fixing : 3640 This patch filters all non itemrelated fields in the marcrecord before making update AddItemhad the same problem as ModItem They would try and take fields which would not be item fields Signed-off-by: Galen Charlton --- C4/Items.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 3a4ec9173c..7a6182d6a9 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -209,8 +209,12 @@ sub AddItemFromMarc { # parse item hash from MARC my $frameworkcode = GetFrameworkCode( $biblionumber ); - my $item = &TransformMarcToKoha( $dbh, $source_item_marc, $frameworkcode ); - my $unlinked_item_subfields = _get_unlinked_item_subfields($source_item_marc, $frameworkcode); + my ($itemtag,$itemsubfield)=GetMarcFromKohaField("items.itemnumber",$frameworkcode); + + my $localitemmarc=MARC::Record->new; + $localitemmarc->append_fields($source_item_marc->field($itemtag)); + my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode ,'items'); + my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode); return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields); } @@ -452,11 +456,11 @@ sub ModItemFromMarc { my $localitemmarc=MARC::Record->new; $localitemmarc->append_fields($item_marc->field($itemtag)); - my $item = &TransformMarcToKoha( $dbh, $item_marc, $frameworkcode ,'items'); + my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode, 'items'); foreach my $item_field (keys %default_values_for_mod_from_marc) { $item->{$item_field} = $default_values_for_mod_from_marc{$item_field} unless exists $item->{$item_field}; } - my $unlinked_item_subfields = _get_unlinked_item_subfields($item_marc, $frameworkcode); + my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode); return ModItem($item, $biblionumber, $itemnumber, $dbh, $frameworkcode, $unlinked_item_subfields); } -- 2.39.5