diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ed7dc0c..95c806d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix model subform not displayed after page reload - Rename visibility field label to "Is Private" +- Restored group selection in mappings - Fix special caracters malformed in translations ## [2.15.3] - 2025-12-22 diff --git a/inc/applianceinjection.class.php b/inc/applianceinjection.class.php index 544502d1..30267acf 100644 --- a/inc/applianceinjection.class.php +++ b/inc/applianceinjection.class.php @@ -61,6 +61,9 @@ public function getOptions($primary_type = '') $tab = Search::getOptions(get_parent_class($this)); + //Specific to groups (simple group, not technical) + $tab[71]['linkfield'] = 'groups_id_normal'; + //Remove some options because some fields cannot be imported $blacklist = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions(get_parent_class($this)); $notimportable = [5, 9, 31]; @@ -68,7 +71,7 @@ public function getOptions($primary_type = '') $options['ignore_fields'] = array_merge($blacklist, $notimportable); $options['displaytype'] = [ "multiline_text" => [4], - "dropdown" => [8, 10, 11, 32, 49], + "dropdown" => [8, 10, 11, 32, 49, 71], "user" => [6, 24], "bool" => [7, 61], ]; diff --git a/inc/certificateinjection.class.php b/inc/certificateinjection.class.php index 75781015..228a7fa3 100644 --- a/inc/certificateinjection.class.php +++ b/inc/certificateinjection.class.php @@ -61,6 +61,9 @@ public function getOptions($primary_type = '') $tab = Search::getOptions(get_parent_class($this)); + //Specific to groups (simple group, not technical) + $tab[71]['linkfield'] = 'groups_id_normal'; + //Remove some options because some fields cannot be imported $blacklist = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions(get_parent_class($this)); $notimportable = [2, 14, 19, 61, 72, 121]; diff --git a/inc/commoninjectionlib.class.php b/inc/commoninjectionlib.class.php index dbb90373..77bdc432 100644 --- a/inc/commoninjectionlib.class.php +++ b/inc/commoninjectionlib.class.php @@ -1673,14 +1673,14 @@ private function effectiveAddOrUpdate($injectionClass, $item, $values, $add = tr // handle new format for group type specification // restricting to group_item relations only - if (($key === "groups_id_tech" || $key === "groups_id") && $option['table'] == getTableForItemType(Group::class) && !empty($option) && isset($option['joinparams']['beforejoin']['table']) && $option['joinparams']['beforejoin']['table'] === getTableForItemType(Group_Item::class) && isset($option['joinparams']['beforejoin']['joinparams']['condition']['NEWTABLE.type'])) { - $value = $option['joinparams']['beforejoin']['joinparams']['condition']['NEWTABLE.type']; + if (($key === "groups_id_tech" || $key === "groups_id" || $key === "groups_id_normal") && $option['table'] == getTableForItemType(Group::class) && !empty($option) && isset($option['joinparams']['beforejoin']['table']) && $option['joinparams']['beforejoin']['table'] === getTableForItemType(Group_Item::class) && isset($option['joinparams']['beforejoin']['joinparams']['condition']['NEWTABLE.type'])) { + $group_type = $option['joinparams']['beforejoin']['joinparams']['condition']['NEWTABLE.type']; // depending on the type, set the correct field (_groups_id_tech => array or _groups_id => array) - // and unset the old one (groups_id_tech => int or groups_id => int) - if ($value == Group_Item::GROUP_TYPE_TECH) { + // and unset the old one (groups_id_tech => int or groups_id => int or groups_id_normal => int) + if ($group_type == Group_Item::GROUP_TYPE_TECH) { $toinject["_groups_id_tech"] = [$value]; } else { - $toinject["_groups"] = [$value]; + $toinject["_groups_id"] = [$value]; } unset($toinject[$key]); } diff --git a/inc/computerinjection.class.php b/inc/computerinjection.class.php index 6cf84e64..481352a1 100644 --- a/inc/computerinjection.class.php +++ b/inc/computerinjection.class.php @@ -71,6 +71,9 @@ public function getOptions($primary_type = '') //Specific to location $tab[3]['linkfield'] = 'locations_id'; + //Specific to groups (simple group, not technical) + $tab[71]['linkfield'] = 'groups_id_normal'; + //specific for antiviruses $tab[167]['name'] = __('Antivirus name', 'datainjection'); diff --git a/inc/monitorinjection.class.php b/inc/monitorinjection.class.php index 1227327c..5a69c35b 100644 --- a/inc/monitorinjection.class.php +++ b/inc/monitorinjection.class.php @@ -70,6 +70,9 @@ public function getOptions($primary_type = '') //Specific to location $tab[3]['linkfield'] = 'locations_id'; + //Specific to groups (simple group, not technical) + $tab[71]['linkfield'] = 'groups_id_normal'; + //Remove some options because some fields cannot be imported $blacklist = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions(get_parent_class($this)); $notimportable = [91, 92, 93]; diff --git a/inc/peripheralinjection.class.php b/inc/peripheralinjection.class.php index 1fec9d8a..6d7f5178 100644 --- a/inc/peripheralinjection.class.php +++ b/inc/peripheralinjection.class.php @@ -69,6 +69,9 @@ public function getOptions($primary_type = '') //Specific to location $tab[3]['linkfield'] = 'locations_id'; + //Specific to groups (simple group, not technical) + $tab[71]['linkfield'] = 'groups_id_normal'; + //Remove some options because some fields cannot be imported $blacklist = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions(get_parent_class($this)); $notimportable = [91, 92, 93]; diff --git a/inc/phoneinjection.class.php b/inc/phoneinjection.class.php index 756945a1..d0d73db9 100644 --- a/inc/phoneinjection.class.php +++ b/inc/phoneinjection.class.php @@ -67,6 +67,9 @@ public function getOptions($primary_type = '') $tab = Search::getOptions(get_parent_class($this)); + //Specific to groups (simple group, not technical) + $tab[71]['linkfield'] = 'groups_id_normal'; + //specific for domain $tab[205]['name'] = __('Domain name', 'datainjection'); diff --git a/inc/printerinjection.class.php b/inc/printerinjection.class.php index 226329d0..731a26a5 100644 --- a/inc/printerinjection.class.php +++ b/inc/printerinjection.class.php @@ -70,6 +70,9 @@ public function getOptions($primary_type = '') //Specific to location $tab[3]['linkfield'] = 'locations_id'; + //Specific to groups (simple group, not technical) + $tab[71]['linkfield'] = 'groups_id_normal'; + //Remove some options because some fields cannot be imported $blacklist = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions(get_parent_class($this)); $notimportable = [91, 92, 93];