Revision d02f30a9
Von Bernd Bleßmann vor etwa 1 Jahr hinzugefügt
SL/Controller/CsvImport/APTransaction.pm | ||
---|---|---|
32 | 32 |
my ($self) = @_; |
33 | 33 |
|
34 | 34 |
$self->controller->profile->_set_defaults( |
35 |
ap_column => $::locale->text('Invoice'), |
|
36 |
transaction_column => $::locale->text('AccTransaction'), |
|
37 |
max_amount_diff => 0.02, |
|
38 |
); |
|
35 |
ap_column => $::locale->text('Invoice'), |
|
36 |
transaction_column => $::locale->text('AccTransaction'), |
|
37 |
max_amount_diff => 0.02, |
|
38 |
dont_save_anything_on_errors => 0, |
|
39 |
); |
|
39 | 40 |
}; |
40 | 41 |
|
41 | 42 |
|
42 | 43 |
sub init_settings { |
43 | 44 |
my ($self) = @_; |
44 | 45 |
|
45 |
return { map { ( $_ => $self->controller->profile->get($_) ) } qw(ap_column transaction_column max_amount_diff) }; |
|
46 |
return { map { ( $_ => $self->controller->profile->get($_) ) } qw(ap_column transaction_column max_amount_diff dont_save_anything_on_errors) };
|
|
46 | 47 |
} |
47 | 48 |
|
48 | 49 |
sub init_profile { |
... | ... | |
288 | 289 |
|
289 | 290 |
$self->add_info_columns($self->_transaction_column, { header => $::locale->text('Project Number'), method => 'projectnumber' }) if $self->controller->data->[1]->{info_data}->{projectnumber}; |
290 | 291 |
|
292 |
# If requested to not save anything on errors, set all ap rows without error to an error |
|
293 |
if ($self->controller->profile->get('dont_save_anything_on_errors')) { |
|
294 |
my $any_errors = any { scalar @{ $_->{errors} } } @{ $self->controller->data }; |
|
295 |
if ($any_errors) { |
|
296 |
foreach my $entry (grep { ($_->{raw_data}->{datatype} eq $self->_ap_column) && !scalar @{ $_->{errors} } } @{ $self->controller->data }) { |
|
297 |
push @{ $entry->{errors} }, $::locale->text('There are some errors in the file and it was requested to not save any datasets on errors.'); |
|
298 |
} |
|
299 |
} |
|
300 |
} |
|
301 |
|
|
291 | 302 |
# If invoice has errors, add error for acc_trans items |
292 | 303 |
# If acc_trans item has an error, add an error to the invoice item |
293 | 304 |
my $ap_entry; |
Auch abrufbar als: Unified diff
CSV-Import Kreditorenbuchungen: Optional nichts Speichern bei Fehlern
Wenn gewünscht, werden auch fehlerfreie Datensätze auf Fehler gesetzt,
wenn in der Datei irgendwelche Datensätze mit Fehlern sind.