From 623bea51492de487b756ae91db4cd1d1db23343e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 13 Aug 2012 17:04:05 +0200 Subject: [PATCH 1/1] Bug 8015: Followup: FIX cp and mv if subfields don't exist. --- Koha/SimpleMARC.pm | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index 3dda39c..760820a 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.7.3