Added Email Logging for Emailnotification class
This commit is contained in:
@@ -278,7 +278,7 @@ class Address extends mfBaseModel {
|
||||
if(!$subject || !$from || !$from_name || !$to) {
|
||||
$this->log->warn("Service PIN copy Email not sent. (subject: '$subject', from: '$from_name', from_email: '$from', to: '$to')");
|
||||
} else {
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("Address", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
|
||||
class EmailLog extends mfBaseModel
|
||||
{
|
||||
protected $forcestr = ["object_type", "object_data", "from", "to", "subject"];
|
||||
|
||||
private $attachments;
|
||||
|
||||
protected function beforeUpdate($data) {
|
||||
if(!array_key_exists("edit_by", $data)) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$data["edit_by"] = $me->id;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "attachments") {
|
||||
$att = EmailLogAttachment::search(["emaillog_id" => $this->id]);
|
||||
if($att) {
|
||||
$this->attachments = $att;
|
||||
}
|
||||
return $this->attachments;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->getMfObject($classname, $this->$idfield);
|
||||
if(!$this->$name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Begin static Model functions
|
||||
*/
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new EmailLog();
|
||||
|
||||
$table_fields = [
|
||||
"object_type", "object_id", "object_data", "from", "to", "headers", "subject", "body_text", "body_html",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(in_array($field, $table_fields)) {
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
if($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("EmailLog", "*", "1 = 1 ORDER BY `create`");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new EmailLog($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLog
|
||||
WHERE $where
|
||||
ORDER BY id LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new EmailLog($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getLast($filter, $order = false) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(!$order) {
|
||||
$order = "`create` DESC";
|
||||
}
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLog
|
||||
WHERE $where
|
||||
ORDER BY $order LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new EmailLog($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM EmailLog
|
||||
WHERE $where";
|
||||
//var_dump($filter);exit;
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false, $order = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
if(!$order) {
|
||||
$order = "`create` ASC";
|
||||
}
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLog
|
||||
WHERE $where
|
||||
ORDER BY $order";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new EmailLog($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
|
||||
if(array_key_exists("object_type", $filter)) {
|
||||
$object_type = FronkDB::singleton()->escape($filter["object_type"]);
|
||||
if($object_type) {
|
||||
$where .= " AND object_type='$object_type'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("object_id", $filter)) {
|
||||
$object_id = $filter["object_id"];
|
||||
if(is_numeric($object_id)) {
|
||||
$where .= " AND object_id=$object_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("object_data", $filter)) {
|
||||
$object_data = FronkDB::singleton()->escape($filter["object_data"]);
|
||||
if($object_data) {
|
||||
$where .= " AND object_data LIKE '$object_data'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("from", $filter)) {
|
||||
$from = FronkDB::singleton()->escape($filter["from"]);
|
||||
if($from) {
|
||||
$where .= " AND from LIKE '$from'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("to", $filter)) {
|
||||
$to = FronkDB::singleton()->escape($filter["to"]);
|
||||
if($to) {
|
||||
$where .= " AND to LIKE '$to'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("subject", $filter)) {
|
||||
$subject = FronkDB::singleton()->escape($filter["subject"]);
|
||||
if($subject) {
|
||||
$where .= " AND subject LIKE '$subject'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(array_key_exists("add-where", $filter)) {
|
||||
$where .= " ".$filter['add-where'];
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
class EmailLogController extends mfBaseController {
|
||||
protected function init() {
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
}
|
||||
|
||||
protected function downloadContentAction() {
|
||||
$hash = $this->request->hash;
|
||||
$aid = $this->request->aid;
|
||||
|
||||
$att = EmailLogAttachment::getOne($aid);
|
||||
if(!$att) {
|
||||
header("{$_SERVER['SERVER_PROTOCOL']} 404 Not Found");
|
||||
echo "File not found";
|
||||
}
|
||||
|
||||
//var_dump($att);exit;
|
||||
|
||||
$content = EmailLogAttachmentContent::getFirst(["sha256" => $hash]);
|
||||
if(!$content) {
|
||||
header("{$_SERVER['SERVER_PROTOCOL']} 404 Not Found");
|
||||
echo "File not found";
|
||||
}
|
||||
|
||||
if($att->content_id != $content->id) {
|
||||
header("{$_SERVER['SERVER_PROTOCOL']} 404 Not Found");
|
||||
echo "File not found";
|
||||
}
|
||||
|
||||
set_time_limit(36000);
|
||||
if($content->mimetype) {
|
||||
header("Content-Type: $content->mimetype");
|
||||
} else {
|
||||
header("Content-Type: application/octet-stream");
|
||||
}
|
||||
header('Content-disposition: attachment; filename="' . $att->filename . '"');
|
||||
header("Content-Length: $content->filesize");
|
||||
|
||||
echo $content->content;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
class EmailLogAttachment extends mfBaseModel
|
||||
{
|
||||
protected $forcestr = ["filename"];
|
||||
|
||||
private $content;
|
||||
|
||||
protected function beforeUpdate($data) {
|
||||
if(!array_key_exists("edit_by", $data)) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$data["edit_by"] = $me->id;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "content") {
|
||||
$content = EmailLogAttachmentContent::getOne($this->content_id);
|
||||
if($content) {
|
||||
$this->content = $content;
|
||||
}
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->getMfObject($classname, $this->$idfield);
|
||||
if(!$this->$name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Begin static Model functions
|
||||
*/
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new EmailLogAttachment();
|
||||
|
||||
$table_fields = [
|
||||
"emaillog_id", "content_id", "filename",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(in_array($field, $table_fields)) {
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
if($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("EmailLogAttachment", "*", "1 = 1 ORDER BY `create`");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new EmailLogAttachment($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getOne($id) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(!is_numeric($id)) return null;
|
||||
|
||||
$item = new EmailLogAttachment($id);
|
||||
if($item && $item->id) {
|
||||
return $item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLogAttachment
|
||||
WHERE $where
|
||||
ORDER BY `create` LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new EmailLogAttachment($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getLast($filter, $order = false) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(!$order) {
|
||||
$order = "`create` DESC";
|
||||
}
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLogAttachment
|
||||
WHERE $where
|
||||
ORDER BY $order LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new EmailLogAttachment($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM EmailLogAttachment
|
||||
WHERE $where";
|
||||
//var_dump($filter);exit;
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false, $order = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
if(!$order) {
|
||||
$order = "`create` ASC";
|
||||
}
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLogAttachment
|
||||
WHERE $where
|
||||
ORDER BY $order";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new EmailLogAttachment($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
|
||||
|
||||
if(array_key_exists("emaillog_id", $filter)) {
|
||||
$emaillog_id = $filter["emaillog_id"];
|
||||
if(is_numeric($emaillog_id)) {
|
||||
$where .= " AND emaillog_id=$emaillog_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("content_id", $filter)) {
|
||||
$content_id = $filter["content_id"];
|
||||
if(is_numeric($content_id)) {
|
||||
$where .= " AND content_id=$content_id";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(array_key_exists("add-where", $filter)) {
|
||||
$where .= " ".$filter['add-where'];
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
|
||||
class EmailLogAttachmentContent extends mfBaseModel
|
||||
{
|
||||
protected $forcestr = ["sha256", "data"];
|
||||
protected $forcebinary = ["content"];
|
||||
|
||||
private $attachments;
|
||||
|
||||
protected function beforeUpdate($data) {
|
||||
if(!array_key_exists("edit_by", $data)) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$data["edit_by"] = $me->id;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->getMfObject($classname, $this->$idfield);
|
||||
if(!$this->$name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
/********************************
|
||||
* Begin static Model functions
|
||||
*/
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new EmailLogAttachmentContent();
|
||||
|
||||
$table_fields = [
|
||||
"mimetype", "filesize", "sha256", "content",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(in_array($field, $table_fields)) {
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
if($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(!is_numeric($id)) return null;
|
||||
|
||||
$item = new EmailLogAttachmentContent($id);
|
||||
if($item && $item->id) {
|
||||
return $item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("EmailLogAttachmentContent", "*", "1 = 1 ORDER BY `create`");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new EmailLogAttachmentContent($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLogAttachmentContent
|
||||
WHERE $where
|
||||
ORDER BY id LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new EmailLogAttachmentContent($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getLast($filter, $order = false) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(!$order) {
|
||||
$order = "`create` DESC";
|
||||
}
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLogAttachmentContent
|
||||
WHERE $where
|
||||
ORDER BY $order LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new EmailLogAttachmentContent($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM EmailLogAttachmentContent
|
||||
WHERE $where";
|
||||
//var_dump($filter);exit;
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false, $order = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
|
||||
if(!$order) {
|
||||
$order = "`create` ASC";
|
||||
}
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM EmailLogAttachmentContent
|
||||
WHERE $where
|
||||
ORDER BY $order";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new EmailLogAttachmentContent($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
|
||||
if(array_key_exists("mimetype", $filter)) {
|
||||
$mimetype = FronkDB::singleton()->escape($filter["mimetype"]);
|
||||
if($mimetype) {
|
||||
$where .= " AND mimetype LIKE '$mimetype'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("sha256", $filter)) {
|
||||
$sha256 = FronkDB::singleton()->escape($filter["sha256"]);
|
||||
if($sha256) {
|
||||
$where .= " AND sha256='$sha256'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(array_key_exists("add-where", $filter)) {
|
||||
$where .= " ".$filter['add-where'];
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,19 +12,29 @@ class Emailnotification {
|
||||
private $email_from = false;
|
||||
private $email_to = false;
|
||||
private $attachments = [];
|
||||
|
||||
private $object_type = "";
|
||||
private $object_id = 0;
|
||||
private $object_data = "";
|
||||
|
||||
private $_mimeheaders;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct($object_type = false, $object_id = false, $object_data = false) {
|
||||
$this->headers = [
|
||||
'X-Mailer' => MFAPPNAME.' Mailer',
|
||||
];
|
||||
|
||||
$this->email_from = TT_OUTGOING_EMAIL;
|
||||
$this->from_name = TT_OUTGOING_EMAIL_NAME;
|
||||
|
||||
if($object_type !== false) $this->object_type = $object_type;
|
||||
if($object_id !== false) $this->object_id = $object_id;
|
||||
if($object_data !== false) $this->object_data = $object_data;
|
||||
}
|
||||
|
||||
public function addAttachment($file = null, $content = null, $name = false, $c_type = "application/octet-stream", $disposition = "attachment", $encoding = "base64" , $charset = "utf-8") {
|
||||
public function addAttachment($filepath = null, $content = null, $name = false, $c_type = "application/octet-stream", $disposition = "attachment", $encoding = "base64" , $charset = "utf-8") {
|
||||
$attachment = [
|
||||
"file" => $file,
|
||||
"file" => $filepath,
|
||||
"content" => $content,
|
||||
"name" => $name,
|
||||
"c_type" => $c_type,
|
||||
@@ -34,7 +44,7 @@ class Emailnotification {
|
||||
];
|
||||
|
||||
$attachment["isfile"] = false;
|
||||
if($file) {
|
||||
if($filepath) {
|
||||
$attachment['isfile'] = true;
|
||||
}
|
||||
|
||||
@@ -119,6 +129,7 @@ class Emailnotification {
|
||||
|
||||
$body = $mime->get($mimeparams);
|
||||
$headers = $mime->headers($this->headers);
|
||||
$this->_mimeheaders = $headers;
|
||||
//$log->debug(print_r($headers, true));
|
||||
|
||||
$mail =& Mail::factory('mail', ["-f ".$this->email_from]);
|
||||
@@ -135,6 +146,85 @@ class Emailnotification {
|
||||
*/
|
||||
$mail->sep = "\r\n";
|
||||
$mail->send($this->email_to, $headers, $body);
|
||||
|
||||
$this->_createEmailLog();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function _createEmailLog() {
|
||||
if(!$this->object_id || !$this->object_type) return true;
|
||||
|
||||
$log = mfLoghandler::singleton();
|
||||
|
||||
if(array_key_exists("To", $this->_mimeheaders)) {
|
||||
$this->_mimeheaders['To'] = $this->email_to;
|
||||
}
|
||||
|
||||
FronkDB::singleton()->startTransaction();
|
||||
|
||||
$el = EmailLog::create([
|
||||
'object_type' => $this->object_type,
|
||||
'object_id' => $this->object_id,
|
||||
'object_data' => $this->object_data,
|
||||
'from' => $this->email_from,
|
||||
'to' => $this->email_to,
|
||||
'headers' => json_encode($this->_mimeheaders),
|
||||
'subject' => $this->subject,
|
||||
'body_text' => $this->body,
|
||||
'body_html' => $this->html,
|
||||
]);
|
||||
if(!$el->save()) {
|
||||
$log->error(__METHOD__.": Error saving EmailLog. {$this->object_type}: {$this->object_id} from: '{$this->email_from}' | to: '{$this->email_to}' | subject: '{$this->subject}'");
|
||||
FronkDB::singleton()->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(is_array($this->attachments) && count($this->attachments)) {
|
||||
foreach($this->attachments as $att) {
|
||||
if($att['isfile']) {
|
||||
if(!file_exists($att["file"])) {
|
||||
$log->error(__METHOD__.": File not found. ".$this->object_type.": ".$this->object_id." / Filename: ".$att['name']);
|
||||
continue;
|
||||
}
|
||||
$sha256_hash = hash_file("sha256", $att["file"]);
|
||||
$filesize = filesize($att["file"]);
|
||||
$file_content = file_get_contents($att["file"]);
|
||||
} else {
|
||||
$sha256_hash = hash("sha256", $att["content"]);
|
||||
$filesize = strlen($att["content"]);
|
||||
$file_content = $att["content"];
|
||||
}
|
||||
|
||||
// find attachment content or create it
|
||||
$ela_content = EmailLogAttachmentContent::getFirst(['sha256' => $sha256_hash]);
|
||||
if(!$ela_content) {
|
||||
$ela_content = EmailLogAttachmentContent::create([
|
||||
'mimetype' => $att['c_type'],
|
||||
'filesize' => $filesize,
|
||||
'sha256' => $sha256_hash,
|
||||
'content' => $file_content,
|
||||
]);
|
||||
|
||||
if (!$ela_content->save()) {
|
||||
$log->error(__METHOD__ . ": Error saving EmailLogAttachmentContent. " . $this->object_type . ": " . $this->object_id . " / Filename: " . $att['name']);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$ela = EmailLogAttachment::create([
|
||||
'emaillog_id' => $el->id,
|
||||
'content_id' => $ela_content->id,
|
||||
'filename' => $att['name'],
|
||||
]);
|
||||
if(!$ela->save()) {
|
||||
$log->error(__METHOD__.": Error saving EmailLogAttachment. ".$this->object_type.": ".$this->object_id." / Filename: ".$att['name']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
FronkDB::singleton()->commitTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -152,7 +152,7 @@ XINON GmbH";
|
||||
$this->log->warn(__METHOD__.": Invoice ".$this->invoice_number." could not be sent. Values missing. (subject: '$subject', from: '$from_name', from_email: '$from', to: '$to')");
|
||||
return false;
|
||||
} else {
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("Invoice", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
|
||||
@@ -77,7 +77,7 @@ class MailtemplateDispatch extends mfBaseModel {
|
||||
continue;
|
||||
}
|
||||
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("MailtemplateDispatch", $this->id);
|
||||
$email->setSubject($subject);
|
||||
if($template->body_html) {
|
||||
$email->setHtmlBody($body);
|
||||
|
||||
@@ -48,7 +48,7 @@ class MaintenanceNotification extends mfBaseModel {
|
||||
continue;
|
||||
}
|
||||
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("MaintenanceNotification", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
@@ -84,7 +84,7 @@ class MaintenanceNotification extends mfBaseModel {
|
||||
$to = "wartungsverteiler.team@xinon.at";
|
||||
$body .= "\n\nPLZ Liste:\n\n";
|
||||
$body .= implode("\n", $this->getProperty("plzs"));
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("MaintenanceNotification", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
|
||||
@@ -157,7 +157,7 @@ class Order 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("Order", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
@@ -192,7 +192,7 @@ class Order extends mfBaseModel {
|
||||
|
||||
return false;
|
||||
} else {
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("Order", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
@@ -231,7 +231,7 @@ class Order extends mfBaseModel {
|
||||
$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 = new Emailnotification("Order", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
@@ -263,7 +263,7 @@ class Order extends mfBaseModel {
|
||||
$this->log->warn("Billing NBE Email not sent. (subject: '$subject', from: '$from', from_email: '$from_name', to: '$to')");
|
||||
return false;
|
||||
} else {
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("Order", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
@@ -290,7 +290,7 @@ class Order extends mfBaseModel {
|
||||
$tk_body = $tk_tpl->render();
|
||||
$tk_values = $tk_tpl->getReturnedValue();
|
||||
|
||||
$tk_email = new Emailnotification();
|
||||
$tk_email = new Emailnotification("Order", $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"]);
|
||||
@@ -342,7 +342,7 @@ class Order extends mfBaseModel {
|
||||
$this->log->warning("File (orderfile->id: ".$file->id.") not a valid mimetype: $mimetype");
|
||||
}
|
||||
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("Order", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
|
||||
@@ -397,7 +397,7 @@ class Preorder extends mfBaseModel {
|
||||
|
||||
$body_type = $mailtemplate->body_html ? "html" : "text";
|
||||
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("Preorder", $this->id, json_encode(["template" => $action["template"]]));
|
||||
$email->setSubject($subject);
|
||||
if($body_type == "html") {
|
||||
$email->setHtmlBody($body);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -206,7 +206,7 @@ RML Infrastruktur GmbH";
|
||||
$this->log->warn(__METHOD__.": Invoice ".$this->invoice_number." could not be sent. Values missing. (subject: '$subject', from: '$from_name', from_email: '$from', to: '$to')");
|
||||
return false;
|
||||
} else {
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("PreorderBillingInvoice", $this->id);
|
||||
$email->setSubject($subject);
|
||||
$email->setHtmlBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
|
||||
@@ -4,6 +4,8 @@ class Preordernotification extends mfBaseModel {
|
||||
private $campaign;
|
||||
private $filter;
|
||||
private $files;
|
||||
|
||||
private $email_logs;
|
||||
|
||||
private $creator;
|
||||
private $editor;
|
||||
@@ -96,7 +98,7 @@ class Preordernotification extends mfBaseModel {
|
||||
$this->log->warn("Preordernotification not sent. subject, from or to missing. Preorder id ".$preorder->id);
|
||||
return false;
|
||||
} else {
|
||||
$email = new Emailnotification();
|
||||
$email = new Emailnotification("Preorder", $preorder->id, json_encode(["email_type" => "Preordernotification", "preordernotification_id" => $this->id]));
|
||||
$email->setSubject($subject);
|
||||
$email->setHtmlBody($body);
|
||||
$email->setFrom($from, $from_name);
|
||||
@@ -186,6 +188,14 @@ class Preordernotification extends mfBaseModel {
|
||||
$this->files = PreordernotificationFileModel::search(["preordernotification_id" => $this->id]);
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
if($name == "email_logs") {
|
||||
$email_logs = EmailLog::search(["type" => "Preordernotification", "type_id" => $this->id]);
|
||||
if($email_logs) {
|
||||
$this->email_logs = $email_logs;
|
||||
}
|
||||
return $this->email_logs;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$user = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
|
||||
@@ -470,4 +470,116 @@ class PreordernotificationController extends mfBaseController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function EmailLog() {
|
||||
$this->layout()->setTemplate("Preordernotification/EmailLog");
|
||||
$id = $this->request->id;
|
||||
if(!is_numeric($id) || $id < 1) {
|
||||
$this->layout()->setFlash("Aussendung nicht gefunden", "error");
|
||||
$this->redirect("Preordernotification");
|
||||
}
|
||||
|
||||
$notification = new Preordernotification($id);
|
||||
if(!$notification->id) {
|
||||
$this->layout()->setFlash("Aussendung nicht gefunden", "error");
|
||||
$this->redirect("Preordernotification");
|
||||
}
|
||||
$this->layout()->set("notification", $notification);
|
||||
|
||||
$filter = $this->request->filter;
|
||||
if(!is_array($filter)) {
|
||||
$filter = [];
|
||||
}
|
||||
|
||||
$this->layout->set("filter", $filter);
|
||||
$filter["object_type"] = "Preordernotification";
|
||||
$filter["object_id"] = $id;
|
||||
|
||||
// pagination defaults
|
||||
$pagination = [];
|
||||
$pagination['start'] = 0;
|
||||
$pagination['count'] = 25;
|
||||
$pagination['maxItems'] = 0;
|
||||
|
||||
if(is_numeric($this->request->s)) {
|
||||
$pagination['start'] = intval($this->request->s);
|
||||
}
|
||||
|
||||
$pagination["maxItems"] = EmailLog::count($filter);
|
||||
$emails = EmailLog::search($filter, $pagination);
|
||||
|
||||
$this->layout()->set("pagination", $pagination);
|
||||
$this->layout()->set("emails", $emails);
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
$data = [];
|
||||
|
||||
switch($do) {
|
||||
case "getLoggedEmail":
|
||||
$return = $this->getLoggedEmail();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
|
||||
if(!is_array($return) || !count($return)) {
|
||||
$data = ["status" => "error"];
|
||||
$this->returnJson($data);
|
||||
}
|
||||
$data['status'] = "OK";
|
||||
$data['result'] = $return;
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
protected function getLoggedEmail() {
|
||||
$preordernotification_id = $this->request->nid;
|
||||
$emaillog_id = $this->request->eid;
|
||||
|
||||
if(!is_numeric($preordernotification_id) || $preordernotification_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!is_numeric($emaillog_id) || $emaillog_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$notification = new Preordernotification($preordernotification_id);
|
||||
if(!$notification->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$emaillog = new EmailLog($emaillog_id);
|
||||
if(!$emaillog->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = [
|
||||
"preordernotification_id" => $preordernotification_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;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,34 @@
|
||||
<?php
|
||||
|
||||
class PreordernotificationLog extends mfBaseModel {
|
||||
|
||||
private $notification;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "notification") {
|
||||
$notification = new Preordernotification($this->preordernotification_id);
|
||||
if($notification->id) {
|
||||
$this->notification = $notification;
|
||||
}
|
||||
return $this->notification;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user