diff --git a/include/api.ticket.php b/include/api.ticket.php index d767e2128ba2ee4f60abcc44f2fc10b2f4af1a23..4fcae4b183925dfe32bb91c95275a986fc492ea6 100644 --- a/include/api.ticket.php +++ b/include/api.ticket.php @@ -10,7 +10,7 @@ class TicketController extends ApiController { # so that all supported input formats should be supported function getRequestStructure($format) { $supported = array( - "alert", "autorespond", "source", + "alert", "autorespond", "source", "topicId", "name", "email", "subject", "phone", "phone_ext", "attachments" => array("*" => array("name", "type", "data", "encoding") @@ -33,8 +33,10 @@ class TicketController extends ApiController { $autorespond = $data['autorespond'] ? $data['autorespond'] : true; $source = $data['source'] ? $data['source'] : 'API'; - # TODO: Handle attachment encoding (base64) - foreach ($data["attachments"] as $filename=>&$info) { + $attachments = $data['attachments'] ? $data['attachments'] : array(); + + # TODO: Handle attachment encoding (base64) + foreach ($attachments as $filename=>&$info) { if ($info["encoding"] == "base64") { # XXX: May fail on large inputs. See # http://us.php.net/manual/en/function.base64-decode.php#105512 @@ -60,7 +62,7 @@ class TicketController extends ApiController { } # Save attachment(s) - foreach ($data["attachments"] as &$info) + foreach ($attachments as &$info) $ticket->saveAttachment($info, $ticket->getLastMsgId(), "M"); # All done. Return HTTP/201 --> Created diff --git a/include/class.ticket.php b/include/class.ticket.php index c6329ed330400be0149b10bbdf40b32c5f0dc16c..46e7d863696c8755fd72b70868464887c7315534 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1494,7 +1494,7 @@ class Ticket{ function postNote($title,$note,$alert=true,$poster='') { global $thisstaff,$cfg; - $poster=($poster || !$thisstaff)?$poster:$thisstaff->getName(); + $poster=($poster || !$thisstaff)?$poster:$thisstaff->getName(); $sql= 'INSERT INTO '.TICKET_THREAD_TABLE.' SET created=NOW() '. ',thread_type="N"'.