Revision fde528b6
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
188 | 188 |
} |
189 | 189 |
|
190 | 190 |
sub _calculate_dates { |
191 |
my $config = shift; |
|
192 |
|
|
193 |
my $cur_date = $config->first_billing_date || $config->start_date; |
|
194 |
my $start_date = $config->get_previous_invoice_date || DateTime->new(year => 1970, month => 1, day => 1); |
|
195 |
my $end_date = $config->end_date || DateTime->new(year => 2100, month => 1, day => 1); |
|
196 |
my $tomorrow = DateTime->today_local->add(days => 1); |
|
197 |
my $period_len = $config->get_period_length; |
|
198 |
|
|
199 |
$end_date = $tomorrow if $end_date > $tomorrow; |
|
200 |
|
|
201 |
my @dates; |
|
202 |
|
|
203 |
while (1) { |
|
204 |
last if $cur_date >= $end_date; |
|
205 |
|
|
206 |
push @dates, $cur_date->clone if $cur_date > $start_date; |
|
207 |
|
|
208 |
$cur_date->add(months => $period_len); |
|
209 |
} |
|
210 |
|
|
211 |
return @dates; |
|
191 |
my ($config) = @_; |
|
192 |
return $config->calculate_invoice_dates(end_date => DateTime->today_local->add(days => 1)); |
|
212 | 193 |
} |
213 | 194 |
|
214 | 195 |
sub _send_email { |
Auch abrufbar als: Unified diff
SL::DB::PeriodicInvoicesConfig: Datumsberechnung aus Backgroundjob verschoben