Skip to content

Commit

Permalink
fix add status column in software licence
Browse files Browse the repository at this point in the history
  • Loading branch information
Rom1-B authored and trasher committed Sep 9, 2021
1 parent 185ccc7 commit dfe5f08
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions inc/softwarelicense.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1048,14 +1048,15 @@ static function showForSoftware(Software $software) {
}

$columns = ['name' => __('Name'),
'entity' => Entity::getTypeName(1),
'serial' => __('Serial number'),
'number' => _x('quantity', 'Number'),
'_affected' => __('Affected items'),
'typename' => _n('Type', 'Types', 1),
'buyname' => __('Purchase version'),
'usename' => __('Version in use'),
'expire' => __('Expiration')];
'entity' => Entity::getTypeName(1),
'serial' => __('Serial number'),
'number' => _x('quantity', 'Number'),
'_affected' => __('Affected items'),
'typename' => _n('Type', 'Types', 1),
'buyname' => __('Purchase version'),
'usename' => __('Version in use'),
'expire' => __('Expiration'),
'statename' => __('Status')];
if (!$software->isRecursive()) {
unset($columns['entity']);
}
Expand Down Expand Up @@ -1110,7 +1111,8 @@ static function showForSoftware(Software $software) {
'buyvers.name AS buyname',
'usevers.name AS usename',
'glpi_entities.completename AS entity',
'glpi_softwarelicensetypes.name AS typename'
'glpi_softwarelicensetypes.name AS typename',
'glpi_states.name AS statename'
],
'FROM' => 'glpi_softwarelicenses',
'LEFT JOIN' => [
Expand All @@ -1137,6 +1139,12 @@ static function showForSoftware(Software $software) {
'glpi_softwarelicensetypes' => 'id',
'glpi_softwarelicenses' => 'softwarelicensetypes_id'
]
],
'glpi_states' => [
'ON' => [
'glpi_softwarelicenses' => 'states_id',
'glpi_states' => 'id'
]
]
],
'WHERE' => [
Expand Down Expand Up @@ -1229,6 +1237,7 @@ static function showForSoftware(Software $software) {
echo "<td>".$data['buyname']."</td>";
echo "<td>".$data['usename']."</td>";
echo "<td class='center'>".Html::convDate($data['expire'])."</td>";
echo "<td>".$data['statename']."</td>";
echo "</tr>";

if ($data['number'] < 0) {
Expand All @@ -1248,7 +1257,7 @@ static function showForSoftware(Software $software) {
echo "<td class='numeric'>".(($tot > 0)?$tot."":__('Unlimited')).
"</td>";
$color = ($software->fields['is_valid']?'green':'red');
echo "<td class='numeric $color'>".$tot_assoc."</td><td></td><td></td><td></td><td></td>";
echo "<td class='numeric $color'>".$tot_assoc."</td><td></td><td></td><td></td><td></td><td></td>";
echo "</tr>";
echo "</table>\n";

Expand Down

0 comments on commit dfe5f08

Please sign in to comment.