From ba2d31cd68982de5f0e4f6c2c025a20f352a864c Mon Sep 17 00:00:00 2001 From: Peter Rotich Date: Mon, 7 Nov 2022 16:08:05 +0000 Subject: [PATCH] api: Pass Ticket Source to Ticket Create --- include/api.tickets.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/api.tickets.php b/include/api.tickets.php index ffa6b4a397..989eee4ba8 100644 --- a/include/api.tickets.php +++ b/include/api.tickets.php @@ -125,14 +125,14 @@ function create($format) { /* private helper functions */ - function createTicket($data) { + function createTicket($data, $source = 'API') { # Pull off some meta-data $alert = (bool) (isset($data['alert']) ? $data['alert'] : true); $autorespond = (bool) (isset($data['autorespond']) ? $data['autorespond'] : true); # Assign default value to source if not defined, or defined as NULL - $data['source'] = isset($data['source']) ? $data['source'] : 'API'; + $data['source'] = $data['source'] ?? $source; # Create the ticket with the data (attempt to anyway) $errors = array(); @@ -199,7 +199,7 @@ function processEmail($data=false) { // will always create new "Tickets". All other objects will need to // be created via the web interface or the API try { - return $this->createTicket($data); + return $this->createTicket($data, 'Email'); } catch (TicketDenied $ex) { // Log the mid so we don't process this email again! $entry = new ThreadEntry();