From 3172bb06f383680debbd5b5257d7d7bfc10e9fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Wed, 9 Aug 2023 14:56:21 +0200 Subject: [PATCH] Fix iterator usage --- hook.php | 2 +- inc/container.class.php | 2 +- inc/field.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hook.php b/hook.php index 7e02a022..9b5c7d1c 100644 --- a/hook.php +++ b/hook.php @@ -273,7 +273,7 @@ function plugin_fields_rule_matched($params = []) ] ]); if (count($iterator) > 0) { - $data = $iterator->next(); + $data = $iterator->current(); //retrieve computer $agents_id = $params['input']['plugin_fusioninventory_agents_id']; diff --git a/inc/container.class.php b/inc/container.class.php index ae976236..9db99fa3 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -1405,7 +1405,7 @@ public static function validateValues($data, $itemtype, $massiveaction) ], ]); - $db_result = $iterator->next(); + $db_result = $iterator->current(); if (isset($db_result['plugin_fields_' . $name . 'dropdowns_id'])) { $value = $db_result['plugin_fields_' . $name . 'dropdowns_id']; } else if (isset($db_result[$name])) { diff --git a/inc/field.class.php b/inc/field.class.php index 5c446360..96beb833 100644 --- a/inc/field.class.php +++ b/inc/field.class.php @@ -457,7 +457,7 @@ public function getNextRanking() ]); if (count($iterator) > 0) { - $data = $iterator->next(); + $data = $iterator->current(); return $data["rank"] + 1; } return 0;