From: Sven Schöling Date: Fri, 12 Dec 2014 16:20:32 +0000 (+0100) Subject: CsvImport: Makemodels auch auf instabilen Datenbanken in der richtigen Reihenfolge... X-Git-Tag: release-3.2.0beta~188 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=85f9e4958564847dc9917345b0437c013a77a6d2;p=kivitendo-erp.git CsvImport: Makemodels auch auf instabilen Datenbanken in der richtigen Reihenfolge speichern --- diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm index 9f4ed7284..33301d140 100644 --- a/SL/Controller/CsvImport/Part.pm +++ b/SL/Controller/CsvImport/Part.pm @@ -428,6 +428,7 @@ sub handle_makemodel { } my %old_makemodels_by_mm = map { $_->make . $; . $_->model => $_ } $entry->{part}->makemodels; + my @new_makemodels; foreach my $makemodel ($object->makemodels()) { my $makemodel_orig = $old_makemodels_by_mm{$makemodel->make,$makemodel->model}; @@ -438,10 +439,12 @@ sub handle_makemodel { $makemodel_orig->lastcost($makemodel->lastcost); } else { - $entry->{part}->add_makemodels($makemodel); + push @new_makemodels, $makemodel; } } + $entry->{part}->makemodels([ $entry->{part}->makemodels, @new_makemodels ]) if @new_makemodels; + # reindex makemodels my $i = 0; $_->sortorder(++$i) for @{ $entry->{part}->makemodels };