Revision 480f1f35
Von Moritz Bunkus vor fast 2 Jahren hinzugefügt
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
229 | 229 |
if (!$self->{db_obj}->db->with_transaction(sub { |
230 | 230 |
1; # make Emacs happy |
231 | 231 |
|
232 |
$invoice = SL::DB::Invoice->new_from($order); |
|
232 |
$invoice = SL::DB::Invoice->new_from($order, honor_recurring_billing_mode => 1);
|
|
233 | 233 |
|
234 | 234 |
my $tax_point = ($invoice->tax_point // $time_period_vars->{period_end_date}->[0])->clone; |
235 | 235 |
|
... | ... | |
274 | 274 |
} |
275 | 275 |
} |
276 | 276 |
|
277 |
foreach my $item (grep { ($_->recurring_billing_mode eq 'once') && !$_->recurring_billing_invoice_id } @{ $order->orderitems }) { |
|
278 |
$item->update_attributes(recurring_billing_invoice_id => $invoice->id); |
|
279 |
} |
|
280 |
|
|
277 | 281 |
SL::DB::PeriodicInvoice->new(config_id => $config->id, |
278 | 282 |
ar_id => $invoice->id, |
279 | 283 |
period_start_date => $period_start_date) |
SL/DB/Invoice.pm | ||
---|---|---|
229 | 229 |
my $items = delete($params{items}) || $source->items_sorted; |
230 | 230 |
my %item_parents; |
231 | 231 |
|
232 |
if ($params{honor_recurring_billing_mode}) { |
|
233 |
$items = [ |
|
234 |
grep { !$_->can('recurring_billing_mode') |
|
235 |
|| ($_->recurring_billing_mode eq 'always') |
|
236 |
|| (($_->recurring_billing_mode eq 'once') && !$_->recurring_billing_invoice_id) |
|
237 |
} @{ $items } |
|
238 |
]; |
|
239 |
} |
|
240 |
|
|
232 | 241 |
my @items = map { |
233 | 242 |
my $source_item = $_; |
234 | 243 |
my $source_item_id = $_->$item_parent_id_column; |
Auch abrufbar als: Unified diff
Wiederkehrende Abrechnung Positionen: erstellen wiederkehrender Rechnungen