From 351321d89fb0c874e0a00c64889c2a6c33507525 Mon Sep 17 00:00:00 2001 From: LAUNAY Samuel <107540223+Lainow@users.noreply.github.com> Date: Tue, 17 Dec 2024 12:39:45 +0100 Subject: [PATCH] Fix common db relation insertion (#439) * Fix common db relation insertion * Fix and update changelog * Update CHANGELOG.md Co-authored-by: Stanislas --------- Co-authored-by: Stanislas --- CHANGELOG.md | 1 + inc/commoninjectionlib.class.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfb5f87..5ff544c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- Fix relation (`CommonDBRelation`) insertion - Fix default entity insertion for a user - Fixed `SQL` error when creating new injection model - Fixed issue with missing dropdown options diff --git a/inc/commoninjectionlib.class.php b/inc/commoninjectionlib.class.php index 7fa83fa..5889d33 100644 --- a/inc/commoninjectionlib.class.php +++ b/inc/commoninjectionlib.class.php @@ -1645,7 +1645,7 @@ private function effectiveAddOrUpdate($injectionClass, $item, $values, $add = tr //CommonDBRelation are managed separately, so related field should be ignored // Ex : User -> groups_id -> Group_User // groups_id should not be injected in User (field contains group name (string)) - if ($option !== false && isset($option['displaytype']) && $option['displaytype'] == 'relation') { + if ($option !== false && isset($option['displaytype']) && $option['displaytype'] == 'relation' && !($item instanceof CommonDBRelation)) { continue; }