fusioninventory-for-glpi
fusioninventory-for-glpi copied to clipboard
FusionInventory 9.3+1.3 Using location rules for locked field - minor issue
After setting up location rule (in my case for printers) i have seen that field location were updated, although i mark location field as blocked. I made code review in inventoryprinterlib.class.php and found that lockable fields were retrieved but info about blocked locations_id not applied In code below you can see it
//Add the location if needed (play rule locations engine)
$input = PluginFusioninventoryToolbox::addLocation($input);
$printer->update($input, !$no_history);
I made a small change
//Add the location if needed (play rule locations engine)
if (!in_array("locations_id", $a_lockable)) {
PluginFusioninventoryToolbox::logIfExtradebug(
"pluginFusioninventory-rules-new-location",
"Locked field locations_id was not found!\n"."Data:\n".print_r($a_ret, true)
);
$input = PluginFusioninventoryToolbox::addLocation($input);
}
$printer->update($input, $no_history);
May be it useful for any other items, like computers and etc.
Thank you very much! This bug is still present in 9.5+3.0 and your code fixes it nicely.