Hi All!
My problem is the next: I am actually customizing SugarCRM, and last week, I added a field to the opportunities_contacts relationship. This worked great, and still works great, but Now, we'd like to display two fields (contact_role and comment (my custom_field)) to the opportunities subpanel in the contacts tab.
But it seems I can't manage that on myself. I tried to copy some of the code I found in the contact module to the opportunities module, the columns appear in the subpanel, but are void!
Can anyone Help me please?
I guess the solution will be found in the vardefs and the /subpanels/ForContacts.php files in the Opportunities directory.
Here's the code I copied from the contacts module:
In opportunities vardefs.php, here's what i pasted from contacts/vardefs.php:
and here's my ForContacts.php subpanel file:Code:'opportunity_role_fields' => array ( 'name' => 'opportunity_role_fields', 'rname' => 'id', 'relationship_fields'=>array('id' => 'opportunity_role_id', 'contact_role' => 'opportunity_role','comment'=>'comment'), 'vname' => 'LBL_ACCOUNT_NAME', 'type' => 'relate', 'link' => 'contacts', 'link_type' => 'relationship_info', 'join_link_name' => 'opportunities_contacts', 'source' => 'non-db', 'Importable' => false, 'duplicate_merge'=> 'disabled', ), 'opportunity_role_id' => array( 'name' => 'opportunity_role_id', 'type' => 'varchar', 'source' => 'non-db', 'vname' => 'LBL_OPPORTUNITY_ROLE_ID', ), 'opportunity_role' => array( 'name' => 'opportunity_role', 'type' => 'enum', 'source' => 'non-db', 'vname' => 'LBL_OPPORTUNITY_ROLE', 'options' => 'opportunity_relationship_type_dom', ), 'comment' => array( 'name' => 'comment', 'type' => 'text', 'source' => 'non-db', 'vname' => 'LBL_CONTACT_ROLE_COMMENT', ),
The EditRole button is working fine, but of course, as I can't get the data in my subpanel, this button is creating new records instead of editing the one I select.Code:<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); $subpanel_layout = array( 'top_buttons' => array( array('widget_class' => 'SubPanelTopCreateButton'), array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'Opportunities'), ), 'where' => '', 'list_fields' => array( 'name'=>array( 'name' => 'name', 'vname' => 'LBL_LIST_OPPORTUNITY_NAME', 'widget_class' => 'SubPanelDetailViewLink', 'width' => '40%', ), 'account_name'=>array( 'vname' => 'LBL_LIST_ACCOUNT_NAME', 'widget_class' => 'SubPanelDetailViewLink', 'module' => 'Accounts', 'width' => '31%', 'target_record_key' => 'account_id', 'target_module' => 'Accounts', ), 'sales_stage'=>array( 'name' => 'sales_stage', 'vname' => 'LBL_LIST_SALES_STAGE', 'width' => '15%', ), 'edit_role_button'=>array( 'widget_class' => 'SubPanelEditRoleButton', 'role_id'=>'opportunity_role_id', 'module' => 'Contacts', 'width' => '5%', ), 'opportunity_role_fields'=>array( 'usage' => 'query_only', ), 'opportunity_role_id'=>array( //'usage' => 'query_only', 'name' =>'opportunity_role_id', 'vname'=>'ID opportunity', 'width'=>'30%', ), 'comment'=>array( 'name'=>'comment', 'vname' => 'LBL_CONTACT_ROLE_COMMENT', 'width' => '20%', 'sortable'=>false, ), 'edit_button'=>array( 'widget_class' => 'SubPanelEditButton', 'module' => 'Opportunities', 'width' => '4%', ), 'amount_usdollar'=>array( 'usage'=>'query_only', ), ), ); ?>


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks