2012-01-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* 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
This commit is contained in:
juanmanuelr 2012-01-25 15:48:20 +00:00
parent 561a5cc018
commit 00c6d7fceb
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2012-01-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_api.php: Added csv separator in function
get_all_agents.
2012-01-25 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_agents.php: Bad behavior group filter

View File

@ -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 <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy> in this order
* @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<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.');