In a DM environment, if a user switches between nodes, the current node keeps defaulting to value of 0 or the master node when a group is picked from the drop down list. Below is a patch to fix the issue.
Code:
diff -ruN php/include/profiles.inc.php php.updated/include/profiles.inc.php
--- php/include/profiles.inc.php 2009-06-02 00:45:00.000000000 -0400
+++ php.updated/include/profiles.inc.php 2009-06-02 00:44:31.000000000 -0400
@@ -119,13 +119,13 @@
if($value === false) return false;
$sql_cond = '';
- if(zbx_numeric($idx2)) $sql_cond = ' AND idx2='.$idx2.' AND '.DBin_node('idx2');
+ if(!$idx == "web.nodes.switch_node") $sql_cond = ' AND '.DBin_node('profileid');
+ if(zbx_numeric($idx2)) $sql_cond = $sql_cond.' AND idx2='.$idx2.' AND '.DBin_node('idx2');
if(profile_type($type,'array')){
$sql='DELETE FROM profiles '.
' WHERE userid='.$USER_DETAILS['userid'].
' AND idx='.zbx_dbstr($idx).
- ' AND '.DBin_node('profileid').
$sql_cond;
DBstart();
@@ -140,7 +140,6 @@
$sql = 'SELECT profileid '.
' FROM profiles '.
' WHERE userid='.$USER_DETAILS['userid'].
- ' AND '.DBin_node('profileid').
' AND idx='.zbx_dbstr($idx).
$sql_cond;
@@ -176,7 +175,6 @@
' source='.zbx_dbstr($src).
' WHERE userid='.$USER_DETAILS["userid"].
' AND idx='.zbx_dbstr($idx).
- ' AND '.DBin_node('profileid').
$sql_cond;
//if($idx == 'web.audit.filter.action') SDI($sql);
$result = DBexecute($sql);
@@ -535,4 +533,4 @@
return false;
}
/********** END USER FAVORITES ***********/
-?>
\ No newline at end of file
+?>
Comment