related list different column depending on Parent module - Printable Version +- CoreBOSBB (https://discussions.corebos.org) +-- Forum: Open (https://discussions.corebos.org/forumdisplay.php?fid=20) +--- Forum: Open Discussions (https://discussions.corebos.org/forumdisplay.php?fid=10) +--- Thread: related list different column depending on Parent module (/showthread.php?tid=105) |
related list different column depending on Parent module - saidmsl - 03-27-2015 Hi, is it possible to have different grid for related list depending on the parent module Rgds Re: related list different column depending on Parent module - joebordes - 03-27-2015 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) Re: related list different column depending on Parent module - saidmsl - 03-27-2015 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 Re: related list different column depending on Parent module - saidmsl - 03-27-2015 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' ) ); //---------------------------------------------------- Re: related list different column depending on Parent module - joebordes - 03-27-2015 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 |