I use Sugar 5.1 CE. I wanted to know if there is a way that I can hide some documents from my sales reps for candidate information? If so, how?
I use Sugar 5.1 CE. I wanted to know if there is a way that I can hide some documents from my sales reps for candidate information? If so, how?
Hi tmamayek
It is pretty possible, but the implementation will depend on some details regarding the scene:
1. What is the rule for hiding some specific document (Documents module?) to a specific sales reps (User)?
2. Do you want to define any custom field which will specify the visibility of document?
A detailed work flow would enable us guide you.
Best regards
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
In all honesty, I only want the 2 custom modules to only be able to be accessed by myself, as well as the attachments and notes and everything that is related to a specific module.
So I would only want user's with Admin rights to be able to access it unless I add on more people that would need that information, but that would be at least a year or so down the road. So it would just be admin rights now.
Adding a custom field to specify the visibility of the document wold be EXACTLY what I am looking for in general though. I want to be able to keep all of my documents in Sugar so that when I email people, everything is tracked. However, I don't want my reps to have access to some of these documents, so adding a custom field would be great.
Since I've got your attention, I don't know why when I go to accounts or leads advanced search, and try selecting a user to see just their records isn't working. What's weird is the version of Sugar I use in my part time job works perfectly as a multi-select box, but the one in mine is a look up function. Even when you select someone from the look up, it doesn't show anything....
Thanks a lot in advance.
Hi tmamayekOriginally Posted by tmamayek
Regarding your last question, how does the assigned user field looks like? A multi select, a dropdown or a select button?
If the ListView is empty then probably it looks like a select button, I suppose. Let me know it.
Edit the file include/ListView/ListViewData.php and add the code:
Just after the linePHP Code:echo "<LI>$main_query";
Around the line 287.PHP Code:$main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by'];
Regarding the main question, I can imagine how to implement your needs. Do you have PHP and Sugar skills?
It is necessary to create some extended code, not only a custom field.
Let me know if you want to discuss it.
Best regards
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
It's a select button, so should I do that edit you mentioned? In the list view, it does show the users, you just can't select one user to search the Account/leads.
Hi tmamayek
Edit the file custom/modules/<ModuleName>/metadata/searchdefs.php and modify the assigned_user_name field to looks like that one:
This is the default assigned_user_name defs for be displayed into Search Form.PHP Code:array('name' => 'assigned_user_id', 'type' => 'enum', 'label' => 'LBL_ASSIGNED_TO', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
Cheers
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
what about the hiding of the documents though? Still haven't received an answer on that from anyone...
Hi tmamayek
It is pretty possible.
You can create a logic_hook after_retrieve in the Users module which could add a filter in the ListView of Documents if some condition is filled.
Create the file custom/modules/Users/logic_hooks.php with this content:
Create the file custom/modules/Users/UserHook.php with this content:PHP Code:<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['after_retrieve'] = Array();
$hook_array['after_retrieve'][] = Array(1, 'filterDocuments', 'custom/modules/Users/UserHook.php','UserHook', 'filterDocuments');
?>
CheersPHP Code:<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class UserHook {
function filterDocuments(&$focus, $event, $arguments) {
global $current_user;
if($focus->id == $current_user->id && ! $current_user->is_admin) {
if((isset($_REQUEST['action']) && ($_REQUEST['action'] == 'index' || $_REQUEST['action'] == 'ListView')) && $_REQUEST['module'] == 'Documents') {
if(! isset($_REQUEST['searchFormTab']) || $_REQUEST['searchFormTab'] == 'basic_search') {
$_REQUEST['searchFormTab'] = 'basic_search';
$_REQUEST['assigned_user_id_basic'] = $current_user->id;
} else if($_REQUEST['searchFormTab'] == 'advanced_search') {
$_REQUEST['searchFormTab'] = 'advanced_search';
$_REQUEST['assigned_user_id_advanced'] = $current_user->id;
}
$_REQUEST['query'] = 'true';
}
}
}
}
?>
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
Hoping to revive this thread to get a little more explanation. I was able to implement what andopes suggested (Using Sugar 6.4.1) and I can filter so only documents which are assigned to a specific user show up when that user is in the documents module. I wanted to extend this logic a little further to set it up so that certain roles are unable to view all documents and other roles are unable to view documents which have an assigned category of Administrative. I understand that this line: $_REQUEST['assigned_user_id_advanced'] = $current_user->id; and the one for basic search seems to be what is filtering the results but I don't understand how it is doing it. Can anyone provide an information bridge as to either what this line is doing to filter the results or how I can implement what I stated above.
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks