From 42bf1ae9263b1a94ea70a1c2f9a5f34efbb71c89 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 21 Apr 2016 15:14:51 +0200 Subject: [PATCH] Wiederkehrende Rechnungen: Variablen Periodenstart-/-enddatum richtig setzen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Die Perioden beginnen nicht mehr immer nur am 1. des Monats, sondern an dem Tag, der über das Vertragsstartdatum angegeben ist. Daher müssen auch die Variablen <%period_start_date%> und <%period_end_date%> anhand des Vertragsstartdatums gesetzt und dürfen nicht auf den Monatsbeginn beschnitten werden. --- SL/BackgroundJob/CreatePeriodicInvoices.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index 55c53aac2..ad16949b5 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -92,7 +92,7 @@ sub _log_msg { sub _generate_time_period_variables { my $config = shift; my $period_start_date = shift; - my $period_end_date = $period_start_date->clone->truncate(to => 'month')->add(months => $config->get_billing_period_length)->subtract(days => 1); + my $period_end_date = $period_start_date->clone->add(months => $config->get_billing_period_length)->subtract(days => 1); my @month_names = ('', $::locale->text('January'), $::locale->text('February'), $::locale->text('March'), $::locale->text('April'), $::locale->text('May'), $::locale->text('June'), @@ -115,8 +115,8 @@ sub _generate_time_period_variables { previous_year => [ $period_start_date->clone->truncate(to => 'year')->subtract(years => 1), sub { $_[0]->year } ], next_year => [ $period_start_date->clone->truncate(to => 'year')->add( years => 1), sub { $_[0]->year } ], - period_start_date => [ $period_start_date->clone->truncate(to => 'month'), sub { $::locale->format_date(\%::myconfig, $_[0]) } ], - period_end_date => [ $period_end_date, sub { $::locale->format_date(\%::myconfig, $_[0]) } ], + period_start_date => [ $period_start_date->clone, sub { $::locale->format_date(\%::myconfig, $_[0]) } ], + period_end_date => [ $period_end_date, sub { $::locale->format_date(\%::myconfig, $_[0]) } ], }; return $vars; -- 2.20.1