external billing info will be send to product owner
This commit is contained in:
@@ -122,7 +122,7 @@ class Order extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
public function sendExtBillinfoEmail() {
|
||||
public function sendExtBillinfoEmail(Address $to_address) {
|
||||
// TODO template rendern auslagern nach Emailtempate klasse
|
||||
$tpl = new Layout();
|
||||
$tpl->setTemplate("Emailtemplates/order/billing_external_energie");
|
||||
@@ -139,11 +139,14 @@ class Order extends mfBaseModel {
|
||||
$subject = $values['subject'];
|
||||
$from = $values['from_email'];
|
||||
$from_name = $values['from_email_name'];
|
||||
$to = TT_EXTERNAL_BILLING_EMAIL_TO;
|
||||
$to = $to_address->email;
|
||||
if(!$to) {
|
||||
$this->log->error("Productowner ".$to_address->id." does not have emailaddress");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!$subject || !$from || !$from_name || !$to) {
|
||||
$this->log->warn("Internl Billing Email not sent. (subject: '$subject', from: '$from', from_email: '$from_name', to: '$to')");
|
||||
|
||||
return false;
|
||||
} else {
|
||||
$email = new Emailnotification();
|
||||
|
||||
@@ -609,6 +609,7 @@ class OrderController extends mfBaseController {
|
||||
// if product is not external and customer is new, create customer_number and service pin
|
||||
if($prod->external) {
|
||||
$ext_products = true;
|
||||
$ext_product_owner_id = $prod->external_id;
|
||||
} else {
|
||||
$int_products = true;
|
||||
|
||||
@@ -723,7 +724,7 @@ class OrderController extends mfBaseController {
|
||||
if($send_to_bill_email) {
|
||||
|
||||
if($ext_products && !$int_products) {
|
||||
if(!$order->sendExtBillinfoEmail()) {
|
||||
if(!$order->sendExtBillinfoEmail(new Address($ext_product_owner_id))) {
|
||||
$this->layout()->setFlash("Beim Senden der externen Billing Benachrichtigung ist ein Fehler aufgetreten.", "warning");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user