/** * @param $computers_id * @param $date * @param $computer_updates * @return array */ static function addInfocomsForComputer($computers_id, $date, $computer_updates) { global $DB; $infocom = new Infocom(); $use_date = substr($date, 0, 10); if ($infocom->getFromDBByQuery("WHERE `items_id` = {$computers_id} AND `itemtype` = 'Computer'")) { if (empty($infocom->fields['use_date']) || $infocom->fields['use_date'] == 'NULL') { //add use_date $infocom->update(array('id' => $infocom->fields['id'], 'use_date' => $use_date)); } } else { //add infocom $infocom->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'use_date' => $use_date)); } //Add lock $ocslink = new PluginOcsinventoryngOcslink(); if ($ocslink->getFromDBforComputer($computers_id)) { $cfg_ocs = PluginOcsinventoryngOcsServer::getConfig($ocslink->fields["plugin_ocsinventoryng_ocsservers_id"]); if ($cfg_ocs["use_locks"]) { $computer_updates[] = "use_date"; $query = "UPDATE `glpi_plugin_ocsinventoryng_ocslinks`\n SET `computer_update` = '" . addslashes(exportArrayToDB($computer_updates)) . "'\n WHERE `computers_id` = '{$computers_id}'"; $DB->query($query); } } return $computer_updates; }