Added Preordertype legacytransfer + moved createWorkorder to Rimoapi

This commit is contained in:
Frank Schubert
2024-11-14 16:07:20 +01:00
parent 0c74af0e9d
commit 1fbccb62c5
10 changed files with 147 additions and 66 deletions

View File

@@ -60,19 +60,35 @@ class MaintenanceNotification extends mfBaseModel {
$mnlog->save();
}
$this->sent = date("U");
$this->save();
// send to xinon
$mnlog = MaintenanceNotificationLog::getFirst(["maintenancenotification_id" => $this->id, "email" => "internal-email"]);
if($mnlog) {
// was sent already
return true;
}
$to = "wartungsverteiler.team@xinon.at";
$body .= "\n\nPLZ Liste:\n\n";
$body .= implode("\n", $this->getProperty("plzs"));
$email = new Emailnotification();
$email->setSubject($subject);
$email->setHtmlBody($body);
$email->setBody($body);
$email->setFrom($from, $from_name);
$email->setTo($to);
$email->setHeader("X-".ucfirst(MFAPPNAME)."-mnid", $this->id);
$email->send();
$this->log->info(__METHOD__.": Sending MaintenanceNotification to $to");
$mnlog = MaintenanceNotificationLog::create([
"maintenancenotification_id" => $this->id,
"email" => "internal-email",
"sent" => date("U"),
]);
return true;
}