Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 32066492

Von Bernd Bleßmann vor fast 8 Jahren hinzugefügt

  • ID 320664922d387971c50ff1070abc2b73050a024f
  • Vorgänger 942ce912
  • Nachfolger e6291b3a

CsvImport Multiplex/Aufträge: Auch nicht angegebene CVars im Objekt speichern.

Unterschiede anzeigen:

SL/Controller/CsvImport/BaseMulti.pm
2 2

  
3 3
use strict;
4 4

  
5
use List::MoreUtils qw(pairwise);
5
use List::MoreUtils qw(pairwise firstidx);
6 6

  
7 7
use SL::Helper::Csv;
8 8

  
......
167 167
                         bool      => 'bool_value' );
168 168

  
169 169
  $params{sub_module} ||= '';
170

  
171
  # autovivify all cvars (cvars_by_config will do that for us)
170 172
  my @cvars;
173
  @cvars = @{ $entry->{object}->cvars_by_config } if $entry->{object}->can('cvars_by_config');
174

  
171 175
  foreach my $config (@{ $self->cvar_configs_by->{row_ident}->{$entry->{raw_data}->{datatype}} }) {
172 176
    next unless exists $entry->{raw_data}->{ "cvar_" . $config->name };
173 177
    my $value  = $entry->{raw_data}->{ "cvar_" . $config->name };
174 178
    my $column = $type_to_column{ $config->type } || die "Program logic error: unknown custom variable storage type";
175 179

  
176
    push @cvars, SL::DB::CustomVariable->new(config_id => $config->id, $column => $value, sub_module => $params{sub_module});
180
    my $cvar = SL::DB::CustomVariable->new(config_id => $config->id, $column => $value, sub_module => $params{sub_module});
181

  
182
    # replace autovivified cvar by new one
183
    my $idx = firstidx { $_->config_id == $config->id } @cvars;
184
    $cvars[$idx] = $cvar if -1 != $idx;
177 185
  }
178 186

  
179 187
  $entry->{object}->custom_variables(\@cvars) if @cvars;
......
291 299
sub is_multiplexed { 1 }
292 300

  
293 301
1;
294

  

Auch abrufbar als: Unified diff