From 317b9503bd794c12ebfce24ee55de52068fa644a Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Wed, 25 Jan 2012 15:48:20 +0000 Subject: [PATCH] 2012-01-25 Juan Manuel Ramon * include/functions_api.php: Added csv separator in function get_all_agents. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5429 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ pandora_console/include/functions_api.php | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 23944f6580..d0bf5d1c0f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2012-01-25 Juan Manuel Ramon + + * include/functions_api.php: Added csv separator in function + get_all_agents. + 2012-01-25 Vanessa Gil * include/functions_agents.php: Bad behavior group filter diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 8822aab79f..1df886811e 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -759,11 +759,11 @@ function set_delete_agent($id, $thrash1, $thrast2, $thrash3) { * * @param $thrash1 Don't use. * @param $thrash2 Don't use. - * @param array $other it's array, $other as param are the filters available ;;;; in this order + * @param array $other it's array, $other as param are the filters available ;;;;; in this order * and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_) * example: * - * api.php?op=get&op2=all_agents&return_type=csv&other=1|2|warning|j|2&other_mode=url_encode_separator_| + * api.php?op=get&op2=all_agents&return_type=csv&other=1|2|warning|j|2|~&other_mode=url_encode_separator_| * * @param $thrash3 Don't use. */ @@ -799,6 +799,11 @@ function get_all_agents($thrash1, $thrash2, $other, $thrash3) { } } + if (!isset($other['data'][5])) + $separator = ';'; //by default + else + $separator = $other['data'][5]; + // Initialization of array $result_agents = array(); // Filter by state @@ -868,7 +873,7 @@ function get_all_agents($thrash1, $thrash2, $other, $thrash3) { if (count($result_agents) > 0 and $result_agents !== false){ $data = array('type' => 'array', 'data' => $result_agents); - returnData('csv', $data, ';'); + returnData('csv', $data, $separator); } else { returnError('error_all_agents', 'No agents retrieved.');