From 85ee5ffa28add2192010e5c4607f7016f768650a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 13 Aug 2012 17:04:05 +0200 Subject: [PATCH] Bug 8015: Followup: FIX cp and mv if subfields don't exist. Signed-off-by: Kyle M Hall Signed-off-by: Leila --- Koha/SimpleMARC.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index 96a3af1..9c95ca0 100644 --- a/Koha/SimpleMARC.pm +++ b/Koha/SimpleMARC.pm @@ -126,6 +126,13 @@ sub update_field { foreach my $field ( @fields ) { $field->update( "$subfieldName" => $values[$i++] ); } + if ( $i <= scalar @values - 1 ) { + foreach my $field ( @fields ) { + foreach my $j ( $i .. scalar( @values ) - 1) { + $field->add_subfields( "$subfieldName" => $values[$j] ); + } + } + } } else { ## Field does not exist, create it. foreach my $value ( @values ) { -- 1.7.10.4