Skip to content

Commit edcea6c

Browse files
author
Walid
committed
Add number of vulnerabilities as new search option
1 parent 0b07bcc commit edcea6c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

hook.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ function plugin_openvas_getAddSearchOptions($itemtype) {
105105
$sopt[6106]['joinparams'] = [ 'jointype' => 'itemtype_item' ];
106106
$sopt[6106]['massiveaction'] = false;
107107

108+
$sopt[6107]['table'] = 'glpi_plugin_openvas_vulnerabilities_items';
109+
$sopt[6107]['field'] = 'name';
110+
$sopt[6107]['name'] = __('OpenVAS', 'openvas').'-'.
111+
_x('quantity', 'Number of vulnerabilities');
112+
$sopt[6107]['joinparams'] = [ 'jointype' => 'itemtype_item' ];
113+
$sopt[6107]['forcegroupby'] = true;
114+
$sopt[6107]['massiveaction'] = false;
115+
$sopt[6107]['usehaving'] = true;
116+
$sopt[6107]['datatype'] = 'count';
117+
118+
108119
}
109120

110121
return $sopt;

inc/item.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ public static function showForItem(CommonDBTM $item, PluginOpenvasItem $openvas_
269269

270270
Html::closeForm();
271271
}
272-
if ($openvas_item->fields['openvas_host']
273-
&& Session::haveRight('plugin_openvas_vulnerability', READ)) {
272+
if (Session::haveRight('plugin_openvas_vulnerability', READ)) {
274273
PluginOpenvasVulnerability_Item::showForItem($item);
275274
}
276275
}

0 commit comments

Comments
 (0)