Skip to content

Commit ac4867f

Browse files
MyvTsvRom1-B
andauthored
fix(group): add missing group column to model mapping (#585)
* fix(group): add missing group column to model mapping * Update CHANGELOG.md * review * review --------- Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com>
1 parent e589e44 commit ac4867f

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
- Fix model subform not displayed after page reload
1313
- Rename visibility field label to "Is Private"
14+
- Restored group selection in mappings
1415
- Fix special caracters malformed in translations
1516

1617
## [2.15.3] - 2025-12-22

inc/commoninjectionlib.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,14 +1673,14 @@ private function effectiveAddOrUpdate($injectionClass, $item, $values, $add = tr
16731673

16741674
// handle new format for group type specification
16751675
// restricting to group_item relations only
1676-
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'])) {
1677-
$value = $option['joinparams']['beforejoin']['joinparams']['condition']['NEWTABLE.type'];
1676+
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'])) {
1677+
$group_type = $option['joinparams']['beforejoin']['joinparams']['condition']['NEWTABLE.type'];
16781678
// depending on the type, set the correct field (_groups_id_tech => array or _groups_id => array)
1679-
// and unset the old one (groups_id_tech => int or groups_id => int)
1680-
if ($value == Group_Item::GROUP_TYPE_TECH) {
1679+
// and unset the old one (groups_id_tech => int or groups_id => int or groups_id_normal => int)
1680+
if ($group_type == Group_Item::GROUP_TYPE_TECH) {
16811681
$toinject["_groups_id_tech"] = [$value];
16821682
} else {
1683-
$toinject["_groups"] = [$value];
1683+
$toinject["_groups_id"] = [$value];
16841684
}
16851685
unset($toinject[$key]);
16861686
}

inc/computerinjection.class.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public function getOptions($primary_type = '')
7171
//Specific to location
7272
$tab[3]['linkfield'] = 'locations_id';
7373

74+
//Specific to groups (simple group, not technical)
75+
$tab[71]['linkfield'] = 'groups_id_normal';
76+
7477
//specific for antiviruses
7578
$tab[167]['name'] = __('Antivirus name', 'datainjection');
7679

0 commit comments

Comments
 (0)