From: Jan Büren Date: Mon, 19 Nov 2018 09:29:36 +0000 (+0100) Subject: disable_one_time_config: Transaktionssicher X-Git-Tag: release-3.5.4~216 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=04479c02711b7b49ffc6f2228615aed373b83a01;p=kivitendo-erp.git disable_one_time_config: Transaktionssicher --- diff --git a/SL/DB/PeriodicInvoicesConfig.pm b/SL/DB/PeriodicInvoicesConfig.pm index dd70206e2..c1dc15eb7 100644 --- a/SL/DB/PeriodicInvoicesConfig.pm +++ b/SL/DB/PeriodicInvoicesConfig.pm @@ -140,9 +140,17 @@ sub disable_one_time_config { # A periodicity of one time was set. Deactivate this config now. if ($self->periodicity eq 'o') { _log_msg("setting inactive\n"); - $self->active(0); - $self->order->update_attributes(closed => 1); - $self->save; + if (!$self->db->with_transaction(sub { + 1; # make Emacs happy + $self->active(0); + $self->order->update_attributes(closed => 1); + die; + $self->save; + 1; + })) { + $::lxdebug->message(LXDebug->WARN(), "disalbe_one_time config failed: " . join("\n", (split(/\n/, $self->{db_obj}->db->error))[0..2])); + return undef; + } return $self->order->ordnumber; } return undef;