/**
 * Hook after updates
 *
 * @param $parm
 * @return nothing
 *
**/
function plugin_item_update_fusioninventory($parm)
{
    if (isset($_SESSION["glpiID"]) && $_SESSION["glpiID"] != '' && !isset($_SESSION['glpi_fusionionventory_nolock'])) {
        // manual task
        $plugin = new Plugin();
        if ($plugin->isActivated('fusioninventory')) {
            // lock fields which have been updated
            $type = get_class($parm);
            $id = $parm->getField('id');
            $fieldsToLock = $parm->updates;
            PluginFusioninventoryLock::addLocks($type, $id, $fieldsToLock);
        }
    }
}
示例#2
0
/**
 * Hook after updates
 *
 * @param $parm
 * @return nothing
 *
**/
function plugin_item_update_fusioninventory($parm)
{
    if (isset($_SESSION["glpiID"]) and $_SESSION["glpiID"] != '') {
        // manual task
        $plugin = new Plugin();
        if ($plugin->isActivated('fusioninventory')) {
            // lock fields which have been updated
            $type = $parm['type'];
            $ID = $parm['ID'];
            $fieldsToLock = $parm['updates'];
            $lockables = PluginFusioninventoryLockable::getLockableFields('', $type);
            $fieldsToLock = array_intersect($fieldsToLock, $lockables);
            // do not lock unlockable fields
            PluginFusioninventoryLock::addLocks($type, $ID, $fieldsToLock);
        }
    }
}