X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/04479c02711b7b49ffc6f2228615aed373b83a01..46f9d91b44c432aa017f44b6b2f53114e190428e:/SL/DB/PeriodicInvoicesConfig.pm diff --git a/SL/DB/PeriodicInvoicesConfig.pm b/SL/DB/PeriodicInvoicesConfig.pm index c1dc15eb7..0523348c8 100644 --- a/SL/DB/PeriodicInvoicesConfig.pm +++ b/SL/DB/PeriodicInvoicesConfig.pm @@ -88,7 +88,7 @@ sub calculate_invoice_dates { my $period_len = $self->get_billing_period_length; my $cur_date = ($self->first_billing_date || $self->start_date)->clone; - my $end_date = $self->terminated ? $self->end_date : undef; + my $end_date = $self->terminated || !$self->extend_automatically_by ? $self->end_date : undef; $end_date //= DateTime->today_local->add(years => 100); my $start_date = $params{past_dates} ? undef : $self->get_previous_billed_period_start_date; $start_date = $start_date ? $start_date->clone->add(days => 1) : $cur_date->clone; @@ -144,7 +144,6 @@ sub disable_one_time_config { 1; # make Emacs happy $self->active(0); $self->order->update_attributes(closed => 1); - die; $self->save; 1; })) {