Changeset 6697

Show
Ignore:
Timestamp:
10/02/08 18:14:53 (7 weeks ago)
Author:
shotamchay
Message:

development on action log

Location:
trunk/centreon/www/include/configuration/configObject
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/centreon/www/include/configuration/configObject/contact/DB-Func.php

    r6693 r6697  
    158158                                        $maxId =& $DBRESULT->fetchRow(); 
    159159                                        if (isset($maxId["MAX(contact_id)"]))   { 
    160                                                 $oreon->CentreonLogAction->insertLog("contact", $maxId["MAX(contact_id)"], $contact_name, "a", $fields);                                                 
    161160                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT command_command_id FROM contact_hostcommands_relation WHERE contact_contact_id = '".$key."'"); 
    162161                                                if (PEAR::isError($DBRESULT)) 
    163162                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     163                                                $fields["contact_hostNotifCmds"] = ""; 
    164164                                                while($hostCmd =& $DBRESULT->fetchRow())        { 
    165165                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO contact_hostcommands_relation VALUES ('', '".$maxId["MAX(contact_id)"]."', '".$hostCmd["command_command_id"]."')"); 
    166166                                                        if (PEAR::isError($DBRESULT2)) 
    167167                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     168                                                        $fields["contact_hostNotifCmds"] .= $hostCmd["command_command_id"] . ","; 
    168169                                                } 
     170                                                $fields["contact_hostNotifCmds"] = trim($fields["contact_hostNotifCmds"], ","); 
    169171                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT command_command_id FROM contact_servicecommands_relation WHERE contact_contact_id = '".$key."'"); 
    170172                                                if (PEAR::isError($DBRESULT)) 
    171173                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     174                                                $fields["contact_svNotifCmds"] = ""; 
    172175                                                while($serviceCmd =& $DBRESULT->fetchRow())     { 
    173176                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO contact_servicecommands_relation VALUES ('', '".$maxId["MAX(contact_id)"]."', '".$serviceCmd["command_command_id"]."')"); 
    174177                                                        if (PEAR::isError($DBRESULT2)) 
    175178                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     179                                                        $fields["contact_svNotifCmds"] .= $serviceCmd["command_command_id"] . ","; 
    176180                                                } 
     181                                                $fields["contact_svNotifCmds"] = trim($fields["contact_svNotifCmds"], ","); 
    177182                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT contactgroup_cg_id FROM contactgroup_contact_relation WHERE contact_contact_id = '".$key."'"); 
    178183                                                if (PEAR::isError($DBRESULT)) 
    179184                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     185                                                $fields["contact_cgNotif"] = ""; 
    180186                                                while($Cg =& $DBRESULT->fetchRow())     { 
    181187                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO contactgroup_contact_relation VALUES ('', '".$maxId["MAX(contact_id)"]."', '".$Cg["contactgroup_cg_id"]."')"); 
    182188                                                        if (PEAR::isError($DBRESULT2)) 
    183189                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     190                                                        $fields["contact_cgNotif"] .= $Cg["contactgroup_cg_id"] . ","; 
    184191                                                } 
     192                                                $fields["contact_cgNotif"] = trim($fields["contact_cgNotif"], ","); 
     193                                                $oreon->CentreonLogAction->insertLog("contact", $maxId["MAX(contact_id)"], $contact_name, "a", $fields); 
    185194                                        } 
    186195                                } 
     
    297306                $fields["contact_ldap_dn"] = $ret["contact_ldap_dn"]; 
    298307                $fields["contact_location"] = $ret["contact_location"]; 
     308                $fields["contact_hostNotifCmds"] = implode(",", $ret["contact_hostNotifCmds"]); 
     309                $fields["contact_svNotifCmds"] = implode(",", $ret["contact_svNotifCmds"]); 
     310                $fields["contact_cgNotif"] = implode(",", $ret["contact_cgNotif"]); 
    299311                $oreon->CentreonLogAction->insertLog("contact", $contact_id["MAX(contact_id)"], $ret["contact_name"], "a", $fields); 
    300312                 
     
    373385                $fields["contact_ldap_dn"] = $ret["contact_ldap_dn"]; 
    374386                $fields["contact_location"] = $ret["contact_location"]; 
     387                $fields["contact_hostNotifCmds"] = implode(",", $ret["contact_hostNotifCmds"]); 
     388                $fields["contact_svNotifCmds"] = implode(",", $ret["contact_svNotifCmds"]); 
     389                $fields["contact_cgNotif"] = implode(",", $ret["contact_cgNotif"]); 
    375390                $oreon->CentreonLogAction->insertLog("contact", $contact_id, $ret["contact_name"], "c", $fields); 
    376391        } 
  • trunk/centreon/www/include/configuration/configObject/contactgroup/DB-Func.php

    r6665 r6697  
    121121                                        $maxId =& $DBRESULT->fetchRow(); 
    122122                                         
    123                                         if (isset($maxId["MAX(cg_id)"])) { 
    124                                                 $oreon->CentreonLogAction->insertLog("contactgroup", $maxId["MAX(cg_id)"], $cg_name, "a", $fields); 
     123                                        if (isset($maxId["MAX(cg_id)"])) {                                               
    125124                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT `cgcr`.`contact_contact_id` FROM `contactgroup_contact_relation` `cgcr` WHERE `cgcr`.`contactgroup_cg_id` = '".$key."'"); 
    126125                                                if (PEAR::isError($DBRESULT)) 
    127126                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     127                                                $fields["cg_contacts"] = ""; 
    128128                                                while($cct =& $DBRESULT->fetchRow())    { 
    129129                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO `contactgroup_contact_relation` VALUES ('', '".$cct["contact_contact_id"]."', '".$maxId["MAX(cg_id)"]."')"); 
    130130                                                        if (PEAR::isError($DBRESULT2)) 
    131131                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     132                                                        $fields["cg_contacts"] .= $cct["contact_contact_id"] . ","; 
    132133                                                } 
     134                                                $fields["cg_contacts"] = trim($fields["cg_contacts"], ","); 
     135                                                $oreon->CentreonLogAction->insertLog("contactgroup", $maxId["MAX(cg_id)"], $cg_name, "a", $fields); 
    133136                                        } 
    134137                                } 
     
    163166                $fields["cg_comment"] = htmlentities($ret["cg_comment"], ENT_QUOTES); 
    164167                $fields["cg_activate"] = $ret["cg_activate"]["cg_activate"]; 
     168                $fields["cg_contacts"] = implode(",", $ret["cg_contacts"]); 
    165169                $oreon->CentreonLogAction->insertLog("contactgroup", $cg_id["MAX(cg_id)"], htmlentities($ret["cg_name"], ENT_QUOTES), "a", $fields); 
    166170                return ($cg_id["MAX(cg_id)"]); 
     
    193197                $fields["cg_comment"] = htmlentities($ret["cg_comment"], ENT_QUOTES); 
    194198                $fields["cg_activate"] = $ret["cg_activate"]["cg_activate"]; 
     199                $fields["cg_contacts"] = implode(",", $ret["cg_contacts"]); 
    195200                $oreon->CentreonLogAction->insertLog("contactgroup", $cg_id, htmlentities($ret["cg_name"], ENT_QUOTES), "c", $fields); 
    196201        } 
  • trunk/centreon/www/include/configuration/configObject/escalation/DB-Func.php

    r6646 r6697  
    4040                 
    4141        function deleteEscalationInDB ($escalations = array())  { 
    42                 global $pearDB; 
     42                global $pearDB, $oreon; 
    4343                foreach($escalations as $key=>$value)   { 
     44                        $DBRESULT2 =& $pearDB->query("SELECT esc_name FROM `escalation` WHERE `esc_id` = '".$key."' LIMIT 1"); 
     45                        if (PEAR::isError($DBRESULT2)) 
     46                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     47                        $row = $DBRESULT2->fetchRow(); 
     48                         
    4449                        $DBRESULT =& $pearDB->query("DELETE FROM escalation WHERE esc_id = '".$key."'"); 
    4550                        if (PEAR::isError($DBRESULT)) 
    4651                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     52                        $oreon->CentreonLogAction->insertLog("escalation", $key, $row['esc_name'], "d"); 
    4753                } 
    4854        } 
     
    5056        function multipleEscalationInDB ($escalations = array(), $nbrDup = array())     { 
    5157                foreach($escalations as $key=>$value)   { 
    52                         global $pearDB; 
     58                        global $pearDB, $oreon; 
    5359                        $DBRESULT =& $pearDB->query("SELECT * FROM escalation WHERE esc_id = '".$key."' LIMIT 1"); 
    5460                        if (PEAR::isError($DBRESULT)) 
     
    6167                                        $key2 == "esc_name" ? ($esc_name = $value2 = $value2." ".$i) : null; 
    6268                                        $val ? $val .= ($value2!=NULL?(", '".$value2."'"):", NULL") : $val .= ($value2!=NULL?("'".$value2."'"):"NULL"); 
     69                                        if ($key2 != "esc_id") 
     70                                                $fields[$key2] = $value2; 
     71                                        $fields["esc_name"] = $esc_name; 
    6372                                } 
    6473                                if (testExistence($esc_name))   { 
     
    7584                                                if (PEAR::isError($DBRESULT)) 
    7685                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     86                                                $fields["esc_cgs"] = ""; 
    7787                                                while($cg =& $DBRESULT->fetchRow())     { 
    7888                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO escalation_contactgroup_relation VALUES ('', '".$maxId["MAX(esc_id)"]."', '".$cg["contactgroup_cg_id"]."')"); 
    7989                                                        if (PEAR::isError($DBRESULT2)) 
    8090                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
    81                                                 } 
     91                                                        $fields["esc_cgs"] .= $cg["contactgroup_cg_id"] . ","; 
     92                                                } 
     93                                                $fields["esc_cgs"] = trim($fields["esc_cgs"], ","); 
    8294                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT host_host_id FROM escalation_host_relation WHERE escalation_esc_id = '".$key."'"); 
    8395                                                if (PEAR::isError($DBRESULT)) 
    8496                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     97                                                $fields["esc_hosts"] = ""; 
    8598                                                while($host =& $DBRESULT->fetchRow())   { 
    8699                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO escalation_host_relation VALUES ('', '".$maxId["MAX(esc_id)"]."', '".$host["host_host_id"]."')"); 
    87100                                                        if (PEAR::isError($DBRESULT2)) 
    88101                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
    89                                                 } 
     102                                                        $fields["esc_hosts"] .= $host["host_host_id"] . ","; 
     103                                                } 
     104                                                $fields["esc_hosts"] = trim($fields["esc_hosts"], ","); 
    90105                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT hostgroup_hg_id FROM escalation_hostgroup_relation WHERE escalation_esc_id = '".$key."'"); 
    91106                                                if (PEAR::isError($DBRESULT)) 
    92107                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     108                                                $fields["esc_hgs"] = ""; 
    93109                                                while($hg =& $DBRESULT->fetchRow())     { 
    94110                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO escalation_hostgroup_relation VALUES ('', '".$maxId["MAX(esc_id)"]."', '".$hg["hostgroup_hg_id"]."')"); 
    95111                                                        if (PEAR::isError($DBRESULT2)) 
    96112                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
    97                                                 } 
     113                                                        $fields["esc_hgs"] .= $hg["hostgroup_hg_id"] . ","; 
     114                                                } 
     115                                                $fields["esc_hgs"] = trim($fields["esc_hgs"], ","); 
    98116                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT servicegroup_sg_id FROM escalation_servicegroup_relation WHERE escalation_esc_id = '".$key."'"); 
    99117                                                if (PEAR::isError($DBRESULT)) 
    100118                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     119                                                $fields["esc_sgs"] = ""; 
    101120                                                while($sg =& $DBRESULT->fetchRow())     { 
    102121                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO escalation_servicegroup_relation VALUES ('', '".$maxId["MAX(esc_id)"]."', '".$sg["servicegroup_sg_id"]."')"); 
    103122                                                        if (PEAR::isError($DBRESULT2)) 
    104123                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
    105                                                 } 
     124                                                        $fields["esc_sgs"] .= $sg["servicegroup_sg_id"] . ","; 
     125                                                } 
     126                                                $fields["esc_sgs"] = trim($fields["esc_sgs"], ","); 
    106127                                                $DBRESULT =& $pearDB->query("SELECT * FROM escalation_service_relation WHERE escalation_esc_id = '".$key."'"); 
    107128                                                if (PEAR::isError($DBRESULT)) 
    108129                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     130                                                $fields["esc_hServices"] = ""; 
    109131                                                while($sv =& $DBRESULT->fetchRow())     { 
    110132                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO escalation_service_relation VALUES ('', '".$maxId["MAX(esc_id)"]."', '".$sv["service_service_id"]."', '".$sv["host_host_id"]."')"); 
    111133                                                        if (PEAR::isError($DBRESULT2)) 
    112134                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
    113                                                 } 
     135                                                        $fields["esc_hServices"] .= $sv["service_service_id"] . ","; 
     136                                                } 
     137                                                $fields["esc_hServices"] = trim($fields["esc_hServices"], ","); 
    114138                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT meta_service_meta_id FROM escalation_meta_service_relation WHERE escalation_esc_id = '".$key."'"); 
    115139                                                if (PEAR::isError($DBRESULT)) 
    116140                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     141                                                $fields["esc_metas"] = ""; 
    117142                                                while($sv =& $DBRESULT->fetchRow())     { 
    118143                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO escalation_meta_service_relation VALUES ('', '".$maxId["MAX(esc_id)"]."', '".$sv["meta_service_meta_id"]."')"); 
    119144                                                        if (PEAR::isError($DBRESULT2)) 
    120145                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
    121                                                 } 
     146                                                        $fields["esc_metas"] .= $sv["meta_service_meta_id"]  . ","; 
     147                                                } 
     148                                                $fields["esc_metas"] = trim($fields["esc_metas"], ","); 
     149                                                $oreon->CentreonLogAction->insertLog("escalation", $maxId["MAX(esc_id)"], $esc_name, "a"); 
    122150                                        } 
    123151                                } 
     
    150178        function insertEscalation()     { 
    151179                global $form; 
    152                 global $pearDB; 
     180                global $pearDB, $oreon; 
    153181                $ret = array(); 
    154182                $ret = $form->getSubmitValues(); 
     
    173201                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
    174202                $esc_id = $DBRESULT->fetchRow(); 
     203                $fields["esc_name"] = htmlentities($ret["esc_name"], ENT_QUOTES); 
     204                $fields["esc_alias"] = htmlentities($ret["esc_alias"], ENT_QUOTES); 
     205                $fields["first_notification"] = htmlentities($ret["first_notification"], ENT_QUOTES); 
     206                $fields["last_notification"] = htmlentities($ret["last_notification"], ENT_QUOTES); 
     207                $fields["notification_interval"] = htmlentities($ret["notification_interval"], ENT_QUOTES); 
     208                $fields["escalation_period"] = htmlentities($ret["escalation_period"], ENT_QUOTES); 
     209                $fields["escalation_options1"] = implode(",", array_keys($ret["escalation_options1"])); 
     210                $fields["escalation_options2"] = implode(",", array_keys($ret["escalation_options2"])); 
     211                $fields["esc_comment"] = htmlentities($ret["esc_comment"], ENT_QUOTES); 
     212                $fields["esc_cgs"] = ""; 
     213                if (isset($ret["esc_cgs"])) 
     214                        $fields["esc_cgs"] = implode(",", $ret["esc_cgs"]); 
     215                $fields["esc_hosts"] = ""; 
     216                if (isset($ret["esc_hosts"])) 
     217                        $fields["esc_hosts"] = implode(",", $ret["esc_hosts"]); 
     218                $fields["esc_hgs"] = ""; 
     219                if (isset($ret["esc_hgs"])) 
     220                        $fields["esc_hgs"] = implode(",", $ret["esc_hgs"]); 
     221                $fields["esc_sgs"] = ""; 
     222                if (isset($ret["esc_sgs"])) 
     223                        $fields["esc_sgs"] = implode(",", $ret["esc_sgs"]); 
     224                $fields["esc_hServices"] = ""; 
     225                if (isset($ret["esc_hServices"])) 
     226                        $fields["esc_hServices"] = implode(",", $ret["esc_hServices"]); 
     227                $fields["esc_metas"] = ""; 
     228                if (isset($ret["esc_metas"])) 
     229                        $fields["esc_metas"] = implode(",", $ret["esc_metas"]); 
     230                $oreon->CentreonLogAction->insertLog("escalation", $esc_id["MAX(esc_id)"], htmlentities($ret["esc_name"], ENT_QUOTES), "a", $fields); 
    175231                return ($esc_id["MAX(esc_id)"]); 
    176232        } 
     
    179235                if (!$esc_id) exit(); 
    180236                global $form; 
    181                 global $pearDB; 
     237                global $pearDB, $oreon; 
    182238                $ret = array(); 
    183239                $ret = $form->getSubmitValues(); 
     
    205261                if (PEAR::isError($DBRESULT)) 
    206262                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     263                $fields["esc_name"] = htmlentities($ret["esc_name"], ENT_QUOTES); 
     264                $fields["esc_alias"] = htmlentities($ret["esc_alias"], ENT_QUOTES); 
     265                $fields["first_notification"] = htmlentities($ret["first_notification"], ENT_QUOTES); 
     266                $fields["last_notification"] = htmlentities($ret["last_notification"], ENT_QUOTES); 
     267                $fields["notification_interval"] = htmlentities($ret["notification_interval"], ENT_QUOTES); 
     268                $fields["escalation_period"] = htmlentities($ret["escalation_period"], ENT_QUOTES); 
     269                $fields["escalation_options1"] = implode(",", array_keys($ret["escalation_options1"])); 
     270                $fields["escalation_options2"] = implode(",", array_keys($ret["escalation_options2"])); 
     271                $fields["esc_comment"] = htmlentities($ret["esc_comment"], ENT_QUOTES); 
     272                $fields["esc_cgs"] = ""; 
     273                if (isset($ret["esc_cgs"])) 
     274                        $fields["esc_cgs"] = implode(",", $ret["esc_cgs"]); 
     275                $fields["esc_hosts"] = ""; 
     276                if (isset($ret["esc_hosts"])) 
     277                        $fields["esc_hosts"] = implode(",", $ret["esc_hosts"]); 
     278                $fields["esc_hgs"] = ""; 
     279                if (isset($ret["esc_hgs"])) 
     280                        $fields["esc_hgs"] = implode(",", $ret["esc_hgs"]); 
     281                $fields["esc_sgs"] = ""; 
     282                if (isset($ret["esc_sgs"])) 
     283                        $fields["esc_sgs"] = implode(",", $ret["esc_sgs"]); 
     284                $fields["esc_hServices"] = ""; 
     285                if (isset($ret["esc_hServices"])) 
     286                        $fields["esc_hServices"] = implode(",", $ret["esc_hServices"]); 
     287                $fields["esc_metas"] = ""; 
     288                if (isset($ret["esc_metas"])) 
     289                        $fields["esc_metas"] = implode(",", $ret["esc_metas"]); 
     290                $oreon->CentreonLogAction->insertLog("escalation", $esc_id["MAX(esc_id)"], htmlentities($ret["esc_name"], ENT_QUOTES), "c", $fields); 
    207291        } 
    208292         
  • trunk/centreon/www/include/configuration/configObject/host_dependency/DB-Func.php

    r6646 r6697  
    5757 
    5858        function deleteHostDependencyInDB ($dependencies = array())     { 
    59                 global $pearDB; 
     59                global $pearDB, $oreon; 
    6060                foreach($dependencies as $key=>$value)  { 
     61                        $DBRESULT2 =& $pearDB->query("SELECT dep_name FROM `dependency` WHERE `dep_id` = '".$key."' LIMIT 1"); 
     62                        if (PEAR::isError($DBRESULT2)) 
     63                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     64                        $row = $DBRESULT2->fetchRow(); 
     65                         
    6166                        $DBRESULT =& $pearDB->query("DELETE FROM dependency WHERE dep_id = '".$key."'"); 
    6267                        if (PEAR::isError($DBRESULT)) 
    6368                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     69                        $oreon->CentreonLogAction->insertLog("dependency", $key, $row['dep_name'], "d"); 
    6470                } 
    6571        } 
     
    6773        function multipleHostDependencyInDB ($dependencies = array(), $nbrDup = array())        { 
    6874                foreach($dependencies as $key=>$value)  { 
    69                         global $pearDB; 
     75                        global $pearDB, $oreon; 
    7076                        $DBRESULT =& $pearDB->query("SELECT * FROM dependency WHERE dep_id = '".$key."' LIMIT 1"); 
    7177                        if (PEAR::isError($DBRESULT)) 
     
    7884                                        $key2 == "dep_name" ? ($dep_name = $value2 = $value2."_".$i) : null; 
    7985                                        $val ? $val .= ($value2!=NULL?(", '".$value2."'"):", NULL") : $val .= ($value2!=NULL?("'".$value2."'"):"NULL"); 
     86                                        if ($key2 != "dep_id") 
     87                                                $fields[$key2] = $value2; 
     88                                        $fields["dep_name"] = $dep_name; 
    8089                                } 
    8190                                if (testHostDependencyExistence($dep_name))     { 
     
    92101                                                if (PEAR::isError($DBRESULT)) 
    93102                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     103                                                $fields["dep_hostParents"] = ""; 
    94104                                                while($host =& $DBRESULT->fetchRow())   { 
    95105                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO dependency_hostParent_relation VALUES ('', '".$maxId["MAX(dep_id)"]."', '".$host["host_host_id"]."')"); 
    96106                                                        if (PEAR::isError($DBRESULT2)) 
    97107                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     108                                                        $fields["dep_hostParents"] .= $host["host_host_id"] . ","; 
    98109                                                } 
     110                                                $fields["dep_hostParents"] = trim($fields["dep_hostParents"], ","); 
    99111                                                $DBRESULT->free(); 
    100112                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT host_host_id FROM dependency_hostChild_relation WHERE dependency_dep_id = '".$key."'"); 
    101113                                                if (PEAR::isError($DBRESULT)) 
    102114                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     115                                                $fields["dep_hostChilds"] = ""; 
    103116                                                while($host =& $DBRESULT->fetchRow())   { 
    104117                                                        $DBRESULT2 =& $pearDB->query("INSERT INTO dependency_hostChild_relation VALUES ('', '".$maxId["MAX(dep_id)"]."', '".$host["host_host_id"]."')"); 
    105118                                                        if (PEAR::isError($DBRESULT2)) 
    106119                                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     120                                                        $fields["dep_hostChilds"] .= $host["host_host_id"] . ","; 
    107121                                                } 
     122                                                $fields["dep_hostChilds"] = trim($fields["dep_hostChilds"], ","); 
    108123                                                $DBRESULT->free(); 
     124                                                $oreon->CentreonLogAction->insertLog("dependency", $maxId["MAX(dep_id)"], $dep_name, "a", $fields); 
    109125                                        } 
    110126                                } 
     
    129145        function insertHostDependency($ret = array())   { 
    130146                global $form; 
    131                 global $pearDB; 
     147                global $pearDB, $oreon; 
    132148                if (!count($ret)) 
    133149                        $ret = $form->getSubmitValues(); 
     
    149165                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
    150166                $dep_id = $DBRESULT->fetchRow(); 
     167                $fields["dep_name"] = htmlentities($ret["dep_name"], ENT_QUOTES); 
     168                $fields["dep_description"] = htmlentities($ret["dep_description"], ENT_QUOTES); 
     169                $fields["inherits_parent"] = $ret["inherits_parent"]["inherits_parent"]; 
     170                $fields["execution_failure_criteria"] = implode(",", array_keys($ret["execution_failure_criteria"])); 
     171                $fields["notification_failure_criteria"] = implode(",", array_keys($ret["notification_failure_criteria"])); 
     172                $fields["dep_comment"] = htmlentities($ret["dep_comment"], ENT_QUOTES); 
     173                $fields["dep_hostParents"] = ""; 
     174                if (isset($ret["dep_hostParents"])) 
     175                        $fields["dep_hostParents"] = implode(",", $ret["dep_hostParents"]); 
     176                $fields["dep_hostChilds"] = ""; 
     177                if (isset($ret["dep_hostChilds"])) 
     178                        $fields["dep_hostChilds"] = implode(",", $ret["dep_hostChilds"]); 
     179                $oreon->CentreonLogAction->insertLog("dependency", $dep_id["MAX(dep_id)"], htmlentities($ret["dep_name"], ENT_QUOTES), "a", $fields); 
    151180                return ($dep_id["MAX(dep_id)"]); 
    152181        } 
     
    155184                if (!$dep_id) exit(); 
    156185                global $form; 
    157                 global $pearDB; 
     186                global $pearDB, $oreon; 
    158187                $ret = array(); 
    159188                $ret = $form->getSubmitValues(); 
     
    175204                if (PEAR::isError($DBRESULT)) 
    176205                        print "DB