Skip to content

Commit

Permalink
api: Pass Ticket Source to Ticket Create
Browse files Browse the repository at this point in the history
  • Loading branch information
protich committed Nov 8, 2022
1 parent a4e36d3 commit ba2d31c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/api.tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ba2d31c

Please sign in to comment.