Skip to content
Snippets Groups Projects
Commit d4348da1 authored by vincenzo.bruno's avatar vincenzo.bruno
Browse files

Adddress issue #1947 #1947...

Adddress issue #1947 #1947 Problem on users visibility based on "Can Assign Records To" set to "Users having Same Role or Subordinate Role" in role configuration.
parent 3ef60ec5
No related branches found
No related tags found
1 merge request!1267Fix #1947 https://code.vtiger.com/vtiger/vtigercrm/-/issues/1947...
......@@ -35,6 +35,7 @@ $languageStrings = array(
'LBL_ALL_USERS' => 'All Users',
'LBL_USERS_WITH_LOWER_LEVEL' => 'Users having Subordinate Role',
'LBL_USERS_WITH_SAME_OR_LOWER_LEVEL' => 'Users having Same Role or Subordinate Role',
'LBL_USERS_WITH_SAME_LEVEL_AND_SUBORDINATES' => 'Users having Same Level or Subordinate Role',
/*Vtiger7 String*/
'LBL_EDIT_ROLE' => 'Edit Role',
......
......@@ -68,6 +68,11 @@
<div class="radio">
<label>
<input type="radio" value="2" {if $RECORD_MODEL->get('allowassignedrecordsto') eq '2'} checked="" {/if} name="allowassignedrecordsto" data-handler="new" class="alignTop"/>
&nbsp;{vtranslate('LBL_USERS_WITH_SAME_LEVEL_AND_SUBORDINATES',$QUALIFIED_MODULE)}</label>
</div>
<div class="radio">
<label>
<input type="radio" value="4" {if $RECORD_MODEL->get('allowassignedrecordsto') eq '4'} checked="" {/if} name="allowassignedrecordsto" data-handler="new" class="alignTop"/>
&nbsp;{vtranslate('LBL_USERS_WITH_SAME_OR_LOWER_LEVEL',$QUALIFIED_MODULE)}</label>
</div>
<div class="radio">
......
......@@ -426,6 +426,8 @@ class Users_Record_Model extends Vtiger_Record_Model {
if(empty($accessibleUser)) {
if($currentUserRoleModel->get('allowassignedrecordsto') === '1' || $private == 'Public') {
$accessibleUser = get_user_array(false, "ACTIVE", "", $private,$module);
} else if($currentUserRoleModel->get('allowassignedrecordsto') === '4'){
$accessibleUser = $this->getSameRolelUsersWithSubordinates();
} else if($currentUserRoleModel->get('allowassignedrecordsto') === '2'){
$accessibleUser = $this->getSameLevelUsersWithSubordinates();
} else if($currentUserRoleModel->get('allowassignedrecordsto') === '3') {
......@@ -436,6 +438,24 @@ class Users_Record_Model extends Vtiger_Record_Model {
return $accessibleUser;
}
/**
* Function to get same ROLE and subordinates Users
* @return <array> Users
*/
public function getSameRolelUsersWithSubordinates(){
$currentUserRoleModel = Settings_Roles_Record_Model::getInstanceById($this->getRole());
$roleID = $currentUserRoleModel->getId();
//$sameLevelRoles = $currentUserRoleModel->getSameLevelRoles();
//$sameLevelUsers = $this->getAllUsersOnRoles($sameLevelRoles);
$thisRole = array($roleID =>$currentUserRoleModel );
$sameLevelUsers = $this->getAllUsersOnRoles($thisRole);
$subordinateUsers = $this->getRoleBasedSubordinateUsers();
foreach ($subordinateUsers as $userId => $userName) {
$sameLevelUsers[$userId] = $userName;
}
return $sameLevelUsers;
}
/**
* Function to get same level and subordinates Users
* @return <array> Users
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment