projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0b68d45
)
CsvImport: Interface für zusätzliche Angaben beim Import immer speichern
author
Jan Büren
<jan@kivitendo.de>
Tue, 12 Oct 2021 12:44:51 +0000
(14:44 +0200)
committer
Jan Büren
<jan@kivitendo.de>
Tue, 12 Oct 2021 12:44:51 +0000
(14:44 +0200)
SL/Controller/CsvImport/Base.pm
patch
|
blob
|
history
diff --git
a/SL/Controller/CsvImport/Base.pm
b/SL/Controller/CsvImport/Base.pm
index
fe8af33
..
4f718f7
100644
(file)
--- a/
SL/Controller/CsvImport/Base.pm
+++ b/
SL/Controller/CsvImport/Base.pm
@@
-539,9
+539,11
@@
sub save_objects {
SL::DB->client->with_transaction(sub {
foreach my $entry_index ($chunk_size * $chunk .. min( $last_index, $chunk_size * ($chunk + 1) - 1 )) {
my $entry = $data->[$entry_index];
SL::DB->client->with_transaction(sub {
foreach my $entry_index ($chunk_size * $chunk .. min( $last_index, $chunk_size * ($chunk + 1) - 1 )) {
my $entry = $data->[$entry_index];
- next if @{ $entry->{errors} };
my $object = $entry->{object_to_save} || $entry->{object};
my $object = $entry->{object_to_save} || $entry->{object};
+ $self->save_additions_always($object);
+
+ next if @{ $entry->{errors} };
my $ret;
if (!eval { $ret = $object->save(cascade => !!$self->save_with_cascade()); 1 }) {
my $ret;
if (!eval { $ret = $object->save(cascade => !!$self->save_with_cascade()); 1 }) {
@@
-602,6
+604,18
@@
sub save_additions {
return;
}
return;
}
+sub save_additions_always {
+ my ($self, $object) = @_;
+
+ # Can be overridden by derived specialized importer classes to save
+ # additional tables always.
+ # This sub is called before the object is saved. Therefore this
+ # hook will always be executed wether or not the import entry can be saved successfully.
+
+ return;
+}
+
+
sub _save_history {
my ($self, $object) = @_;
sub _save_history {
my ($self, $object) = @_;