Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ecffb947

Von Bernd Bleßmann vor etwa 7 Jahren hinzugefügt

  • ID ecffb947d231cd768bc48b3013b1b48c51b308b2
  • Vorgänger bf5e6c6a
  • Nachfolger da1ae660

CsvImport: Bei Imports ohne CVars deren Standard setzen, wenn vorhanden.

Unterschiede anzeigen:

SL/Controller/CsvImport/Base.pm
290 290
sub handle_cvars {
291 291
  my ($self, $entry) = @_;
292 292

  
293
  my $object = $entry->{object_to_save} || $entry->{object};
294
  return unless $object->can('cvars_by_config');
295

  
293 296
  my %type_to_column = ( text      => 'text_value',
294 297
                         textfield => 'text_value',
295 298
                         select    => 'text_value',
......
298 301
                         number    => 'number_value_as_number',
299 302
                         bool      => 'bool_value' );
300 303

  
304
  # autovivify all cvars (cvars_by_config will do that for us)
301 305
  my @cvars;
302 306
  my %changed_cvars;
303 307
  foreach my $config (@{ $self->all_cvar_configs }) {
......
312 316
  }
313 317

  
314 318
  # merge existing with new cvars. swap every existing with the imported one, push the rest
315
  if (@cvars) {
316
    my $object     = $entry->{object_to_save} || $entry->{object};
317
    my @orig_cvars = $object->custom_variables;
318
    for (@orig_cvars) {
319
      $_ = $changed_cvars{ $_->config->name } if $changed_cvars{ $_->config->name };
320
      delete $changed_cvars{ $_->config->name };
321
    }
322
    push @orig_cvars, values %changed_cvars;
323

  
324
    $object->custom_variables(\@orig_cvars);
319
  my @orig_cvars = @{ $object->cvars_by_config };
320
  for (@orig_cvars) {
321
    $_ = $changed_cvars{ $_->config->name } if $changed_cvars{ $_->config->name };
322
    delete $changed_cvars{ $_->config->name };
325 323
  }
324
  push @orig_cvars, values %changed_cvars;
325
  $object->custom_variables(\@orig_cvars);
326 326
}
327 327

  
328 328
sub init_profile {

Auch abrufbar als: Unified diff