Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
related list different column depending on Parent module
#1
Hi,

is it possible to have different grid for related list depending on the parent module

Rgds
Reply
#2
AFAIK there is no easy way to accomplish this right now.
You will have to do some changes in include/uitils/ListViewUtils.php, in the functions getListViewEntries() and getListViewHeader() changing dynamically the $focus->list_fields and $focus->list_fields_names arrays depending on the module of $focus and the $module varaible (I think)
Joe
TSolucio
Reply
#3
Thanks

my thoughts :

use an array for list_fields like

list_fields['parent'] = ....


will investigate about it this weekend . if i succeed, i will share the code

Rgds
Reply
#4
A quick a dirty Hack :


1.
in include/utils/ListViewUtils.php
function getListViewHeader

(line 60)

//Get the vtiger_tabid of the module
$tabid = getTabid($module);
$tabname = getParentTab();
global $current_user;

// MSL : different list as parent module
if (isset($focus->rellist_fields)) {
if (isset($focus->rellist_fields[$relatedmodule])) {
$focus->list_fields = $focus->rellist_fields[$relatedmodule];
$focus->list_fields_name = $focus->rellist_fields_name[$relatedmodule];
}
}


2. modify the <module>.php
after
"var $list_fields_name" declaration


Ex : (change correspondingly)
// MSL
var $rellist_fields = Array ('ProjectTask' =>
Array (
/* Format: Field Label => Array(tablename, columnname) */
// tablename should not have prefix 'vtiger_'
'Title'=> Array('candidates', 'title'),
'Expert'=> Array('candidates', 'expert'),
'Consultant'=> Array('candidates', 'consultant'),
'Proposed Fee'=> Array('candidates', 'amount'),
'Currency'=> Array('candidates', 'currency'),
'Assigned To' => Array('crmentity','smownerid')
)
);
var $rellist_fields_name = Array ('ProjectTask' =>
Array (
/* Format: Field Label => fieldname */
'Title'=> 'title',
'Expert' => 'expert',
'Consultant' => 'consultant',
'Proposed Fee' => 'amount',
'Currency' => 'currency',
'Assigned To' => 'assigned_user_id'
)
);
//----------------------------------------------------
Reply
#5
Interesting !

I see that you only change the list_fields property once, in the header, I suppose the $focus object is shared and the change passes on to the rest of the execution.

Nice and usefull. I will keep this in mind.

Thanks
Have a nice weekend
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)