Revision a7f02ca0
Von Sven Schöling vor etwa 7 Jahren hinzugefügt
SL/Controller/CsvImport/Part.pm | ||
---|---|---|
667 | 667 |
my %old_makemodels_by_mm = map { $_->make . $; . $_->model => $_ } $entry->{part}->makemodels; |
668 | 668 |
my @new_makemodels; |
669 | 669 |
|
670 |
foreach my $makemodel ($object->makemodels()) {
|
|
670 |
foreach my $makemodel (@{ $object->makemodels_sorted }) {
|
|
671 | 671 |
my $makemodel_orig = $old_makemodels_by_mm{$makemodel->make,$makemodel->model}; |
672 | 672 |
$found_any = 1; |
673 | 673 |
|
... | ... | |
680 | 680 |
} |
681 | 681 |
} |
682 | 682 |
|
683 |
$entry->{part}->makemodels([ $entry->{part}->makemodels, @new_makemodels ]) if @new_makemodels; |
|
683 |
$entry->{part}->makemodels([ $entry->{part}->makemodels_sorted, @new_makemodels ]) if @new_makemodels;
|
|
684 | 684 |
|
685 | 685 |
# reindex makemodels |
686 | 686 |
my $i = 0; |
687 |
$_->sortorder(++$i) for @{ $entry->{part}->makemodels }; |
|
687 |
$_->sortorder(++$i) for @{ $entry->{part}->makemodels_sorted };
|
|
688 | 688 |
|
689 | 689 |
$self->save_with_cascade(1) if $found_any; |
690 | 690 |
} |
Auch abrufbar als: Unified diff
CsvImport: Makemodels bei bestehenden Waren stabil sortieren