function task_breaker_transaction_edit_ticket() { $task_id = (int) filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT); $title = filter_input(INPUT_POST, 'title', FILTER_UNSAFE_RAW); $description = filter_input(INPUT_POST, 'description', FILTER_UNSAFE_RAW); $priority = filter_input(INPUT_POST, 'priority', FILTER_UNSAFE_RAW); $user_id = filter_input(INPUT_POST, 'user_id', FILTER_VALIDATE_INT); $project_id = filter_input(INPUT_POST, 'project_id', FILTER_VALIDATE_INT); $assigned_users = filter_input(INPUT_POST, 'user_id_collection', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); $template = ''; $task = new ThriveProjectTasksController(); // Clean $assigned_users var in case the users submits non array parameters. if (!$assigned_users) { $assigned_users = array(); } $args = array('title' => $title, 'id' => $task_id, 'description' => $description, 'priority' => $priority, 'user_id' => $user_id, 'project_id' => $project_id, 'assigned_users' => $assigned_users); $json_response = array('message' => 'success', 'type' => 'valid', 'debug' => $task_id, 'html' => $template); $json_response = array_merge($json_response, $args); if ($task->updateTicket($task_id, $args)) { $json_response['message'] = 'success'; } else { $json_response['type'] = 'required'; if (!empty($title) && !empty($description)) { $json_response['type'] = 'no_changes'; } $json_response['message'] = 'fail'; } task_breaker_api_message($json_response); return; }