From 0929128e47bfa00d012594b35065dc47069f3609 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 12 Oct 2021 14:44:51 +0200 Subject: [PATCH] =?utf8?q?CsvImport:=20Interface=20f=C3=BCr=20zus=C3=A4tzl?= =?utf8?q?iche=20Angaben=20beim=20Import=20immer=20speichern?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/CsvImport/Base.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/SL/Controller/CsvImport/Base.pm b/SL/Controller/CsvImport/Base.pm index fe8af336a..4f718f729 100644 --- 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]; - next if @{ $entry->{errors} }; 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 }) { @@ -602,6 +604,18 @@ sub save_additions { 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) = @_; -- 2.20.1