Results 1 to 1 of 1

Thread: Subpanel Opportunities in Tab Contacts

  1. #1
    pikpik is offline Junior Member
    Join Date
    Oct 2007
    Posts
    4

    Default Need Help Customizing Subpanel Opportunities in Tab Contacts

    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:
    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',
    		),
    and here's my ForContacts.php subpanel file:

    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',
    		),
    	),
    );
    
    ?>
    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.
    Last edited by pikpik; 2007-11-14 at 04:35 PM. Reason: subject incomplete

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 2007-04-30, 07:09 PM
  2. Replies: 1
    Last Post: 2007-02-23, 03:08 AM
  3. Replies: 2
    Last Post: 2006-07-30, 01:34 AM
  4. Replies: 3
    Last Post: 2006-07-18, 10:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •