Skip to content

Commit

Permalink
Fix common db relation insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Lainow committed Nov 19, 2024
1 parent 730ef0a commit b8d0174
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inc/commoninjectionlib.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ private static function findSingle($item, $searchOption, $entity, $value)

if ($DB->numrows($result) > 0) {
//check if user has right on the current entity
$te = $DB->result($result, 0, "id");
return $DB->result($result, 0, "id");
} else {
return self::DROPDOWN_EMPTY_VALUE;
Expand Down Expand Up @@ -1606,7 +1607,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;
}

Expand Down

0 comments on commit b8d0174

Please sign in to comment.