Skip to content

Commit

Permalink
ilOrgUnit: OrgaUnit not showing in personal profile
Browse files Browse the repository at this point in the history
  • Loading branch information
skullbox305 authored and mbunkus committed Jan 22, 2024
1 parent f189144 commit 8f5dfce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function getTextRepresentationOfUsersOrgUnits($user_id, $separator
$ilDB = $DIC['ilDB'];
ilObjOrgUnitTree::_getInstance()->buildTempTableWithUsrAssignements();

$res = $ilDB->queryF("SELECT " . $ilDB->groupConcat("path", $separator) . " AS orgus FROM orgu_usr_assignements WHERE user_id = %s GROUP BY user_id;", array('integer'), array($user_id));
$res = $ilDB->queryF("SELECT " . $ilDB->groupConcat("title", $separator) . " AS orgus FROM orgu_usr_assignements WHERE user_id = %s GROUP BY user_id;", array('integer'), array($user_id));
$dat = $ilDB->fetchObject($res);

return $dat->orgus ? $dat->orgus : '-';
Expand Down
10 changes: 9 additions & 1 deletion Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,21 @@ public function buildTempTableWithUsrAssignements($temporary_table_name = 'orgu_
throw new ilException('there is already a temporary table for org-unit assignement: ' . self::$temporary_table_name);
}

$q = "CREATE TEMPORARY TABLE IF NOT EXISTS " . $temporary_table_name . " AS (
/* $q = "CREATE TEMPORARY TABLE IF NOT EXISTS " . $temporary_table_name . " AS (
SELECT DISTINCT object_reference.ref_id AS ref_id, il_orgu_ua.user_id AS user_id, orgu_path_storage.path AS path
FROM il_orgu_ua
JOIN object_reference ON object_reference.ref_id = il_orgu_ua.orgu_id
JOIN object_data ON object_data.obj_id = object_reference.obj_id
JOIN orgu_path_storage ON orgu_path_storage.ref_id = object_reference.ref_id
WHERE object_data.type = 'orgu' AND object_reference.deleted IS NULL
);"; */

$q = "CREATE TEMPORARY TABLE IF NOT EXISTS " . $temporary_table_name . " AS (
SELECT DISTINCT object_reference.ref_id AS ref_id, il_orgu_ua.user_id AS user_id, object_data.title AS title
FROM il_orgu_ua
JOIN object_reference ON object_reference.ref_id = il_orgu_ua.orgu_id
JOIN object_data ON object_data.obj_id = object_reference.obj_id
WHERE object_data.type = 'orgu' AND object_reference.deleted IS NULL
);";
$this->db->manipulate($q);

Expand Down

0 comments on commit 8f5dfce

Please sign in to comment.