[Koha-patches] [PATCH] Bug 5700: MT4004 : additem.pl Some Status were not defaulted to the correct value Status 0 was lost because test was done on value and not on the fact that a value was defined or not. when value is 0 then it was not used as default value for

Chris Cormack chrisc at catalyst.net.nz
Mon Feb 7 10:16:35 CET 2011


From: Paul Poulain <paul.poulain at biblibre.com>

Signed-off-by: Chris Cormack <chrisc at catalyst.net.nz>
---
 cataloguing/additem.pl |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index 7317698..c6f9daf 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -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(
-- 
1.7.1



More information about the Koha-patches mailing list