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

sugarCRM : creating relationship using module loader, package not installing

我正在尝试通过 SugarCRM 中的模块加载器创建关系。但问题是我的包在 55% 后停止安装。当我查看显示日志时,错误是:-

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

我也尝试更改权限,但在某些时候他们通过内部服务器错误 500。以下是我正在使用的代码。

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');
?>

我只想在关系中创建一个字段,仅此而已。也许我在清单文件中遗漏了某个地方,或者我需要包含一些额外的文件。

我解决了。您可以按照以下步骤通过模块加载器在 SugarCRM 中创建关系。

第 1 步:- 根据以下内容授予您的 sugar 目录权限
对于 Linux:http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Required_File_System_Permissions_on_Linux/
对于 Windows:
http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Required_File_System_Permissions_on_Windows_With_IIS/

第 2 步:- 在 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',
            ),

        ),

    );

 ?>

第 3 步:- 文件 accounts_contacts_1MetaData.php 和 accounts_contacts_1.php 的内容将与您在问题中看到的相同。

第 4 步:- 压缩所有三个文件并通过模块加载器上传,安装后快速修复和重建。

进入 Studio > Accounts > Relationships 您将在此处看到一个名为 accounts_contacts_1 的新字段。这就是我想要创建的内容。