From dc1b5b0d4cd7cb4c936765643db45d125ee4ef18 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Mon, 27 Feb 2012 16:15:08 +0000 Subject: [PATCH] - Bug fix: the hierarchical key in Organizations is not always named 'parent_id' ! SVN:1.2[1868] --- addons/userrights/userrightsprofile.class.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/userrights/userrightsprofile.class.inc.php b/addons/userrights/userrightsprofile.class.inc.php index a00c840c2..f479bf33a 100644 --- a/addons/userrights/userrightsprofile.class.inc.php +++ b/addons/userrights/userrightsprofile.class.inc.php @@ -693,7 +693,7 @@ class UserRightsProfile extends UserRightsAddOnAPI $sHierarchicalKeyCode = MetaModel::IsHierarchicalClass('Organization'); if ($sHierarchicalKeyCode !== false) { - $sUserOrgQuery = 'SELECT UserOrg, Org FROM Organization AS Org JOIN Organization AS Root ON Org.parent_id BELOW Root.id JOIN URP_UserOrg AS UserOrg ON UserOrg.allowed_org_id = Root.id'; + $sUserOrgQuery = 'SELECT UserOrg, Org FROM Organization AS Org JOIN Organization AS Root ON Org.'.$sHierarchicalKeyCode.' BELOW Root.id JOIN URP_UserOrg AS UserOrg ON UserOrg.allowed_org_id = Root.id'; $oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery)); while ($aRow = $oUserOrgSet->FetchAssoc()) {