Results 1 to 1 of 1

Thread: Users ->Users many-to-many rel + subpanel possible?

  1. #1
    elRey is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    80

    Exclamation Users ->Users many-to-many rel + subpanel possible?

    ***EDIT***
    After looking thru Sugar, I need to copy the Contacts subpanel for Oppportunities
    and make it a Users subpanel for Users. Contacts have a Role for an Opportunity they're related to.

    Anyone know everythign involve in copied this subpanel's functinoality the way I need?

    ------------------------------------------------------------------------------------


    I've done the following:

    Added line:
    include_once("metadata/users_accessMetaData.php");
    to modules\TableDictionary.php

    created file \metadata/users_accessMetaData.php with code:
    PHP Code:
    $dictionary['users_access'] = array ( 'table' => 'users_access'
          
    'fields' => array (
           array(
    'name' =>'id''type' =>'char''len'=>'36''default'=>'''required'=>true)
          , array(
    'name' =>'grant_id''type' =>'char''len'=>'36', )
          , array(
    'name' =>'access_id''type' =>'char''len'=>'36', )
          , array(
    'name' =>'access_type''type' =>'bool''len'=>'1''default'=>'0''required'=>true)
          , array (
    'name' => 'date_modified','type' => 'datetime')
          , array(
    'name' =>'deleted''type' =>'bool''len'=>'1''default'=>'0''required'=>true)
          )                                  
          , 
    'indices' => array (
           array(
    'name' =>'idx_users_accesspk''type' =>'primary''fields'=>array('id'))
          , array(
    'name' =>'idx_users_access_grant''type' =>'index''fields'=>array('grant_id'))
          , array(
    'name' =>'idx_users_access_access''type' =>'index''fields'=>array('access_id'))
          , array(
    'name' =>'idx_users_access_grant_access_del''type' =>'index''fields'=>array('grant_id','access_id','deleted'))
          , array(
    'name' => 'idx_users_access_grant_access''type'=>'alternate_key''fields'=>array('grant_id','access_id'))      
          )
          
          ,
    'relationships' => array ('users_access' => array('lhs_module'=> 'Users''lhs_table'=> 'users''lhs_key' => 'id',
                                  
    'rhs_module'=> 'Users''rhs_table'=> 'users''rhs_key' => 'id',
                                  
    'relationship_type'=>'many-to-many',
                                  
    'join_table'=> 'users_access''join_key_lhs'=>'grant_id''join_key_rhs'=>'access_id'))
              

    added code to \modules\Users\vardefs.php file:
    fields array:
    PHP Code:
      'users_access' => 
      array (
          
    'name' => 'users_access',
        
    'type' => 'link',
        
    'relationship' => 'users_access',
        
    'module'=>'Users',
        
    'bean_name'=>'Users',
        
    'source'=>'non-db',
        
    'vname'=>'LBL_USERS_ACCESS',
      ), 
    Addedd code to \modules\Users\layout_defs.php file:
    PHP Code:
            'users_access' => array(
                   
    'top_buttons' => array(array('widget_class' => 'SubPanelTopSelectButton''popup_module' => 'Users'),),
                   
    'order' => 20,
                   
    'module' => 'Users',
                   
    'subpanel_name' => 'default',
                   
    'get_subpanel_data' => 'users',
                   
    'add_subpanel_data' => 'grant_id',
                   
    'refresh_page'=>1,
                   
    'title_key' => 'LBL_USERS_ACCESS_SUBPANEL_TITLE',
            ), 
    added label text

    repair tables created needed users_access table and fields
    repaired relationships

    But now no subpanels show unders User detailview until I delete code added to layout_defs.php

    Help.

    ***edit***
    log says: 10/23/06 11:09:30,646 [800] FATAL SugarCRM - Metadata for table users does not exist

    Rey
    Last edited by elRey; 2006-10-23 at 06:03 PM.

Thread Information

Users Browsing this Thread

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

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
  •