Merge branch '2881-Añadir-campo-de-estado-de-agente-en-la-llamada-API-get_all_agents-fix' into 'develop'

Fix returnData - #2881

See merge request artica/pandorafms!1849
This commit is contained in:
vgilc 2018-10-10 09:10:27 +02:00
commit ba419ad246
1 changed files with 9 additions and 1 deletions

View File

@ -1755,13 +1755,21 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
$result_agents = $all_agents;
}
if (empty($returnType)) {
$returnType = "string";
}
if (empty($separator)) {
$separator = ";";
}
foreach ($result_agents as $key => $value) {
$result_agents[$key]['status'] = agents_get_status($result_agents[$key]['id_agente'], true);
}
if (count($result_agents) > 0 and $result_agents !== false) {
$data = array('type' => 'array', 'data' => $result_agents);
return json_encode($data['data']);
returnData($returnType, $data, $separator);
}
else {
returnError('error_all_agents', 'No agents retrieved.');