X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FBackgroundJob%2FCreatePeriodicInvoices.pm;h=fa5d649357965257c3f9b95fe06b158370146866;hb=e86e30de944c4bbe4b42f43d933e0a28a83408dd;hp=0817ae6c606505ae55ef9809f01e198843246696;hpb=2e66dde525c12d064518c316d25a6b41ed727b39;p=kivitendo-erp.git diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index 0817ae6c6..fa5d64935 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -142,6 +142,18 @@ sub _create_periodic_invoice { $invoice->post(ar_id => $config->ar_chart_id) || die; + # like $form->add_shipto, but we don't need to check for a manual exception, + # because we can already assume this (otherwise no shipto_id from order) + if ($order->shipto_id) { + + my $shipto_oe = SL::DB::Manager::Shipto->find_by(shipto_id => $order->shipto_id); + my $shipto_ar = $shipto_oe->clone_and_reset; + + $shipto_ar->module('AR'); # alter module OE -> AR + $shipto_ar->trans_id($invoice->id); # alter trans_id -> new id from invoice + $shipto_ar->save; + } + $order->link_to_record($invoice); SL::DB::PeriodicInvoice->new(config_id => $config->id,