- # Update cvars
- my %type_to_column = ( text => 'text_value',
- textfield => 'text_value',
- select => 'text_value',
- date => 'timestamp_value_as_date',
- timestamp => 'timestamp_value_as_date',
- number => 'number_value_as_number',
- bool => 'bool_value' );
- my @cvars;
- push @cvars, $entry->{part}->custom_variables;
- foreach my $config (@{ $self->all_cvar_configs }) {
- next unless exists $raw->{ "cvar_" . $config->name };
- my $value = $raw->{ "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 => '');
- }
- $entry->{part}->custom_variables(\@cvars) if @cvars;
-