Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Fix bug on transfert from fusioninventory inventory. closes #4169
Browse files Browse the repository at this point in the history
  • Loading branch information
David Durieux committed Jan 22, 2013
1 parent 6cd0052 commit 6ac55e8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions inc/componentscatalog_rule.class.php
Expand Up @@ -418,6 +418,7 @@ static function isThisItemCheckRule($parm) {

$a_find = array();
$pmComponentscatalog_rule = new PluginMonitoringComponentscatalog_rule();
$pmComponentscatalog = new PluginMonitoringComponentscatalog();
$pmSearch = new PluginMonitoringSearch();

$query = "SELECT * FROM `".$pmComponentscatalog_rule->getTable()."`
Expand Down Expand Up @@ -446,6 +447,30 @@ static function isThisItemCheckRule($parm) {
$_SESSION['glpiactiveentities_string'] = $parm->fields['entities_id'];
}

// Load right entity
$pmComponentscatalog->getFromDB($data['plugin_monitoring_componentscalalog_id']);
$default_entity = 0;
if (isset($_SESSION['glpiactive_entity'])) {
$default_entity = $_SESSION['glpiactive_entity'];
}
$entities_isrecursive = 0;
if (isset($_SESSION['glpiactiveentities'])
AND count($_SESSION['glpiactiveentities']) > 1) {
$entities_isrecursive = 1;
}
if (!isset($_SESSION['glpiactiveprofile']['entities'])) {
$_SESSION['glpiactiveprofile']['entities'] = array(
$pmComponentscatalog->fields['entities_id'] => array(
'id' => $pmComponentscatalog->fields['entities_id'],
'name' => '',
'is_recursive' => $pmComponentscatalog->fields['is_recursive']
)
);
}
Session::changeActiveEntities($pmComponentscatalog->fields['entities_id'],
$pmComponentscatalog->fields['is_recursive']);


Search::manageGetValues($data['itemtype']);

$resultr = $pmSearch->constructSQL($itemtype,
Expand All @@ -458,6 +483,10 @@ static function isThisItemCheckRule($parm) {
$a_find[$data['plugin_monitoring_componentscalalog_id']] = 0;
}
}

// Reload current entity
Session::changeActiveEntities($default_entity,
$entities_isrecursive);
}
if (count($get_tmp) > 0) {
$_GET = $get_tmp;
Expand Down

0 comments on commit 6ac55e8

Please sign in to comment.