Bug 5700: MT4004 : additem.pl Some Status were not defaulted to the correct value...
authorPaul Poulain <paul.poulain@biblibre.com>
Wed, 15 Dec 2010 19:38:23 +0000 (20:38 +0100)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 7 Feb 2011 09:17:36 +0000 (22:17 +1300)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
cataloguing/additem.pl

index 7317698..c6f9daf 100755 (executable)
@@ -602,13 +602,16 @@ foreach my $tag ( keys %{$tagslib}){
         next if ($tagslib->{$tag}->{$subtag}->{'tab'} ne "10");
         next if any { /^$tag$subtag$/ }  @fields;
 
-        my $value = "";
-        my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i);
-
-        push (@loop_data, $subfield_data);
-        $i++;
-    }
+        my @values = (undef);
+        @values = $itemrecord->field($tag)->subfield($subtag) if ($itemrecord && defined($itemrecord->field($tag)->subfield($subtag)));
+        for my $value (@values){
+            my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); 
+            push (@loop_data, $subfield_data);
+            $i++;
+        } 
   }
+}
+
 # what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
 $template->param( title => $record->title() ) if ($record ne "-1");
 $template->param(