/**
* Print the Software / version form
*
* @param $ID Integer : Id of the version or the template to print
* @param $options array
* - target form target
* - softwares_id ID of the software for add process
*
* @return true if displayed false if item not found or not right to display
*
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
$softwares_id = -1;
if (isset($options['softwares_id'])) {
$softwares_id = $options['softwares_id'];
}
if (!haveRight("software", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
$soft = new Software();
$soft->getFromDB($softwares_id);
// Create item
$input = array('entities_id' => $soft->getEntityID(), 'is_recursive' => $soft->isRecursive());
$this->check(-1, 'w', $input);
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'><td>" . $LANG['help'][31] . " :</td>";
echo "<td>";
if ($ID > 0) {
$softwares_id = $this->fields["softwares_id"];
} else {
echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
}
echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
echo "</td>";
echo "<td rowspan='4' class='middle'>" . $LANG['common'][25] . " :</td>";
echo "<td class='center middle' rowspan='4'>";
echo "<textarea cols='45' rows='3' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . " :</td>";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][5] . " :</td><td>";
Dropdown::show('OperatingSystem', array('value' => $this->fields["operatingsystems_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . $LANG['state'][0] . " :</td><td>";
Dropdown::show('State', array('value' => $this->fields["states_id"]));
echo "</td></tr>\n";
// Only count softwareversions_id_buy (don't care of softwareversions_id_use if no installation)
if (SoftwareLicense::countForVersion($ID) > 0 || Computer_SoftwareVersion::countForVersion($ID) > 0) {
$options['candel'] = false;
}
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}