Skip to content
Snippets Groups Projects
Commit 979888d3 authored by Stephen Packer's avatar Stephen Packer
Browse files

createTicket respects alert/autorespond negatives

It was previously not possible to use the `alert` and `autorespond` flags in a negative way to prevent those two events, since the ternary operator would have used the `false` ternary value, which was `true`.  This corrects that by allowing the default of `true` to be used only when the `$data` array does not have the appropriate keys set.  Assigning `$data['source']` was altered to use the same formatting and caution against an undefined index error.
parent c18eac40
No related branches found
No related tags found
No related merge requests found
......@@ -118,9 +118,9 @@ class TicketApiController extends ApiController {
function createTicket($data) {
# Pull off some meta-data
$alert = $data['alert'] ? $data['alert'] : true;
$autorespond = $data['autorespond'] ? $data['autorespond'] : true;
$data['source'] = $data['source'] ? $data['source'] : 'API';
$alert = array_key_exists('alert', $data) ? $data['alert'] : true;
$autorespond = array_key_exists('autorespond', $data) ? $data['autorespond'] : true;
$data['source'] = array_key_exists('source', $data) ? $data['source'] : 'API';
# Create the ticket with the data (attempt to anyway)
$errors = array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment