/** * Update a software on a computer - check if not already installed * * @param $computers_id ID of the computer where to install a software * @param $softwareversions_id ID of the version to install * @param $installdate * @param int $dohistory * * @return \nothing */ static function updateSoftwareVersion($computers_id, $softwareversions_id, $installdate, $dohistory = 1) { global $DB; if (!empty($softwareversions_id) && $softwareversions_id > 0) { $query_exists = "SELECT `id`\n FROM `glpi_computers_softwareversions`\n WHERE (`computers_id` = '{$computers_id}'\n AND `softwareversions_id` = '{$softwareversions_id}')"; $result = $DB->query($query_exists); if ($DB->numrows($result) > 0) { $data = $DB->fetch_array($result); $tmp = new Computer_SoftwareVersion(); $input = array('id' => $data['id'], '_no_history' => !$dohistory, 'date_install' => $installdate); return $tmp->update($input); } } return 0; }