diff --git a/include/api.tickets.php b/include/api.tickets.php index 6371daa632ff5240b0bee90cb3bed69c0ac56384..d80b1582889f7bf3f944eea9808a3f675f6008f2 100644 --- a/include/api.tickets.php +++ b/include/api.tickets.php @@ -118,9 +118,11 @@ 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 = (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'; # Create the ticket with the data (attempt to anyway) $errors = array(); diff --git a/include/class.api.php b/include/class.api.php index 0fd2c17e3f0ab552513c775e5f2f93ee52bc1e7f..2382a70e406d2b3f114fc4f1fd280b5ba67aed91 100644 --- a/include/class.api.php +++ b/include/class.api.php @@ -330,9 +330,9 @@ class ApiXmlDataParser extends XmlDataParser { if ($key == "phone" && is_array($value)) { $value = $value[":text"]; } else if ($key == "alert") { - $value = (bool)$value; + $value = (bool) (strtolower($value) === 'false' ? false : $value); } else if ($key == "autorespond") { - $value = (bool)$value; + $value = (bool) (strtolower($value) === 'false' ? false : $value); } else if ($key == "message") { if (!is_array($value)) { $value = array(