Ver Fonte

#614 incorrect error message when profile creation is disabled for Account profile

Alex Trofimov há 9 anos atrás
pai
commit
6232d4c3cf

+ 8 - 2
modules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php

@@ -115,8 +115,14 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         $CNF = &$this->_oModule->_oConfig->CNF;
 
         // check access
-        if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedAdd()))
-            return MsgBox($sMsg);
+        if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedAdd())) {
+            $oProfile = BxDolProfile::getInstance();
+            $aProfileInfo = $oProfile->getInfo();
+            if ($aProfileInfo['type'] == 'system' && is_subclass_of($this->_oModule, 'BxBaseModProfileModule') && $this->_oModule->serviceActAsProfile()) // special check for system profile is needed, because of incorrect error message
+                return MsgBox(_t('_sys_txt_access_denied'));
+            else
+                return MsgBox($sMsg);
+        }
 
         // check and display form
         $oForm = $this->getObjectFormAdd();