Merge branch '1732-Filtros_SNMP_se_van_acumulando' into 'develop'

fixed error in snmp filters

See merge request artica/pandorafms!1213
This commit is contained in:
mariopulido 2017-12-29 09:08:42 +01:00
commit 67adaee138
1 changed files with 11 additions and 2 deletions

View File

@ -13,7 +13,6 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// Check ACL // Check ACL
if (! check_acl ($config['id_user'], 0, "LW")) { if (! check_acl ($config['id_user'], 0, "LW")) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
@ -142,6 +141,7 @@ if ($edit_filter > -1) {
// Create/update form // Create/update form
if ($edit_filter > -2) { if ($edit_filter > -2) {
$index = $index_post; $index = $index_post;
$table = new stdClass();
$table->data = array (); $table->data = array ();
$table->id = 'filter_table'; $table->id = 'filter_table';
$table->width = '100%'; $table->width = '100%';
@ -150,8 +150,16 @@ if ($edit_filter > -2) {
$table->data[0][1] = html_print_input_text ('description', $description, '', 60, 100, true); $table->data[0][1] = html_print_input_text ('description', $description, '', 60, 100, true);
$table->data[1][0] = __('Filter'); $table->data[1][0] = __('Filter');
if ($edit_filter > -1) { if ($edit_filter > -1) {
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = (SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter . ")"); $unified_filter = db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter != 0 AND id_snmp_filter = " . $edit_filter);
if($unified_filter){
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $unified_filter);
}
else{
$filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter);
}
$j = 1; $j = 1;
foreach ($filters as $f) { foreach ($filters as $f) {
if ($j != 1) { if ($j != 1) {
$table->data[$j][0] = ""; $table->data[$j][0] = "";
@ -203,6 +211,7 @@ else {
$aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $res['unified_filters_id'] . " ORDER BY id_snmp_filter ASC"); $aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $res['unified_filters_id'] . " ORDER BY id_snmp_filter ASC");
} }
$table = new stdClass();
$table->data = array (); $table->data = array ();
$table->head = array (); $table->head = array ();
$table->size = array (); $table->size = array ();