Revision 25d8cd29
Von Bernd Bleßmann vor etwa 7 Jahren hinzugefügt
SL/Controller/CsvImport/Part.pm | ||
---|---|---|
175 | 175 |
$self->handle_prices($entry) if $self->settings->{sellprice_adjustment}; |
176 | 176 |
$self->handle_shoparticle($entry); |
177 | 177 |
$self->handle_translations($entry); |
178 |
$self->handle_cvars($entry); |
|
178 |
$self->handle_cvars($entry) unless $entry->{dont_handle_cvars};
|
|
179 | 179 |
$self->handle_makemodel($entry); |
180 | 180 |
$self->set_various_fields($entry); |
181 | 181 |
} continue { |
... | ... | |
320 | 320 |
$entry->{part}->prices(grep { $_ } map { $prices_by_pricegroup_id{$_->id} } @{ $self->all_pricegroups }); |
321 | 321 |
|
322 | 322 |
push @{ $entry->{information} }, $::locale->text('Updating prices of existing entry in database'); |
323 |
$entry->{object_to_save} = $entry->{part}; |
|
323 |
$entry->{object_to_save} = $entry->{part}; |
|
324 |
$entry->{dont_handle_cvars} = 1; |
|
324 | 325 |
} elsif ( $self->settings->{article_number_policy} eq 'update_parts' || $self->settings->{article_number_policy} eq 'update_parts_sn') { |
325 | 326 |
|
326 | 327 |
# Update parts table |
... | ... | |
355 | 356 |
} |
356 | 357 |
$entry->{part}->translations(\@translations) if @translations; |
357 | 358 |
|
358 |
# Update cvars |
|
359 |
my %type_to_column = ( text => 'text_value', |
|
360 |
textfield => 'text_value', |
|
361 |
select => 'text_value', |
|
362 |
date => 'timestamp_value_as_date', |
|
363 |
timestamp => 'timestamp_value_as_date', |
|
364 |
number => 'number_value_as_number', |
|
365 |
bool => 'bool_value' ); |
|
366 |
my @cvars; |
|
367 |
push @cvars, $entry->{part}->custom_variables; |
|
368 |
foreach my $config (@{ $self->all_cvar_configs }) { |
|
369 |
next unless exists $raw->{ "cvar_" . $config->name }; |
|
370 |
my $value = $raw->{ "cvar_" . $config->name }; |
|
371 |
my $column = $type_to_column{ $config->type } || die "Program logic error: unknown custom variable storage type"; |
|
372 |
push @cvars, SL::DB::CustomVariable->new(config_id => $config->id, $column => $value, sub_module => ''); |
|
373 |
} |
|
374 |
$entry->{part}->custom_variables(\@cvars) if @cvars; |
|
375 |
|
|
376 | 359 |
# save Part Update |
377 | 360 |
push @{ $entry->{information} }, $::locale->text('Updating data of existing entry in database'); |
378 | 361 |
|
Auch abrufbar als: Unified diff
CsvImport: Parts: CVars von handle_cvars behandeln lassen.
Dabei aber beachten, dass das bei einen Import, wo nur die Preise aktualisiert
werden sollen, nicht geschieht.