示例#1
0
 /**
  * Update TAG information in glpi_plugin_ocsinventoryng_ocslinks table
  *
  * @param $line_links array : data from glpi_plugin_ocsinventoryng_ocslinks table
  * @param $line_ocs array : data from ocs tables
  *
  * @return string : current tag of computer on update
  **/
 static function updateTag($line_links, $line_ocs)
 {
     global $DB, $PluginOcsinventoryngDBocs;
     $query_ocs = "SELECT `accountinfo`.`TAG` AS TAG\n                    FROM `hardware`\n                    INNER JOIN `accountinfo`\n                        ON (`hardware`.`ID` = `accountinfo`.`HARDWARE_ID`)\n                    WHERE `hardware`.`ID` = '" . $line_links["ocsid"] . "'";
     $result_ocs = $PluginOcsinventoryngDBocs->query($query_ocs);
     if ($PluginOcsinventoryngDBocs->numrows($result_ocs) == 1) {
         $data_ocs = Toolbox::addslashes_deep($PluginOcsinventoryngDBocs->fetch_array($result_ocs));
         $query = "UPDATE `glpi_plugin_ocsinventoryng_ocslinks`\n                   SET `tag` = '" . $data_ocs["TAG"] . "'\n                   WHERE `id` = '" . $line_links["id"] . "'";
         if ($DB->query($query)) {
             $changes[0] = '0';
             $changes[1] = $line_links["tag"];
             $changes[2] = $data_ocs["TAG"];
             PluginOcsinventoryngOcslink::history($line_links["computers_id"], $changes, PluginOcsinventoryngOcslink::HISTORY_OCS_TAGCHANGED);
             return $data_ocs["TAG"];
         }
     }
 }
示例#2
0
 /**
  * Update TAG information in glpi_plugin_ocsinventoryng_ocslinks table
  *
  * @param $line_links array : data from glpi_plugin_ocsinventoryng_ocslinks table
  * @param $line_ocs array : data from ocs tables
  *
  * @return string : current tag of computer on update
  **/
 static function updateTag($line_links, $line_ocs)
 {
     global $DB;
     $ocsClient = self::getDBocs($line_links["plugin_ocsinventoryng_ocsservers_id"]);
     $options = array();
     $computer = $ocsClient->getComputer($line_links["ocsid"], $options);
     if ($computer) {
         $data_ocs = Toolbox::addslashes_deep($computer["META"]);
         if (isset($data_ocs["TAG"]) && isset($line_links["tag"]) && $data_ocs["TAG"] != $line_links["tag"]) {
             $query = "UPDATE `glpi_plugin_ocsinventoryng_ocslinks`\n                      SET `tag` = '" . $data_ocs["TAG"] . "'\n                      WHERE `id` = '" . $line_links["id"] . "'";
             if ($DB->query($query)) {
                 $changes[0] = '0';
                 $changes[1] = $line_links["tag"];
                 $changes[2] = $data_ocs["TAG"];
                 PluginOcsinventoryngOcslink::history($line_links["computers_id"], $changes, PluginOcsinventoryngOcslink::HISTORY_OCS_TAGCHANGED);
                 return $data_ocs["TAG"];
             }
         }
     }
 }