Revision 3aaba5ca
Von Sven Schöling vor fast 2 Jahren hinzugefügt
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
257 | 257 |
|
258 | 258 |
$invoice->post(ar_id => $config->ar_chart_id) || die; |
259 | 259 |
|
260 |
$order->link_to_record($invoice); |
|
261 |
|
|
262 |
foreach my $item (@{ $invoice->items }) { |
|
263 |
foreach (qw(orderitems)) { # expand if needed (delivery_order_items) |
|
264 |
if ($item->{"converted_from_${_}_id"}) { |
|
265 |
die unless $item->{id}; |
|
266 |
RecordLinks->create_links('mode' => 'ids', |
|
267 |
'from_table' => $_, |
|
268 |
'from_ids' => $item->{"converted_from_${_}_id"}, |
|
269 |
'to_table' => 'invoice', |
|
270 |
'to_id' => $item->{id}, |
|
271 |
) || die; |
|
272 |
delete $item->{"converted_from_${_}_id"}; |
|
273 |
} |
|
274 |
} |
|
275 |
} |
|
276 |
|
|
277 | 260 |
foreach my $item (grep { ($_->recurring_billing_mode eq 'once') && !$_->recurring_billing_invoice_id } @{ $order->orderitems }) { |
278 | 261 |
$item->update_attributes(recurring_billing_invoice_id => $invoice->id); |
279 | 262 |
} |
Auch abrufbar als: Unified diff
RecordLink: in BackgroundJobs nicht mehr manuell setzen