diff --git a/front/container.form.php b/front/container.form.php index 38c76c26..eec01e85 100644 --- a/front/container.form.php +++ b/front/container.form.php @@ -28,7 +28,7 @@ Html::back(); } else if (isset($_POST["update_fields_values"])) { - $container->updateFieldsValues($_REQUEST, false, $_REQUEST['itemtype']); + $container->updateFieldsValues($_REQUEST, $_REQUEST['itemtype'], false); Html::back(); } else { diff --git a/hook.php b/hook.php index 21d9c011..b807cc92 100644 --- a/hook.php +++ b/hook.php @@ -264,9 +264,14 @@ function plugin_fields_rule_matched($params) { $agent->getFromDB($agents_id); // update current field - $container->updateFieldsValues(array('plugin_fields_containers_id' => $data['id'], - $field => $value, - 'items_id' => $agent->fields['computers_id'])); + $container->updateFieldsValues( + array( + 'plugin_fields_containers_id' => $data['id'], + $field => $value, + 'items_id' => $agent->fields['computers_id'] + ), + Computer::getType() + ); } } } diff --git a/inc/container.class.php b/inc/container.class.php index 0f165bae..2bae1158 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -738,9 +738,10 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem /** * Insert values submited by fields container * @param array $data data posted + * @param boolean $massiveaction Is a massive action * @return boolean */ - function updateFieldsValues($data, $massiveaction = false, $itemtype) { + function updateFieldsValues($data, $itemtype, $massiveaction = false) { global $DB; if (self::validateValues($data, $itemtype, $massiveaction) === false) { @@ -1040,7 +1041,7 @@ static function postItemAdd(CommonDBTM $item) { $data['items_id'] = $item->getID(); //update data $container = new self(); - if ($container->updateFieldsValues($data, isset($_REQUEST['massiveaction']), $item->getType())) { + if ($container->updateFieldsValues($data, $item->getType(), isset($_REQUEST['massiveaction']))) { return true; } } @@ -1061,7 +1062,7 @@ static function preItemUpdate(CommonDBTM $item) { $data = $item->plugin_fields_data; //update data $container = new self(); - if (count($data) == 0 || $container->updateFieldsValues($data, isset($_REQUEST['massiveaction']), $item->getType())) { + if (count($data) == 0 || $container->updateFieldsValues($data, $item->getType(), isset($_REQUEST['massiveaction']))) { return true; } return $item->input = array();