X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FDB%2FPeriodicInvoicesConfig.pm;h=ceb532af93205a2f8535c6487f4ed3edca8db3dc;hb=36bdd4875c67f916e4a885191f7870d301ae2c11;hp=081be3577924f9e103a30c9ed8a158c7dc332031;hpb=2dff0687d1c3131bb8d7b912bed96d5511699cc3;p=kivitendo-erp.git diff --git a/SL/DB/PeriodicInvoicesConfig.pm b/SL/DB/PeriodicInvoicesConfig.pm index 081be3577..ceb532af9 100644 --- a/SL/DB/PeriodicInvoicesConfig.pm +++ b/SL/DB/PeriodicInvoicesConfig.pm @@ -140,8 +140,16 @@ 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->save; + if (!$self->db->with_transaction(sub { + 1; # make Emacs happy + $self->active(0); + $self->order->update_attributes(closed => 1); + $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; @@ -256,7 +264,9 @@ the last invoice in that particular order value cycle. =item C Sets the state of the periodic_invoices_configs to inactive -(active => false) if the periodicity is (one time). +(active => false) and closes the source order (closed => true) +if the periodicity is (one time). + Returns undef if the periodicity is not 'one time' otherwise the order number of the deactivated periodic order.