Bug in Vtiger - only admin user in history tab. How to solve it.

Bug in Vtiger - only admin user in history tab. How to solve it.

Many users, especially after upgrading the VtigerCRM system from 7.0 to 7.1, ran into a problem — on the order card, the lead on the history tab, all changes appear as if they were made by the Administrator, and not the one who actually did it. Often this is due to handlers that work after a record is changed and as a result, the changes relate to the administrator, not the user.

How to fix this problem:

Open the following file: modules/ModTracker/ModTrackerHandler.php

This is exactly the file that captures all the changes that users make in the system and fixes them in the database.

 

Find the following block in this file:

$moduleName = $data->getModuleName();

$isTrackingEnabled = ModTracker::isTrackingEnabledForModule($moduleName);

if(!$isTrackingEnabled) {

return;

}

And before this block we add up-to-date information about the user who edits the record:

$current_user_id=$_SESSION["authenticated_user_id"];

$current_user = Users_Record_Model::getInstanceById($current_user_id, 'Users');

$curid=$current_user->get('id'); 

global $current_user;

Then find the following line:

global $adb, $current_user;

And you can delete current_user:

global $adb;

Then find the following line:

$adb->pquery('INSERT INTO vtiger_modtracker_basic(id, crmid, module, whodid, changedon, status)

VALUES(?,?,?,?,?,?)', Array($this->id, $recordId, $moduleName,

$current_user->id, $changedOn, $status));

And replace it by:

$adb->pquery('INSERT INTO vtiger_modtracker_basic(id, crmid, module, whodid, changedon, status)

VALUES(?,?,?,?,?,?)', Array($this->id, $recordId, $moduleName,

$curid, $changedOn, $status));

As a result, you will see that now in the history we have recorded not only the administrator, but the user who made the change in the record in fact.

Popular Posts

My most popular posts

Maximum productivity on remote job
Business

Maximum productivity on remote job

I started my own business and intentionally did my best to work from anywhere in the world. Sometimes I sit with my office with a large 27-inch monitor in my apartment in Cheboksary. Sometimes I’m in the office or in some cafe in another city.

Hello! I am Sergey Emelyanov and I am hardworker
Business PHP

Hello! I am Sergey Emelyanov and I am hardworker

I am a programmer. I am an entrepreneur in my heart. I started making money from the age of 11, in the harsh 90s, handing over glassware to a local store and exchanging it for sweets. I earned so much that was enough for various snacks.

Hire Professional CRM developer for $25 per hour

I will make time for your project. Knowledge of Vtiger CRM, SuiteCRM, Laravel, and Vue.js. I offer cooperation options that will help you take advantage of external experience, optimize costs and reduce risks. Full transparency of all stages of work and accounting for time costs. Pay only development working hours after accepting the task. Accept PayPal and Payoneer payment systems. How to hire professional developer? Just fill in the form

Telegram
@sergeyem
Telephone
+4915211100235