dongnanke4106 2017-08-08 10:43
浏览 74
已采纳

sugarCRM:使用模块加载器创建关系,不安装包

I am trying to create relationships through module loader in SugarCRM. But the problem is my package is stopped installing after 55%. When I am viewing display log the error is:-

Failed to copy cache/upgrades/temp/SYWr9G/custom/metadata/accounts_contacts_1MetaData.php custom/metadata/accounts_contacts_1MetaData.php

I tried to change permissions also but at some point they through internal server error 500. Following are the code which I am using.

1.In manifest.php file :
    $installdefs = array(
        'id' => 'package_20170804',
        'copy' => array(
            0 => array(
                'from' => '<basepath>/accounts_contacts_1MetaData.php',
                'to' => 'custom/metadata/accounts_contacts_1MetaData.php',
                ),
            1 => array(
                'from' => '<basepath>/accounts_contacts_1.php',
                'to' => 'custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php',
                ),
            ),
        'relationships'=>array (
            array (
                'module'=> 'Accounts',
                'meta_data'=>'<basepath>/custom/metadata/accounts_contacts_1MetaData.php',
               'module_vardefs'=>'<basepath>/custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php'

                )
            ),
        );

2. In accounts_contacts_1MetaData.php file :

    <?php
    $dictionary["accounts_contacts_1"] = array (
      'true_relationship_type' => 'one-to-many',
      'from_studio' => true,
      'relationships' =>
      array (
        'accounts_contacts_1' =>
        array (
          'lhs_module' => 'Accounts',
          'lhs_table' => 'accounts',
          'lhs_key' => 'id',
          'rhs_module' => 'Contacts',
          'rhs_table' => 'contacts',
          'rhs_key' => 'id',
          'relationship_type' => 'many-to-many',
          'join_table' => 'accounts_contacts_1_c',
          'join_key_lhs' => 'accounts_contacts_1accounts_ida',
          'join_key_rhs' => 'accounts_contacts_1contacts_idb',
          ),
        ),
      'table' => 'accounts_contacts_1_c',
      '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_contacts_1accounts_ida',
          'type' => 'varchar',
          'len' => 36,
          ),
        4 =>
        array (
          'name' => 'accounts_contacts_1contacts_idb',
          'type' => 'varchar',
          'len' => 36,
          ),
        ),
      'indices' =>
      array (
        0 =>
        array (
          'name' => 'accounts_contacts_1spk',
          'type' => 'primary',
          'fields' =>
          array (
            0 => 'id',
            ),
          ),
        1 =>
        array (
          'name' => 'accounts_contacts_1_ida1',
          'type' => 'index',
          'fields' =>
          array (
            0 => 'accounts_contacts_1accounts_ida',
            ),
          ),
        2 =>
        array (
          'name' => 'accounts_contacts_1_alt',
          'type' => 'alternate_key',
          'fields' =>
          array (
            0 => 'accounts_contacts_1contacts_idb',
            ),
          ),
        ),
      ); 
3. In accounts_contacts_1.php file:

<?php
include('custom/metadata/accounts_contacts_1MetaData.php');
?>

I just wanted to create a field in relationship that's all . Maybe I am missing somewhere in manifest file or i needed to include some additional file.

  • 写回答

1条回答 默认 最新

  • dongsunny1113 2017-08-10 05:48
    关注

    I solved it. You can follow following steps to create relationships in SugarCRM through module loader.

    Step 1:- Give permission to your sugar directory according to following
    For Linux: http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Required_File_System_Permissions_on_Linux/
    For Windows:
    http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Required_File_System_Permissions_on_Windows_With_IIS/

    Step 2:- In manifest.php

    <?php
     $manifest = array(
        'acceptable_sugar_flavors' => array('CE','PRO','CORP','ENT','ULT'),
        'acceptable_sugar_versions' => array(
            'exact_matches' => array(),
            'regex_matches' => array('(.*?)\\.(.*?)\\.(.*?)$'),
            ),
        'author' => 'Ravi Ranjan',
        'description' => 'Relationship',
        'icon' => '',
        'is_uninstallable' => true,
        'name' => 'custom relation',
        'published_date' => '2017-08-10 2017 11:45:04',
        'type' => 'module',
        'version' => '20170810',
        );
    
     $installdefs = array(
        'id' => 'package_20170810',
        'copy' => array(
            0 => array(
                'from' => '<basepath>/accounts_contacts_1MetaData.php',
                'to' => 'custom/metadata/accounts_contacts_1MetaData.php',
                ),
    
            1 => array(
                'from' => '<basepath>/accounts_contacts_1.php',
                'to' => 'custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php',
                ),
    
            ),
    
        );
    
     ?>
    

    Step 3:- The contents of both file accounts_contacts_1MetaData.php and accounts_contacts_1.php will be same as you can see in question.

    Step 4:- Compress all three files and upload through module loader, after installation quick repair and rebuild.

    Go in Studio > Accounts > Relationships You will see a new field there name accounts_contacts_1 That's what I wanted to create.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮