Results 1 to 2 of 2

Thread: Relationship between Modules

  1. #1
    fbrites is offline Sugar Community Member
    Join Date
    May 2008
    Location
    Lisbon, Portugal
    Posts
    77

    Default Relationship between Modules

    Hi. I work with SugarCRM 5.0.0e in Windows XP.

    I want subpanels of the module 'Documents' in module' Accounts' but I'm having some problems.
    I did the following:
    - In MySQL, created table 'acounts_documents';
    - Created the file 'accounts_documentsMetaData.php':

    Code:
    $dictionary["accounts_documents"] = array (
      'table' => 'accounts_documents',
      'fields' => 
      array (
        0 => 
        array (
          'name' => 'id',
          'type' => 'varchar',
          'len' => 36,
        ),
        1 => 
        array (
          'name' => 'date_modified',
          'type' => 'datetime',
        ),
        2 => 
        array (
          'name' => 'deleted',
          'type' => 'bool',
          'len' => '1',
          'default' => '0',
          'required' => true,
        ),
        3 => 
        array (
          'name' => 'accounts_ida',
          'type' => 'varchar',
          'len' => 36,
        ),
        4 => 
        array (
          'name' => 'documents_idb',
          'type' => 'varchar',
          'len' => 36,
        ),
      ),
      'indices' => 
      array (
        0 => 
        array (
          'name' => 'accounts_documentsspk',
          'type' => 'primary',
          'fields' => 
          array (
            0 => 'id',
          ),
        ),
        1 => 
        array (
          'name' => 'accounts_documents_ida1',
          'type' => 'index',
          'fields' => 
          array (
            0 => 'accounts_ida',
          ),
        ),
        2 => 
        array (
          'name' => 'accounts_documents_idb2',
          'type' => 'index',
          'fields' => 
          array (
            0 => 'documents_idb',
          ),
        ),
        3 => 
        array (
          'name' => 'accounts_documents_alt',
          'type' => 'index',
          'fields' => 
          array (
            0 => 'accounts_ida',
            1 => 'documents_idb',
          ),
        ),
      ),
      'relationships' => 
      array (
        'accounts_documents' => 
        array (
          'lhs_module' => 'accounts',
          'lhs_table' => 'accounts',
          'lhs_key' => 'id',
          'rhs_module' => 'documents',
          'rhs_table' => 'documents',
          'rhs_key' => 'id',
          'relationship_type' => 'many-to-many',
          'join_table' => 'accounts_documents',
          'join_key_lhs' => 'accounts_ida',
          'join_key_rhs' => 'documents_idb',
        ),
      ),
    );
    ?>
    - Changed file 'vardefs.php' module 'Account':
    Code:
    $dictionary["Account"]["fields"]["documents"] = array (
      'name' => 'documents',
      'type' => 'link',
      'relationship' => 'accounts_documents',
      'source' => 'non-db',
    );
    - Changed file 'vardefs.php' module 'Documents':
    Code:
    $dictionary["Document"]["fields"]["accounts"] = array (
      'name' => 'accounts',
      'type' => 'link',
      'relationship' => 'accounts_documents',
      'source' => 'non-db',
    );
    - Changed file 'layoudefs.php' module 'Account':
    Code:
    $layout_defs["Accounts"]["subpanel_setup"]["documents"] = array (
      'order' => 100,
      'module' => 'Documents',
      'subpanel_name' => 'default',
      'get_subpanel_data' => 'documents',
      'add_subpanel_data' => 'documents_idb',
      'title_key' => 'lbl_documents',
    );
    - Changed file 'layoudefs.php' module 'Documents':
    Code:
    $layout_defs["Documents"]["subpanel_setup"]["accounts"] = array (
      'order' => 100,
      'module' => 'Accounts',
      'subpanel_name' => 'default',
      'get_subpanel_data' => 'accounts',
      'add_subpanel_data' => 'accounts_ida',
      'title_key' => 'LBL_ACCOUNTS_SUBPANEL_TITLE',
    );
    - Insert labels in the language file.

    When I sign in to SugarCRM and the tab 'Accounts' or' Documents' give me the following error: "Fatal error: Call to a member function getQuery () on a non-object in C: \ Wamp \ www \ Sugar5.0 \ data \ SugarBean.php online 2555 ":
    http://www.dibconsulting.com/sites/images/erro1.jpg


    I tried to clear the cache and subpanels already appear, but the relationship is wrong. For each document appear all accounts and each account appear all documents (attached image)
    http://www.dibconsulting.com/sites/images/error2.jpg


    How do I solve this problem?
    Fábio Brites
    <Sugar 6.>
    <Windows XP>

  2. #2
    fbrites is offline Sugar Community Member
    Join Date
    May 2008
    Location
    Lisbon, Portugal
    Posts
    77

    Default Re: Relationship between Modules

    Ok problem resolved! :-)

    In file 'sugarcrm.log' I found the error: "Error fetching relationship from cache."
    In Sugar Wiki I found the solution: http://www.sugarcrm.com/wiki/index.p...hip_from_cache
    I created and modified the files, had not established the relationship in the DB.
    I created the relationship in table 'relationships' DB and then with SugarCRM Admin, I 'Repair Relationships' and now I have everything to work correctly.
    If there is any doubt similar may ask.
    Thanks
    Fábio Brites
    <Sugar 6.>
    <Windows XP>

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. upgraded to 4.5.1e, received "Metadata for table tracker does not exist"
    By sfgeorge in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-09-03, 02:24 PM
  2. problemi step 6 di SugarSuite-Full-4.0.1h
    By lucia in forum Italiano
    Replies: 0
    Last Post: 2006-12-27, 08:50 AM
  3. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  4. Replies: 7
    Last Post: 2006-06-06, 07:56 PM
  5. Query erro after 4.0 upgrade
    By ldebernardini in forum Help
    Replies: 20
    Last Post: 2006-01-13, 05:10 PM

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
  •