check_objects: Schleifen zusammengefasst.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 19 Aug 2013 14:21:24 +0000 (16:21 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 25 Nov 2013 13:03:12 +0000 (14:03 +0100)
SL/Controller/CsvImport/Order.pm

index 8125a35..64e1d76 100644 (file)
@@ -244,7 +244,10 @@ sub check_objects {
 
     if ($entry->{raw_data}->{datatype} eq $self->_order_column) {
       $self->handle_order($entry);
+    } elsif ($entry->{raw_data}->{datatype} eq $self->_item_column && $entry->{object}->can('part')) {
+      $self->handle_item($entry);
     }
+
   } continue {
     $i++;
   }
@@ -257,12 +260,6 @@ sub check_objects {
   $self->add_columns($self->_order_column, 'globalproject_id') if exists $self->controller->data->[0]->{raw_data}->{globalprojectnumber};
   $self->add_columns($self->_order_column, 'cp_id')            if exists $self->controller->data->[0]->{raw_data}->{contact};
 
-  foreach my $entry (@{ $self->controller->data }) {
-    if ($entry->{raw_data}->{datatype} eq $self->_item_column && $entry->{object}->can('part')) {
-      $self->handle_item($entry);
-    }
-  }
-
   $self->add_info_columns($self->_item_column,
                           { header => $::locale->text('Part Number'), method => 'partnumber' });
   # Todo: access via ->[1] ok? Better: search first item column and use this