Added Email Logging for Emailnotification class
This commit is contained in:
@@ -1041,6 +1041,9 @@ class PreorderController extends mfBaseController {
|
||||
$data = [];
|
||||
|
||||
switch($do) {
|
||||
case "getLoggedEmail":
|
||||
$return = $this->getLoggedEmail();
|
||||
break;
|
||||
case "saveAttribute":
|
||||
$return = $this->saveAttributeApi();
|
||||
break;
|
||||
@@ -1101,6 +1104,60 @@ class PreorderController extends mfBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
protected function getLoggedEmail() {
|
||||
$preorder_id = $this->request->pid;
|
||||
$emaillog_id = $this->request->eid;
|
||||
|
||||
if(!is_numeric($preorder_id) || $preorder_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!is_numeric($emaillog_id) || $emaillog_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$preorder = new Preorder($preorder_id);
|
||||
if(!$preorder->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$emaillog = new EmailLog($emaillog_id);
|
||||
if(!$emaillog->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($emaillog->object_type != "Preorder" || $emaillog->object_id != $preorder->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = [
|
||||
"preorder_id" => $preorder_id,
|
||||
"emaillog_id" => $emaillog_id,
|
||||
"from" => $emaillog->from,
|
||||
"to" => $emaillog->to,
|
||||
"subject" => $emaillog->subject,
|
||||
"body" => ($emaillog->body_html) ? $emaillog->body_html : $emaillog->body_text,
|
||||
"bodyIsHtml" => (bool) $emaillog->body_html,
|
||||
"sent" => date("d.m.Y H:i", $emaillog->create),
|
||||
"headers" => json_decode($emaillog->headers),
|
||||
"attachments" => [],
|
||||
];
|
||||
|
||||
if(is_array($emaillog->attachments) && count($emaillog->attachments)) {
|
||||
foreach($emaillog->attachments as $attachment) {
|
||||
$return["attachments"][] = [
|
||||
"id" => $attachment->id,
|
||||
"hash" => $attachment->content->sha256,
|
||||
"filename" => $attachment->filename,
|
||||
"filesize" => ($attachment->content) ? $attachment->content->filesize : 0,
|
||||
"mimetype" => ($attachment->content) ? $attachment->content->mimetype : "",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function saveBorderpointStatusApi() {
|
||||
$preorder_id = $this->request->preorder_id;
|
||||
$status_type = $this->request->status_type;
|
||||
|
||||
Reference in New Issue
Block a user