Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e41671e0

Von Sven Schöling vor fast 11 Jahren hinzugefügt

  • ID e41671e06344bfc4a1c5399f1c6014423bd2be29
  • Vorgänger 75855995
  • Nachfolger b14d19e7

CsvImport: Bei Imports ohne cvars nicht die cvars klobbern.

Unterschiede anzeigen:

SL/Controller/CsvImport/Base.pm
bool => 'bool_value' );
my @cvars;
my %changed_cvars;
foreach my $config (@{ $self->all_cvar_configs }) {
next unless exists $entry->{raw_data}->{ "cvar_" . $config->name };
my $value = $entry->{raw_data}->{ "cvar_" . $config->name };
my $column = $type_to_column{ $config->type } || die "Program logic error: unknown custom variable storage type";
push @cvars, SL::DB::CustomVariable->new(config_id => $config->id, $column => $value, sub_module => '');
my $new_cvar = SL::DB::CustomVariable->new(config_id => $config->id, $column => $value, sub_module => '');
push @cvars, $new_cvar;
$changed_cvars{$config->name} = $new_cvar;
}
$entry->{object}->custom_variables(\@cvars);
# merge existing with new cvars. swap every existing with the imported one, push the rest
if (@cvars) {
my @orig_cvars = ($entry->{object_to_save} || $entry->{object})->custom_variables;
for (@orig_cvars) {
$_ = $changed_cvars{ $_->config->name } if $changed_cvars{ $_->config->name };
delete $changed_cvars{ $_->config->name };
}
push @orig_cvars, values %changed_cvars;
$entry->{object}->custom_variables(\@orig_cvars);
}
}
sub init_profile {

Auch abrufbar als: Unified diff