Added internal billing info email when order is finished

This commit is contained in:
Frank Schubert
2021-10-08 15:24:03 +02:00
parent c6706030e7
commit 768b39f67e
5 changed files with 105 additions and 11 deletions

View File

@@ -46,10 +46,6 @@ class Order extends mfBaseModel {
return $terminations;
}
public function createIvtCustomer($data) {
}
public function deletePositions() {
if(!is_array($this->getProperty("products")) || !count($this->getProperty("products"))) {
return true;
@@ -71,6 +67,39 @@ class Order extends mfBaseModel {
}
}
public function sendIntBillinfoEmail() {
// TODO template rendern auslagern nach Emailtempate klasse
$tpl = new Layout();
$tpl->setTemplate("Emailtemplates/order/int_billing_info");
$tpl->set("order", $this);
$body = $tpl->render();
$values = $tpl->getReturnedValue();
//var_dump($values); echo "<pre class='text-monospace'>".$body."</pre>"; exit;
$subject = $values['subject'];
$from = $values['from_email'];
$from_name = $values['from_email_name'];
$to = TT_INTERNAL_BILLING_EMAIL_TO;
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();
$email->setSubject($subject);
$email->setBody($body);
$email->setFrom($from, $from_name);
$email->setTo($to);
$email->setHeader("X-xinon-oid", $this->id);
$email->send();
return true;
}
}
public function getProperty($name) {
if($this->$name == null) {