Let's build User
Hierarchy Module for SugarCRM Version 6.* :
Step
1) Download Zucker_Hierarchy_module_1.1
Step
2) Edit manifest.php
and update the acceptable version:
$manifest=array(
'acceptable_sugar_versions'=>array("regex_matches" => array("6.5.*")),
'acceptable_sugar_versions'=>array("regex_matches" => array("6.5.*")),
Refer a Link and do the changes as demonstrated in manifest.php.
Step
3) Replace all database instance From $db
= &PearDatabase::getInstance();to $db = &
DBManagerFactory::getInstance();
Step
4) User-Hierarchy menu not displayed properly on admin page
,So we
need to add the ['Administration'] level to an array in the
/custom/administration.php file. The entire file will look like this:
PHP
Code:
<?php
// User hierarchy menu
foreach (
$admin_group_header
as
$i
=>
$group
) {
if (
$group
[
0
] ==
'LBL_USERS_TITLE'
) {
$admin_group_header
[
$i
][
3
][
'Administration'
][
'user_hierarchy'
] = array(
$image_path
.
'Users'
,
'LBL_USER_HIERARCHY_TITLE'
,
'LBL_USER_HIERARCHY'
,
'./index.php?module=UserHierarchy&action=ShowHierarchy'
);
}
}
?>
Step
5) To set permission to user ,Branch vise edit List-view page and paste below code in file:
\include\ListView\ListViewData.php at line no. 300.
include_once("modules/UserHierarchy/UserHierarchy.php");
// [begin: UserHierarchy]
global $current_user;
if($_REQUEST['module']=='Leads'){
if($current_user->user_name!='superuser') {
if (class_exists('UserHierarchy')) {
$ret_array = UserHierarchy::query_array_with_hierarchy_filter($ret_array);
}
} else {
//do nothing
}
} else {
if (class_exists('UserHierarchy')) {
$ret_array = UserHierarchy::query_array_with_hierarchy_filter($ret_array);
}
}
// [end: UserHierarchy]
// [begin: UserHierarchy]
global $current_user;
if($_REQUEST['module']=='Leads'){
if($current_user->user_name!='superuser') {
if (class_exists('UserHierarchy')) {
$ret_array = UserHierarchy::query_array_with_hierarchy_filter($ret_array);
}
} else {
//do nothing
}
} else {
if (class_exists('UserHierarchy')) {
$ret_array = UserHierarchy::query_array_with_hierarchy_filter($ret_array);
}
}
// [end: UserHierarchy]
I
think that's it. Hope that helps a bit.