Rechnungsadresse aus den Stammdaten bei periodischen Rechnungen verwenden (Anzeige...
authorJan Büren <jan@kivitendo.de>
Thu, 20 Sep 2018 14:07:05 +0000 (16:07 +0200)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Jan 2019 10:21:56 +0000 (11:21 +0100)
SL/BackgroundJob/CreatePeriodicInvoices.pm
SL/Controller/Order.pm

index 48f41b4..03cbdf5 100644 (file)
@@ -376,7 +376,9 @@ sub _email_invoice {
     grep { $_       }
     map  { trim($_) }
     (split(m{,}, $data->{config}->email_recipient_address),
-     $data->{config}->email_recipient_contact ? ($data->{config}->email_recipient_contact->cp_email) : ());
+     $data->{config}->email_recipient_contact   ? ($data->{config}->email_recipient_contact->cp_email) : (),
+     $data->{invoice}->{customer}->invoice_mail ? ($data->{invoice}->{customer}->invoice_mail) : ()
+    );
 
   return unless @recipients;
 
index b57d772..10c7dd4 100644 (file)
@@ -509,6 +509,7 @@ sub action_show_periodic_invoices_config_dialog {
 
   if ($::form->{customer_id}) {
     $::form->{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(where => [ cp_cv_id => $::form->{customer_id} ]);
+    $::form->{email_recipient_invoice_address} = SL::DB::Manager::Customer->find_by(id => $::form->{customer_id})->invoice_mail;
   }
 
   $self->render('oe/edit_periodic_invoices_config', { layout => 0 },