From 2225b5bef82758d567e24be5c3f00e1d439fbe26 Mon Sep 17 00:00:00 2001
From: Moritz Bunkus <m.bunkus@linet-services.de>
Date: Wed, 2 Mar 2011 14:58:54 +0100
Subject: [PATCH] Behandlung von neu zu vergebenen Artikelnummern gefixt

---
 SL/Controller/CsvImport/Part.pm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm
index d42a2db41..9d0e66ba3 100644
--- a/SL/Controller/CsvImport/Part.pm
+++ b/SL/Controller/CsvImport/Part.pm
@@ -366,16 +366,24 @@ sub init_profile {
   my ($self) = @_;
 
   my $profile = $self->SUPER::init_profile;
-  delete $profile->{type};
-
-  $::lxdebug->dump(0, "prof", $profile);
+  delete @{$profile}{qw(type priceupdate)};
 
   return $profile;
 }
 
+sub save_objects {
+  my ($self, %params) = @_;
+
+  my $with_number    = [ grep { $_->{object}->partnumber ne '####' } @{ $self->controller->data } ];
+  my $without_number = [ grep { $_->{object}->partnumber eq '####' } @{ $self->controller->data } ];
+
+  map { $_->{object}->partnumber('') } @{ $without_number };
+
+  $self->SUPER::save_objects(data => $with_number);
+  $self->SUPER::save_objects(data => $without_number);
+}
 
 # TODO:
-#  priceupdate aus Profil raus
 #  CVARs ins Profil rein
 
 1;
-- 
2.20.1