2011-09-06 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* godmode/setup/setup.php: Avoiding wrong integria inventory
        object data.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4912 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-09-06 08:44:45 +00:00
parent ee1ade65ce
commit 4efc90766d
2 changed files with 25 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2011-09-06 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* godmode/setup/setup.php: Avoiding wrong integria inventory object data.
2011-09-05 Miguel de Dios <miguel.dedios@artica.es>
* operation/agentes/alerts_status.php: change the user rights to validate

View File

@ -134,18 +134,28 @@ if($config["integria_enabled"]) {
$invent = incidents_call_api($config['integria_url']."/include/api.php?user=".$config['id_user']."&pass=".$config['integria_api_password']."&op=get_inventories");
$invent = explode("\n",$invent);
$inventories = array();
foreach($invent as $inv) {
if($inv == '') {
continue;
}
$invexp = explode(',',$inv);
if(substr($invexp[1], 0, 1) == '"' && substr($invexp[1], strlen($invexp[1])-1, 1) == '"') {
$invexp[1] = substr($invexp[1], 1, strlen($invexp[1])-2);
}
$inventories[$invexp[0]] = $invexp[1];
$bad_input = false;
foreach($invent as $inv){
// This avoid wrong integria inventory object
if (stristr($inv, 'ERROR 404') !== false){
$inventories[""] = __('None');
$bad_input = true;
break;
}
}
if (!$bad_input){
foreach($invent as $inv) {
if($inv == '') {
continue;
}
$invexp = explode(',',$inv);
if(substr($invexp[1], 0, 1) == '"' && substr($invexp[1], strlen($invexp[1])-1, 1) == '"') {
$invexp[1] = substr($invexp[1], 1, strlen($invexp[1])-2);
}
$inventories[$invexp[0]] = $invexp[1];
}
}
$table->data[21][0] = __('Integria inventory');
$table->data[21][1] = html_print_select($inventories, 'integria_inventory', $config["integria_inventory"], '', '', '', true);
}