mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
Creates ticket session when an unlogged user creates a ticket.
Fixes runtime error when there is no author associated with a log.
This commit is contained in:
parent
bedf55d1ad
commit
a883f4d430
@ -115,10 +115,16 @@ class CreateController extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::createLog('CREATE_TICKET', $this->ticketNumber);
|
|
||||||
Response::respondSuccess([
|
Response::respondSuccess([
|
||||||
'ticketNumber' => $this->ticketNumber
|
'ticketNumber' => $this->ticketNumber
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if(!Controller::isUserSystemEnabled() && !Controller::isStaffLogged()) {
|
||||||
|
$session = Session::getInstance();
|
||||||
|
$session->createTicketSession($this->ticketNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::createLog('CREATE_TICKET', $this->ticketNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function storeTicket() {
|
private function storeTicket() {
|
||||||
|
@ -30,7 +30,7 @@ class Log extends DataStore {
|
|||||||
public static function createLog($type, $to, $author = null) {
|
public static function createLog($type, $to, $author = null) {
|
||||||
$session = Session::getInstance();
|
$session = Session::getInstance();
|
||||||
$authorName = '';
|
$authorName = '';
|
||||||
|
|
||||||
if($session->isTicketSession()) {
|
if($session->isTicketSession()) {
|
||||||
$ticketNumber = $session->getTicketNumber();
|
$ticketNumber = $session->getTicketNumber();
|
||||||
$ticket = Ticket::getByTicketNumber($ticketNumber);
|
$ticket = Ticket::getByTicketNumber($ticketNumber);
|
||||||
@ -68,7 +68,7 @@ class Log extends DataStore {
|
|||||||
'to' => $this->to,
|
'to' => $this->to,
|
||||||
'author' => [
|
'author' => [
|
||||||
'name' => $this->authorName,
|
'name' => $this->authorName,
|
||||||
'id' => !$author->isNull() ? $author->id : null,
|
'id' => $author && !$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