How to hide "Updates" section in the records

How to hide "Updates" section in the records

Some administrators are wondering how to remove the History tab from the contact / account / transaction card, etc. Often in this tab there is unnecessary information that stores the entire history of the object and it does not need to be shown to all users. Therefore, for security reasons, it is advisable to disable this tab or leave only to the administrator.

Some administrators are wondering how to remove the History tab from the contact / account / transaction card, etc. Often in this tab there is unnecessary information that stores the entire history of the object and it does not need to be shown to all users. Therefore, for security reasons, it is advisable to disable this tab or leave only to the administrator.

To do this, you need to go through the following steps:

1. Open file modules/Vtiger/models/DetailView.php.

2. Find function public function getDetailViewRelatedLinks() {

3. Add this line global $current_user;

4. Find block 

if($parentModuleModel->isTrackingEnabled()) {

$relatedLinks[] = array(

'linktype' => 'DETAILVIEWTAB',

'linklabel' => 'LBL_UPDATES',

'linkurl' => $recordModel->getDetailViewUrl().'&mode=showRecentActivities&page=1',

'linkicon' => ''

);

 

}

And change it to

if($current_user->id == '2') {

$relatedLinks[] = array(

'linktype' => 'DETAILVIEWTAB',

'linklabel' => 'LBL_UPDATES',

'linkurl' => $recordModel->getDetailViewUrl().'&mode=showRecentActivities&page=1',

'linkicon' => ''

);

}

 

So our full function

public function getDetailViewRelatedLinks() {

    global $current_user;

$recordModel = $this->getRecord();

$moduleName = $recordModel->getModuleName();

$parentModuleModel = $this->getModule();

$relatedLinks = array();

 

if($parentModuleModel->isSummaryViewSupported()) {

$relatedLinks = array(array(

'linktype' => 'DETAILVIEWTAB',

'linklabel' => vtranslate('LBL_SUMMARY', $moduleName),

'linkKey' => 'LBL_RECORD_SUMMARY',

'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showDetailViewByMode&requestMode=summary',

'linkicon' => ''

));

}

//link which shows the summary information(generally detail of record)

$relatedLinks[] = array(

'linktype' => 'DETAILVIEWTAB',

'linklabel' => vtranslate('LBL_DETAILS', $moduleName),

'linkKey' => 'LBL_RECORD_DETAILS',

'linkurl' => $recordModel->getDetailViewUrl().'&mode=showDetailViewByMode&requestMode=full',

'linkicon' => ''

);

 

if($current_user->id == '2') {

$relatedLinks[] = array(

'linktype' => 'DETAILVIEWTAB',

'linklabel' => 'LBL_UPDATES',

'linkurl' => $recordModel->getDetailViewUrl().'&mode=showRecentActivities&page=1',

'linkicon' => ''

);

}

 

 

$relationModels = $parentModuleModel->getRelations();

 

foreach($relationModels as $relation) {

//TODO : Way to get limited information than getting all the information

$link = array(

'linktype' => 'DETAILVIEWRELATED',

'linklabel' => $relation->get('label'),

'linkurl' => $relation->getListUrl($recordModel),

'linkicon' => '',

'relatedModuleName' => $relation->get('relatedModuleName'),

'linkid' => $relation->getId()

);

$relatedLinks[] = $link;

}

 

return $relatedLinks;

}