After more research and post in the forum I finally found how to change the related list.
See my post : viewtopic.php?f=139&t=54684
An example: You want to modify the list of Trouble Tickets in Organization and add fields CreatedTime. problem, the column appears with no value !!!
Step 1: Determine what files to edit: modules/HelpDesk.php and modules/Accounts.php in our case.
Step 2: In the file for listview, here HepDesk.php, add the fields you want to see.
Change variables list_fields and list_fields_name. (lines 38 and 50)
Be careful: If you add a data from another table (cf_xxx) you have to add it in variables tab_name and tab_name_index (lines 25 and 26)
var $list_fields = Array(
- //Module Sequence Numbering
//'Ticket ID'=>Array('crmentity'=>'crmid'),
'Ticket No'=>Array('troubletickets'=>'ticket_no'),
// END
'Subject'=>Array('troubletickets'=>'title'),
'Related to'=>Array('troubletickets'=>'parent_id'),
'Status'=>Array('troubletickets'=>'status'),
'Priority'=>Array('troubletickets'=>'priority'),
'Created Time'=>Array('crmentity','createdtime'),
'Assigned To'=>Array('crmentity','smownerid')
var $list_fields_name = Array(
- 'Ticket No'=>'ticket_no',
'Subject'=>'ticket_title',
'Related to'=>'parent_id',
'Status'=>'ticketstatus',
'Priority'=>'ticketpriorities',
'Created Time'=>'createdtime',
'Assigned To'=>'assigned_user_id'
Step 3: In the module file here Accounts.php, modify the SQL query that retrieves the values.
To modify this function search term function begin by function get_,here function get_tickets
In this function search GetRelatedList, before this line you have the query.
Modify the sql query to add the fields, here createdtime
- /**
* Function to get Account related Tickets
* @param integer $id - accountid
* returns related Ticket record in array format
*/
function get_tickets($id, $cur_tab_id, $rel_tab_id, $actions=false) {
.
.
.
$query = "SELECT case when (vtiger_users.user_name not like '') then $userNameSql else vtiger_groups.groupname end as user_name, vtiger_users.id,
- vtiger_troubletickets.title, vtiger_troubletickets.ticketid AS crmid,
vtiger_troubletickets.status, vtiger_troubletickets.priority,
vtiger_troubletickets.parent_id, vtiger_troubletickets.ticket_no,
vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_crmentity.createdtime
FROM vtiger_troubletickets
INNER JOIN vtiger_crmentity
ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid
LEFT JOIN vtiger_account
ON vtiger_account.accountid = vtiger_troubletickets.parent_id
LEFT JOIN vtiger_contactdetails
ON vtiger_contactdetails.contactid=vtiger_troubletickets.parent_id
LEFT JOIN vtiger_users
ON vtiger_users.id=vtiger_crmentity.smownerid
LEFT JOIN vtiger_groups
ON vtiger_groups.groupid = vtiger_crmentity.smownerid
WHERE vtiger_crmentity.deleted = 0 and vtiger_troubletickets.parent_id=$id" ;
Yes, it works!
Special Thanks to : dubwise