Added Email Logging for Emailnotification class

This commit is contained in:
Frank Schubert
2025-08-22 17:49:54 +02:00
parent 866c3b2ae1
commit 3a86160b38
26 changed files with 1636 additions and 46 deletions

View File

@@ -467,7 +467,7 @@ class Contract extends mfBaseModel {
if(!$subject || !$from || !$from_name || !$to) {
$this->log->warn("Service PIN Email not sent. (subject: '$subject', from: '$from_name', from_email: '$from', to: '$to')");
} else {
$email = new Emailnotification();
$email = new Emailnotification("Contract", $this->id, json_encode(["type" => "cancel_notification"]));
$email->setSubject($subject);
$email->setBody($body);
$email->setFrom($from, $from_name);
@@ -476,7 +476,7 @@ class Contract extends mfBaseModel {
$email->addAttachment($pdfpath, null, $pdfname, "application/pdf");
$email->send();
$oemail = new Emailnotification();
$oemail = new Emailnotification("Contract", $this->id, json_encode(["type" => "cancel_notification_int"]));
$oemail->setSubject("Kündigungbestätigung " . $this->owner->customer_number . " " . str_replace(["\n", "\r"], "", $this->owner->getCompanyOrName()));
$oemail->setBody($body);
$oemail->setFrom($from, $from_name);
@@ -499,7 +499,7 @@ class Contract extends mfBaseModel {
$tk_body = $tk_tpl->render();
$tk_values = $tk_tpl->getReturnedValue();
$tk_email = new Emailnotification();
$tk_email = new Emailnotification("Contract", $this->id);
$tk_email->setSubject($tk_values["subject"]);
$tk_email->setBody($tk_body);
$tk_email->setFrom($tk_values["from_email"], $tk_values["from_email_name"]);
@@ -525,7 +525,7 @@ class Contract extends mfBaseModel {
$tk_body = $tk_tpl->render();
$tk_values = $tk_tpl->getReturnedValue();
$tk_email = new Emailnotification();
$tk_email = new Emailnotification("Contract", $this->id);
$tk_email->setSubject($tk_values["subject"]);
$tk_email->setBody($tk_body);
$tk_email->setFrom($tk_values["from_email"], $tk_values["from_email_name"]);