grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* SoftwareVersion Class
**/
class SoftwareVersion extends CommonDBChild {
// From CommonDBTM
public $dohistory = true;
// From CommonDBChild
static public $itemtype = 'Software';
static public $items_id = 'softwares_id';
static function getTypeName($nb=0) {
return _n('Version', 'Versions', $nb);
}
function cleanDBonPurge() {
global $DB;
$csv = new Computer_SoftwareVersion();
$csv->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
}
function defineTabs($options=array()) {
$ong = array();
$this->addDefaultFormTab($ong);
$this->addStandardTab('Computer_SoftwareVersion',$ong, $options);
$this->addStandardTab('Log',$ong, $options);
return $ong;
}
/**
* @since version 0.84
*
* @see CommonDBTM::getPreAdditionalInfosForName
**/
function getPreAdditionalInfosForName() {
$soft = new Software();
if ($soft->getFromDB($this->fields['softwares_id'])) {
return $soft->getName();
}
return '';
}
/**
* Print the Software / version form
*
* @param $ID integer Id of the version or the template to print
* @param $options array of possible options:
* - 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;
if ($ID > 0) {
$this->check($ID, READ);
$softwares_id = $this->fields['softwares_id'];
} else {
$softwares_id = $options['softwares_id'];
$this->check(-1, CREATE, $options);
}
$this->showFormHeader($options);
echo "
";
}
$query = "SELECT `glpi_softwareversions`.*,
`glpi_states`.`name` AS sname
FROM `glpi_softwareversions`
LEFT JOIN `glpi_states` ON (`glpi_states`.`id` = `glpi_softwareversions`.`states_id`)
WHERE `softwares_id` = '$softwares_id'
ORDER BY `name`";
Session::initNavigateListItems('SoftwareVersion',
//TRANS : %1$s is the itemtype name,
// %2$s is the name of the item (used for headings of a list)
sprintf(__('%1$s = %2$s'), Software::getTypeName(1),
$soft->getName()));
if ($result = $DB->query($query)) {
if ($DB->numrows($result)) {
echo "