Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change location id in allowed_so #692

Merged
merged 4 commits into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions inc/containerdisplaycondition.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,12 @@ public static function removeBlackListedOption($array, $itemtype_class)
//remove "Common"
unset($array['common']);

$allowed_table = [getTableForItemType($itemtype_class), getTableForItemType(User::getType()), getTableForItemType(Group::getType())];
$allowed_table = [getTableForItemType($itemtype_class), User::getTable(), Group::getTable()];
if ($itemtype_object->maybeLocated()) {
array_push($allowed_table, Location::getTable());
}

//use relation.constant.php to allow some tables (exclude Location which is managed later)
//use relation.constant.php to allow some tables (exclude Location which is managed using `CommonDBTM::maybeLocated()`)
foreach (getDbRelations() as $relation) {
foreach ($relation as $main_table => $foreignKey) {
if (
Expand All @@ -371,7 +374,6 @@ public static function removeBlackListedOption($array, $itemtype_class)

//allow specific datatype
$allowed_datatype = ["email", "weblink", "specific", "itemlink", "string", "text","number", "dropdown", "decimal", "integer", "bool"];

foreach ($array as $subKey => $subArray) {
if (
isset($subArray["table"]) && in_array($subArray["table"], $allowed_table)
Expand All @@ -385,10 +387,6 @@ public static function removeBlackListedOption($array, $itemtype_class)
}
}

if ($itemtype_object->maybeLocated()) {
$allowed_so[80] = Location::getTypeName(0);
}

return $allowed_so;
}

Expand Down
Loading