Kaynağa Gözat

#2824 Problem with deletion of profile by admin when admin is swithed to profile to delete it

Alex Trofimov 6 yıl önce
ebeveyn
işleme
5c90569a32
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 2
      inc/classes/BxDolProfileQuery.php

+ 2 - 2
inc/classes/BxDolProfileQuery.php

@@ -162,11 +162,11 @@ class BxDolProfileQuery extends BxDolDb implements iBxDolSingleton
         if ($bClearCache)
             $this->cleanMemory($sKey);
 
-        $sSql = $this->prepare("SELECT `profile_id` FROM `sys_accounts` WHERE `id` = ? LIMIT 1", $iAccountId);        
+        $sSql = $this->prepare("SELECT `profile_id` FROM `sys_accounts` AS `a` INNER JOIN `sys_profiles` AS `p` ON (`a`.`profile_id` = `p`.`id`) WHERE `a`.`id` = ? LIMIT 1", $iAccountId);        
         $iProfileId = $this->fromMemory($sKey, 'getOne', $sSql);
         if (!$iProfileId) {
             $this->cleanMemory($sKey);
-            $sSql = $this->prepare("SELECT `id` FROM `sys_profiles` WHERE `account_id` = ? LIMIT 1", $iAccountId);
+            $sSql = $this->prepare("SELECT `id` FROM `sys_profiles` WHERE `account_id` = ? ORDER BY FIELD(`type`, 'system', 'bx_organizations', 'bx_persons') DESC LIMIT 1", $iAccountId);
             $iProfileId = $this->getOne($sSql);
             if (!$iProfileId)
                 return false;