Fix returnData - #2881
This commit is contained in:
parent
5197c64f67
commit
3d6451d64b
|
@ -1755,13 +1755,21 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
|
||||||
$result_agents = $all_agents;
|
$result_agents = $all_agents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($returnType)) {
|
||||||
|
$returnType = "string";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($separator)) {
|
||||||
|
$separator = ";";
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($result_agents as $key => $value) {
|
foreach ($result_agents as $key => $value) {
|
||||||
$result_agents[$key]['status'] = agents_get_status($result_agents[$key]['id_agente'], true);
|
$result_agents[$key]['status'] = agents_get_status($result_agents[$key]['id_agente'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($result_agents) > 0 and $result_agents !== false) {
|
if (count($result_agents) > 0 and $result_agents !== false) {
|
||||||
$data = array('type' => 'array', 'data' => $result_agents);
|
$data = array('type' => 'array', 'data' => $result_agents);
|
||||||
return json_encode($data['data']);
|
returnData($returnType, $data, $separator);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
returnError('error_all_agents', 'No agents retrieved.');
|
returnError('error_all_agents', 'No agents retrieved.');
|
||||||
|
|
Loading…
Reference in New Issue