}
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};
$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 };