mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-29 16:54:53 +02:00
Makes createLog function store authorName.
This commit is contained in:
parent
f5f78a549c
commit
bedf55d1ad
@ -22,13 +22,24 @@ class Log extends DataStore {
|
|||||||
'authorUser',
|
'authorUser',
|
||||||
'authorStaff',
|
'authorStaff',
|
||||||
'to',
|
'to',
|
||||||
'date'
|
'date',
|
||||||
|
'authorName'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createLog($type,$to, $author = null) {
|
public static function createLog($type, $to, $author = null) {
|
||||||
|
$session = Session::getInstance();
|
||||||
|
$authorName = '';
|
||||||
|
|
||||||
|
if($session->isTicketSession()) {
|
||||||
|
$ticketNumber = $session->getTicketNumber();
|
||||||
|
$ticket = Ticket::getByTicketNumber($ticketNumber);
|
||||||
|
$authorName = $ticket->authorToArray()['name'];
|
||||||
|
}
|
||||||
|
|
||||||
if($author === null) {
|
if($author === null) {
|
||||||
$author = Controller::getLoggedUser();
|
$author = Controller::getLoggedUser();
|
||||||
|
if(!$author->isNull()) $authorName = $author->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$log = new Log();
|
$log = new Log();
|
||||||
@ -36,7 +47,8 @@ class Log extends DataStore {
|
|||||||
$log->setProperties(array(
|
$log->setProperties(array(
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'to' => $to,
|
'to' => $to,
|
||||||
'date' => Date::getCurrentDate()
|
'date' => Date::getCurrentDate(),
|
||||||
|
'authorName' => $authorName
|
||||||
));
|
));
|
||||||
|
|
||||||
if($author instanceof User) {
|
if($author instanceof User) {
|
||||||
@ -55,8 +67,8 @@ class Log extends DataStore {
|
|||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'to' => $this->to,
|
'to' => $this->to,
|
||||||
'author' => [
|
'author' => [
|
||||||
'name' => $author->name,
|
'name' => $this->authorName,
|
||||||
'id' => $author->id,
|
'id' => !$author->isNull() ? $author->id : null,
|
||||||
'staff' => $author instanceof Staff
|
'staff' => $author instanceof Staff
|
||||||
],
|
],
|
||||||
'date' => $this->date
|
'date' => $this->date
|
||||||
|
Loading…
x
Reference in New Issue
Block a user