diff --git a/ajax/ajax_accountSave.php b/ajax/ajax_accountSave.php index 010737f2..fa5fb461 100644 --- a/ajax/ajax_accountSave.php +++ b/ajax/ajax_accountSave.php @@ -58,11 +58,11 @@ $accountNotes = SP\Request::analyze('notes'); $accountUrl = SP\Request::analyze('url'); $accountGroupEditEnabled = SP\Request::analyze('geditenabled', 0, false, 1); $accountUserEditEnabled = SP\Request::analyze('ueditenabled', 0, false, 1); +$accountMainGroupId = SP\Request::analyze('mainGroupId', SP\Session::getUserGroupId()); $accountChangesHash = SP\Request::analyze('hash'); // Datos del Usuario $currentUserId = SP\Session::getUserId(); -$currentGroupId = SP\Session::getUserGroupId(); if ($actionId === \SP\Controller\ActionsInterface::ACTION_ACC_NEW) { // Comprobaciones para nueva cuenta @@ -148,7 +148,7 @@ switch ($actionId) { $account->setAccountIV($accounEncPassIV); $account->setAccountNotes($accountNotes); $account->setAccountUserId($currentUserId); - $account->setAccountUserGroupId($currentGroupId); + $account->setAccountUserGroupId($accountMainGroupId); $account->setAccountUsersId($accountOtherUsers); $account->setAccountUserGroupsId($accountOtherGroups); $account->setAccountOtherUserEdit($accountUserEditEnabled); @@ -187,6 +187,10 @@ switch ($actionId) { $account->setAccountOtherUserEdit($accountUserEditEnabled); $account->setAccountOtherGroupEdit($accountGroupEditEnabled); + // Cambiar el grupo principal si el usuario es Admin + if (SP\Session::getUserIsAdminApp() || SP\Session::getUserIsAdminAcc()) { + $account->setAccountUserGroupId($accountMainGroupId); + } // Comprobar si han habido cambios if ($accountChangesHash == $account->calcChangesHash()) { diff --git a/inc/Account.class.php b/inc/Account.class.php index 4f96fdd6..83fe1a87 100644 --- a/inc/Account.class.php +++ b/inc/Account.class.php @@ -136,6 +136,7 @@ class Account extends AccountBase implements AccountInterface . 'account_url = :accountUrl,' . 'account_notes = :accountNotes,' . 'account_userEditId = :accountUserEditId,' + . 'account_userGroupId = :accountUserGroupId,' . 'account_dateEdit = NOW(),' . 'account_otherUserEdit = :accountOtherUserEdit,' . 'account_otherGroupEdit = :accountOtherGroupEdit ' @@ -148,6 +149,7 @@ class Account extends AccountBase implements AccountInterface $data['accountUrl'] = $this->getAccountUrl(); $data['accountNotes'] = $this->getAccountNotes(); $data['accountUserEditId'] = $this->getAccountUserEditId(); + $data['accountUserGroupId'] = ($this->getAccountUserGroupId()) ? $this->getAccountUserGroupId() : 'account_userGroupId'; $data['accountOtherUserEdit'] = intval($this->getAccountOtherUserEdit()); $data['accountOtherGroupEdit'] = intval($this->getAccountOtherGroupEdit()); $data['accountId'] = $this->getAccountId(); diff --git a/inc/themes/material-blue/account.inc b/inc/themes/material-blue/account.inc index 30544e23..c525b308 100644 --- a/inc/themes/material-blue/account.inc +++ b/inc/themes/material-blue/account.inc @@ -199,6 +199,21 @@ + + + + + + + + +