/** * Update lockable fields of an item * * @param $item CommonDBTM object * @return nothing * @internal param int|string $withtemplate integer withtemplate param (default '') */ static function updateComputer(CommonDBTM $item) { global $DB; // Manage changes for OCS if more than 1 element (date_mod) // Need dohistory==1 if dohistory==2 no locking fields $ocslink = new self(); if ($item->fields["is_dynamic"] && $ocslink->getFromDBforComputer($item->getID()) && $item->dohistory == 1 && count($item->updates) > 1 && !isset($item->input["_nolock"])) { $cfg_ocs = PluginOcsinventoryngOcsServer::getConfig($ocslink->fields["plugin_ocsinventoryng_ocsservers_id"]); if ($cfg_ocs["use_locks"]) { PluginOcsinventoryngOcsServer::mergeOcsArray($item->fields["id"], $item->updates, "computer_update"); } } if (isset($item->input["_auto_update_ocs"])) { $query = "UPDATE `glpi_plugin_ocsinventoryng_ocslinks`\n SET `use_auto_update` = '" . $item->input["_auto_update_ocs"] . "'\n WHERE `computers_id` = '" . $item->input["id"] . "'"; $DB->query($query); } }