/**
  * Print the computer form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target for the Form
  *     - withtemplate template or basic computer
  *
  *@return Nothing (display)
  *
  **/
 function showForm($ID, $options = array())
 {
     global $LANG, $CFG_GLPI, $DB;
     if (!haveRight("computer", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     if (isset($options['withtemplate']) && $options['withtemplate'] == 2) {
         $template = "newcomp";
         $datestring = $LANG['computers'][14] . " : ";
         $date = convDateTime($_SESSION["glpi_currenttime"]);
     } else {
         if (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
             $template = "newtemplate";
             $datestring = $LANG['computers'][14] . " : ";
             $date = convDateTime($_SESSION["glpi_currenttime"]);
         } else {
             $datestring = $LANG['common'][26] . ": ";
             $date = convDateTime($this->fields["date_mod"]);
             $template = false;
         }
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . ($template ? "*" : "") . "&nbsp;:</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
     autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . $LANG['state'][0] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('State', array('value' => $this->fields["states_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][15] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . $LANG['common'][17] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('ComputerType', array('value' => $this->fields["computertypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][10] . "&nbsp;: </td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . $LANG['common'][5] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][21] . "&nbsp;: </td>";
     echo "<td >";
     autocompletionTextField($this, 'contact_num');
     echo "</td>";
     echo "<td>" . $LANG['common'][22] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('ComputerModel', array('value' => $this->fields["computermodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][18] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, 'contact');
     echo "</td>";
     echo "<td>" . $LANG['common'][19] . "&nbsp;:</td>";
     echo "<td >";
     autocompletionTextField($this, 'serial');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][34] . "&nbsp;: </td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . $LANG['common'][20] . ($template ? "*" : "") . "&nbsp;:</td>";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
     autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][35] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . $LANG['setup'][88] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('Network', array('value' => $this->fields["networks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['setup'][89] . "&nbsp;:</td>";
     echo "<td >";
     Dropdown::show('Domain', array('value' => $this->fields["domains_id"]));
     echo "</td>";
     echo "<td rowspan='8'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td rowspan='8' class='middle'>";
     echo "<textarea cols='45' rows='11' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][9] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('OperatingSystem', array('value' => $this->fields["operatingsystems_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][53] . "&nbsp;:</td>";
     echo "<td >";
     Dropdown::show('OperatingSystemServicePack', array('value' => $this->fields["operatingsystemservicepacks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][52] . "&nbsp;:</td>";
     echo "<td >";
     Dropdown::show('OperatingSystemVersion', array('value' => $this->fields["operatingsystemversions_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][11] . "&nbsp;:</td>";
     echo "<td >";
     autocompletionTextField($this, 'os_licenseid');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][10] . "&nbsp;:</td>";
     echo "<td >";
     autocompletionTextField($this, 'os_license_number');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][58] . "&nbsp;:</td>";
     echo "<td >";
     autocompletionTextField($this, 'uuid');
     echo "</td></tr>\n";
     // Get OCS Datas :
     $dataocs = array();
     if (!empty($ID) && $this->fields["is_ocs_import"] && haveRight("view_ocsng", "r")) {
         $query = "SELECT *\n                   FROM `glpi_ocslinks`\n                   WHERE `computers_id` = '{$ID}'";
         $result = $DB->query($query);
         if ($DB->numrows($result) == 1) {
             $dataocs = $DB->fetch_array($result);
         }
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2' class='center'>" . $datestring . $date;
     if (!$template && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>(" . $LANG['common'][13] . "&nbsp;: " . $this->fields['template_name'] . ")</span>";
     }
     if (!empty($ID) && $this->fields["is_ocs_import"] && haveRight("view_ocsng", "r") && count($dataocs)) {
         echo "<br>";
         echo $LANG['ocsng'][14] . "&nbsp;: " . convDateTime($dataocs["last_ocs_update"]);
         echo "<br>";
         echo $LANG['ocsng'][13] . "&nbsp;: " . convDateTime($dataocs["last_update"]);
         echo "<br>";
         if (haveRight("ocsng", "r")) {
             echo $LANG['common'][52] . " <a href='" . $CFG_GLPI["root_doc"] . "/front/ocsserver.form.php?id=" . OcsServer::getByMachineID($ID) . "'>" . OcsServer::getServerNameByID($ID) . "</a>";
             $query = "SELECT `ocs_agent_version`, `ocsid`\n                      FROM `glpi_ocslinks`\n                      WHERE `computers_id` = '{$ID}'";
             $result_agent_version = $DB->query($query);
             $data_version = $DB->fetch_array($result_agent_version);
             $ocs_config = OcsServer::getConfig(OcsServer::getByMachineID($ID));
             //If have write right on OCS and ocsreports url is not empty in OCS config
             if (haveRight("ocsng", "w") && $ocs_config["ocs_url"] != '') {
                 echo ", " . OcsServer::getComputerLinkToOcsConsole(OcsServer::getByMachineID($ID), $data_version["ocsid"], $LANG['ocsng'][57]);
             }
             if ($data_version["ocs_agent_version"] != NULL) {
                 echo " , " . $LANG['ocsng'][49] . "&nbsp;: " . $data_version["ocs_agent_version"];
             }
         } else {
             echo $LANG['common'][52] . " " . OcsServer::getServerNameByID($ID);
         }
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     if (!empty($ID) && $this->fields["is_ocs_import"] && haveRight("view_ocsng", "r") && haveRight("sync_ocsng", "w") && count($dataocs)) {
         echo "<td >" . $LANG['ocsng'][6] . " " . $LANG['Menu'][33] . "&nbsp;:</td>";
         echo "<td >";
         Dropdown::showYesNo("_auto_update_ocs", $dataocs["use_auto_update"]);
         echo "</td>";
     } else {
         echo "<td colspan=2></td>";
     }
     echo "<td>" . $LANG['computers'][51] . "&nbsp;:</td>";
     echo "<td >";
     Dropdown::show('AutoUpdateSystem', array('value' => $this->fields["autoupdatesystems_id"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }