@{ $self->cvar_configs_by->{row_ident}->{$row_ident} });
}
+sub field_lengths {
+ my ($self) = @_;
+
+ my %field_lengths_by_ri = ();
+
+ foreach my $p (@{ $self->profile }) {
+ my %field_lengths = map { $_->name => $_->length } grep { $_->type eq 'varchar' } @{ $p->{class}->meta->columns };
+ $field_lengths_by_ri{ $p->{row_ident} } = \%field_lengths;
+ }
+
+ return %field_lengths_by_ri;
+}
+
+sub fix_field_lengths {
+ my ($self) = @_;
+
+ my %field_lengths_by_ri = $self->field_lengths;
+ foreach my $entry (@{ $self->controller->data }) {
+ next unless @{ $entry->{errors} };
+ my %field_lengths = %{ $field_lengths_by_ri{ $entry->{raw_data}->{datatype} } };
+ map { $entry->{object}->$_(substr($entry->{object}->$_, 0, $field_lengths{$_})) if $entry->{object}->$_ } keys %field_lengths;
+ }
+
+ return;
+}
+
sub is_multiplexed { 1 }
1;
};
}
-sub field_lengths {
- return ( shiptoname => 75,
- shiptodepartment_1 => 75,
- shiptodepartment_2 => 75,
- shiptostreet => 75,
- shiptozipcode => 75,
- shiptocity => 75,
- shiptocountry => 75,
- shiptocontact => 75,
- shiptophone => 30,
- shiptofax => 30,
- );
-}
-
sub init_profile {
my ($self) = @_;