SEPM 12.1.5 has the capability to filter on Auto-Protect, but it is limited. When the filter is activated, it selects all with status "Auto-Protect=Off". However, there are more statuses for Auto-Protect that may designate problems: "Auto-Protect=Not installed" or "Auto-Protect=Not reporting".
To see all these statuses, except 'On', the filter can be changed as follows. It replaces the checkbox for the AP filter with a radio button, where you can choose "Auto-Protect=Off" (old/current behaviour) or "Auto-Protect=Not on" (new functionality).
CHANGE 1
Change in file:
<SEPM Home>\Inetpub\Reporting\Inventory\inventory-savefilter.php:
line 115, currently reading:
$valArr["ONOFF"] = "'".$mutil->onoff_to_127_zero($filOnOff)."'";
resulting in:
$valArr["ONOFF"] = "'".$mutil->onoff_to_zero_one($filOnOff)."'";
You may choose any name here for a new function. I chose "onoff_to_zero_one" but you may choose another one. In that case, you have to be consistent to use your function name also in the rest of the changes.
CHANGE 2
Change in file:
<SEPM Home>\Inetpub\Reporting\Inventory\inventory-switcher.php:
line 107, currently reading:
$filOnOff = zero_127_to_onoff($ONOFF);
resulting in:
$filOnOff = zero_one_127_to_onoff($ONOFF);
You may choose any name here for a new function. I chose "zero_one_127_to_onoff" but you may choose another one. In that case, you have to be consistent to use your function name in the rest of the changes.
CHANGE 3
Change in file:
<SEPM Home>\ Inetpub\Reporting\Inventory\inventory-updatefilter.php
line 134, currently reading:
$filOnOff=zero_127_to_onoff($zeile["ONOFF"]);
resulting in:
$filOnOff=zero_one_127_to_onoff($zeile["ONOFF"]);
CHANGE 4
In file:
<SEPM Home>\Inetpub\Reporting\Inventory\inventory-setfilter.php:
replace the check box with a new function to create a radio button in line 328:
function get_on_off() {
global $filOnOff;
return getCheckBoxForInventory($filOnOff, "filOnOff", "TEXT_ONOFF");
}
resulting in:
function get_on_off() {
global $filOnOff;
return getRadioButtonsForInventory("TEXT_AP_FILTER", "filOnOff", 'on', 'not on', 127, "TEXT_AP_FILTER_IS_OFF", "TEXT_AP_FILTER_IS_ANYTHING_BUT_ON", "TEXT_AP_DONT_FILTER", $filOnOff);
}
The new function itself can be added in line 233, after function getCheckBoxForInventory:
function getRadioButtonsForInventory($title, $name, $val1, $val2, $val3, $text1, $text2, $text3, $defVal) {
$returnVal = "";
$title = trim(I18nInventory::translateInventory($title));
$text1 = trim(I18nInventory::translateInventory($text1));
$text2 = trim(I18nInventory::translateInventory($text2));
$text3 = trim(I18nInventory::translateInventory($text3));
$returnVal = $returnVal."<span class=\"Menue\">$title</span><br>\n";
$returnVal = $returnVal."<input type=\"radio\" style=\"border:none;\" onChange=\"javascript:setDirty(true);\" border=\"0\" name=\"$name\" value=\"$val1\"";
if ($defVal == $val1) {$returnVal = $returnVal."checked";}
$returnVal = $returnVal."><span class=\"Menue\">$text1</span><br>\n";
$returnVal = $returnVal."<input type=\"radio\" style=\"border:none;\" onChange=\"javascript:setDirty(true);\" border=\"0\" name=\"$name\" value=\"$val2\"";
if ($defVal == $val2) {$returnVal = $returnVal."checked";}
$returnVal = $returnVal."><span class=\"Menue\">$text2</span><br>\n";
$returnVal = $returnVal."<input type=\"radio\" style=\"border:none;\" onChange=\"javascript:setDirty(true);\" border=\"0\" name=\"$name\" value=\"$val3\"";
if ($defVal == $val3) {$returnVal = $returnVal."checked";}
$returnVal = $returnVal."><span class=\"Menue\">$text3</span>\n";
return $returnVal;
}
CHANGE 5
In file
<SEPM Home>\Inetpub\Reporting\Inventory\inventorylist.php:
line 453, currently reading:
if(isset($filOnOff) && $filOnOff == "on"){
resulting in:
if(isset($filOnOff) && ($filOnOff == "on" or $filOnOff == "not on")){
CHANGE 6
In file
<SEPM Home>\Inetpub\Reporting\Res\en\I18nInventory.bundle:
after line 755, currently reading:
TEXT_ONOFF=Auto-Protect off
add 4 translations, resulting in:
TEXT_ONOFF=Auto-Protect off
TEXT_AP_FILTER=Auto-Protect status:
TEXT_AP_FILTER_IS_OFF=Filter on AP is OFF
TEXT_AP_FILTER_IS_ANYTHING_BUT_ON=Filter on AP is anything but ON
TEXT_AP_DONT_FILTER=Don't filter
If you are using other languages than ‘en’, you may want to also change the I18nInventory.bundle for your language.
NB: Do note that the translations are cached. To flush the cash, delete the file "inventory_en.sab" in directory <SEPM Home>\Inetpub\Reporting\Temp.
CHANGE 7
In file
<SEPM Home>\Php\Include\Inventory\inventory-sqlfilter.php:
replace the checkbox with a radio button in line 133, currently reading:
$queryOnOff=optimize_checkbox_neg($filOnOff, "SA.AP_ONOFF");
resulting in:
$queryOnOff=optimize_radio_neg($filOnOff, "SA.AP_ONOFF");
CHANGE 8
In file
<SEPM Home>\Php\Include\Util\util.php:
add the extra option in line 2647, currently reading:
if(isset($filOnOff) && trim($filOnOff)!=""&& trim($filOnOff)!="127"&& $filOnOff!="0"&& $filOnOff!="on"){ die_elegantly("filOnOff: $filOnOff"); }
resulting in:
if(isset($filOnOff) && trim($filOnOff)!=""&& trim($filOnOff)!="127"&& $filOnOff!="0"&& $filOnOff!="on"&& $filOnOff!="1"&& $filOnOff!="not on"){ die_elegantly("filOnOff: $filOnOff"); }
and further on, insert an extra function zero_one_127_to_onoff after existing function zero_127_to_onoff in line 4439:
function zero_one_127_to_onoff($val)
{
$mutil = new UtilClass;
return $mutil->zero_one_127_to_onoff($val);
}
and insert an extra function optimize_radio_neg after existing function optimize_checkbox_neg somewhere around line 4695:
function optimize_radio_neg($var, $compare)
{
$mutil = new UtilClass;
return $mutil->optimize_radio_neg($var, $compare);
}
CHANGE 9
In file
<SEPM Home>\Php\Include\Util\UtilClass.php:
insert an extra function zero_one_127_to_onoff after existing function zero_127_to_onoff in line 499:
function zero_one_127_to_onoff($val) {
switch ($val) {
case '0' :
return 'on';
case '1' :
return 'not on';
default :
return '127';
}
}
and insert an extra function optimize_radio_neg after existing function optimize_checkbox_neg somewhere around line 769:
function optimize_radio_neg($var, $compare) {
switch ($var) {
case 'on' :
return " $compare='0'";
case 'not on' :
return " $compare != '1'";
default :
return ""; // Do not filter on Auto-Protect status.
}
}
and insert an extra function onoff_to_zero_one after existing function onoff_to_127_zero somewhere around line 870:
function onoff_to_zero_one($val) {
switch ($val) {
case 'on' : // Filter 'on' means that Auto-Protect is off. Coded by filter=0 in the DB.
return "0";
case 'not on' : // Filter 'not on' means that Auto-Protect is not on. Coded by filter=1 in the DB.
return "1";
default : // No filter on Auto-Protect status. Coded by filter=127 in the DB.
return "127";
}
}
FINISHED