【问题标题】:create one-to-many relationship with campaigns module in sugarcrm与 Sugarcrm 中的活动模块创建一对多关系
【发布时间】:2014-07-25 11:29:40
【问题描述】:

如何与我的自定义模块创建一对多关系。并将子面板添加到 Campaign 模块

活动变量定义

$dictionary["Campaign"]["fields"]["costs"] =
    array (
        'name' => 'costs',
        'type' => 'link',
        'relationship' => 'campaign_costs',
        'module'=>'Costs',
        'bean_name'=>'Costs',
        'source'=>'non-db',
        'vname'=>'LBL_AUCTIONS',
    );

$dictionary['Campaign']['relationships']['campaign_costs'] =
    array (
        'lhs_module'=> 'Campaigns',
        'lhs_table'=> 'campaigns',
        'lhs_key' => 'id',
        'rhs_module'=> 'Costs',
        'rhs_table'=> 'cots',
        'rhs_key' => 'campaign_id',
        'relationship_type'=>'one-to-many'
    );

layout_defs 属性

$layout_defs["Campaigns"]["subpanel_setup"]["campaign_costs"] = array (
    'order' => 2,
    'module' => 'Costs',
    'subpanel_name' => 'default',
    'sort_order' => 'desc',
    'sort_by' => 'date_entered',
    'title_key' => 'LBL_SUBPANEL_COSTS',
    'get_subpanel_data' => 'costs', //имя поля link
    'top_buttons' =>
        array (
            0 =>
                array (
                    'widget_class' => 'SubPanelTopButtonQuickCreate',
                ),
            1 =>
                array (
                    'widget_class' => 'SubPanelTopSelectButton',
                    'mode' => 'MultiSelect',
                ),
        ),
);

自定义模块 vardefs

$dictionary['Costs']['fields']['campaign_id'] =
  array (
      'required' => false,
      'name' => 'campaign_id',
      'vname' => '',
      'type' => 'id',
      'massupdate' => 0,
      'importable' => 'true',
      'audited' => 0,
      'len' => 36,
  );
$dictionary['Costs']['fields']['campaign_name'] =
  array (
      'required' => false,
      'source' => 'non-db',
      'name' => 'campaign_name',
      'vname' => 'LBL_CAMPAIGN_NAME',
      'type' => 'relate',
      'massupdate' => 0,
      'comments' => '',
      'help' => '',
      'audited' => 1,
      'len' => '100',
      'id_name' => 'campaign_id',
      'ext2' => 'Campaigns',
      'module' => 'Campaigns',
      'rname' => 'name',
      'studio' => 'visible',
  );

关系已添加,但子面板未出现在活动模块中。

【问题讨论】:

    标签: php relationship sugarcrm


    【解决方案1】:

    在您的 $dictionary["Campaign"]["fields"]["costs"] 中,将 bean_name 从 Costs 更改为 Cost

    我认为您在管理菜单中启用了子面板? (index.php?module=Administration&action=ConfigureTabs)

    您的错误日志是否说明了什么?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-15
      • 1970-01-01
      • 2017-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多