|
| 1 | +diff --git a/inc/collectrule.class.php b/inc/collectrule.class.php |
| 2 | +index 55e700c0f..9df0c229b 100644 |
| 3 | +--- a/inc/collectrule.class.php |
| 4 | ++++ b/inc/collectrule.class.php |
| 5 | +@@ -115,7 +115,7 @@ class PluginFusioninventoryCollectRule extends Rule { |
| 6 | + * @param array $params |
| 7 | + * @return array |
| 8 | + */ |
| 9 | +- function executeActions($output, $params) { |
| 10 | ++ function executeActions($output, $params, array $input = []) { |
| 11 | + |
| 12 | + PluginFusioninventoryToolbox::logIfExtradebug( |
| 13 | + "pluginFusioninventory-rules-collect", |
| 14 | +@@ -181,7 +181,7 @@ class PluginFusioninventoryCollectRule extends Rule { |
| 15 | + default: |
| 16 | + //plugins actions |
| 17 | + $executeaction = clone $this; |
| 18 | +- $output = $executeaction->executePluginsActions($action, $output, $params); |
| 19 | ++ $output = $executeaction->executePluginsActions($action, $output, $params, $input); |
| 20 | + break; |
| 21 | + |
| 22 | + } |
| 23 | +diff --git a/inc/formatconvert.class.php b/inc/formatconvert.class.php |
| 24 | +index 506cb2aec..59ad31d96 100644 |
| 25 | +--- a/inc/formatconvert.class.php |
| 26 | ++++ b/inc/formatconvert.class.php |
| 27 | +@@ -1598,7 +1598,8 @@ class PluginFusioninventoryFormatconvert { |
| 28 | + 'VERSION' => 'version', |
| 29 | + 'COMMENTS' => 'comment', |
| 30 | + 'INSTALLDATE' => 'date_install', |
| 31 | +- 'SYSTEM_CATEGORY' => '_system_category']); |
| 32 | ++ 'SYSTEM_CATEGORY' => '_system_category', |
| 33 | ++ 'OPERATIONG_SYSTEM' => 'operatingsystems_id']); |
| 34 | + if (!isset($array_tmp['name']) |
| 35 | + || $array_tmp['name'] == '') { |
| 36 | + if (isset($a_softwares['GUID']) |
| 37 | +@@ -1632,11 +1633,13 @@ class PluginFusioninventoryFormatconvert { |
| 38 | + //for software dictionnary |
| 39 | + if ($nb_RuleDictionnarySoftware > 0) { |
| 40 | + $rule_input = [ |
| 41 | +- "name" => $array_tmp['name'], |
| 42 | +- "manufacturer" => $array_tmp['manufacturers_id'], |
| 43 | +- "old_version" => $array_tmp['version'], |
| 44 | +- "entities_id" => $entities_id_software, |
| 45 | +- "_system_category" => $array_tmp['_system_category'] |
| 46 | ++ "name" => $array_tmp['name'], |
| 47 | ++ "manufacturer" => $array_tmp['manufacturers_id'], |
| 48 | ++ "old_version" => $array_tmp['version'], |
| 49 | ++ "entities_id" => $entities_id_software, |
| 50 | ++ "operatingsystems_id" => $array_tmp['operatingsystems_id'], |
| 51 | ++ "_system_category" => $array_tmp['_system_category'], |
| 52 | ++ "device_id" => isset($a_inventory['Computer']['device_id']) ? $a_inventory['Computer']['device_id'] : 0, |
| 53 | + ]; |
| 54 | + $res_rule = $rulecollection->processAllRules($rule_input); |
| 55 | + } |
| 56 | +diff --git a/inc/inventorycomputerinventory.class.php b/inc/inventorycomputerinventory.class.php |
| 57 | +index 8b0a1186c..aae4783a3 100644 |
| 58 | +--- a/inc/inventorycomputerinventory.class.php |
| 59 | ++++ b/inc/inventorycomputerinventory.class.php |
| 60 | +@@ -474,6 +474,7 @@ class PluginFusioninventoryInventoryComputerInventory { |
| 61 | + $a_computerinventory, |
| 62 | + $items_id); |
| 63 | + } |
| 64 | ++ $a_computerinventory['Computer']['device_id'] = $this->device_id; |
| 65 | + $a_computerinventory = $pfFormatconvert->computerSoftwareTransformation( |
| 66 | + $a_computerinventory, |
| 67 | + $entities_id); |
| 68 | +@@ -581,7 +582,7 @@ class PluginFusioninventoryInventoryComputerInventory { |
| 69 | + 'computer'); |
| 70 | + } |
| 71 | + } else if ($itemtype == 'PluginFusioninventoryUnmanaged') { |
| 72 | +- |
| 73 | ++ $a_computerinventory['Computer']['device_id'] = $this->device_id; |
| 74 | + $a_computerinventory = $pfFormatconvert->computerSoftwareTransformation( |
| 75 | + $a_computerinventory, |
| 76 | + $entities_id); |
| 77 | +diff --git a/inc/inventoryruleentity.class.php b/inc/inventoryruleentity.class.php |
| 78 | +index c4e57a977..a13e1ad7f 100644 |
| 79 | +--- a/inc/inventoryruleentity.class.php |
| 80 | ++++ b/inc/inventoryruleentity.class.php |
| 81 | +@@ -117,7 +117,7 @@ class PluginFusioninventoryInventoryRuleEntity extends Rule { |
| 82 | + * @param array $params |
| 83 | + * @return array |
| 84 | + */ |
| 85 | +- function executeActions($output, $params) { |
| 86 | ++ function executeActions($output, $params, array $input = []) { |
| 87 | + |
| 88 | + PluginFusioninventoryToolbox::logIfExtradebug( |
| 89 | + "pluginFusioninventory-rules-entity", |
| 90 | +@@ -395,7 +395,7 @@ class PluginFusioninventoryInventoryRuleEntity extends Rule { |
| 91 | + if ($this->checkCriterias($input)) { |
| 92 | + unset($output["_no_rule_matches"]); |
| 93 | + $refoutput = $output; |
| 94 | +- $output = $this->executeActions($output, $params); |
| 95 | ++ $output = $this->executeActions($output, $params, $input); |
| 96 | + if (!isset($output['pass_rule'])) { |
| 97 | + $this->updateOnlyCriteria($options, $refoutput, $output); |
| 98 | + //Hook |
| 99 | +diff --git a/inc/inventoryruleimport.class.php b/inc/inventoryruleimport.class.php |
| 100 | +index a9454f521..f60115f41 100644 |
| 101 | +--- a/inc/inventoryruleimport.class.php |
| 102 | ++++ b/inc/inventoryruleimport.class.php |
| 103 | +@@ -716,7 +716,7 @@ class PluginFusioninventoryInventoryRuleImport extends Rule { |
| 104 | + * @param array $params |
| 105 | + * @return array |
| 106 | + */ |
| 107 | +- function executeActions($output, $params) { |
| 108 | ++ function executeActions($output, $params, array $input = []) { |
| 109 | + if (isset($params['class'])) { |
| 110 | + $class = $params['class']; |
| 111 | + } else if (isset($_SESSION['plugin_fusioninventory_classrulepassed'])) { |
| 112 | +diff --git a/inc/inventoryrulelocation.class.php b/inc/inventoryrulelocation.class.php |
| 113 | +index f0e8edeab..05ddf6199 100644 |
| 114 | +--- a/inc/inventoryrulelocation.class.php |
| 115 | ++++ b/inc/inventoryrulelocation.class.php |
| 116 | +@@ -117,7 +117,7 @@ class PluginFusioninventoryInventoryRuleLocation extends Rule { |
| 117 | + * @param array $params |
| 118 | + * @return array |
| 119 | + */ |
| 120 | +- function executeActions($output, $params) { |
| 121 | ++ function executeActions($output, $params, array $input = []) { |
| 122 | + |
| 123 | + PluginFusioninventoryToolbox::logIfExtradebug( |
| 124 | + "pluginFusioninventory-rules-location", |
| 125 | +diff --git a/phpunit/1_Unit/SoftwareUpdateTest.php b/phpunit/1_Unit/SoftwareUpdateTest.php |
| 126 | +index d5203f33a..f30f94428 100644 |
| 127 | +--- a/phpunit/1_Unit/SoftwareUpdateTest.php |
| 128 | ++++ b/phpunit/1_Unit/SoftwareUpdateTest.php |
| 129 | +@@ -162,9 +162,12 @@ class SoftwareUpdateTest extends RestoreDatabase_TestCase { |
| 130 | + 'PUBLISHER' => 'fusioninventory team', |
| 131 | + 'NAME' => 'fusioninventory', |
| 132 | + 'VERSION' => '0.85+1.0', |
| 133 | +- 'SYSTEM_CATEGORY' => 'devel' |
| 134 | ++ 'SYSTEM_CATEGORY' => 'devel', |
| 135 | ++ 'OPERATIONG_SYSTEM' => 0 |
| 136 | + ]; |
| 137 | + |
| 138 | ++ $a_software['Computer']['device_id'] = 0; |
| 139 | ++ |
| 140 | + $pfFormatconvert = new PluginFusioninventoryFormatconvert(); |
| 141 | + $a_return = $pfFormatconvert->computerSoftwareTransformation($a_software, 0); |
| 142 | + |
0 commit comments