2011-09-23 61 views
2

我想扩展联系人详细信息视图,以便关联帐户的详细信息视图出现在同一视图中。如何创建一个结合了2详细视图的SugarCRM视图

我的直觉是重写联系人详细信息视图的显示功能,并从那里创建帐户详细信息的实例并附加它的显示输出。

但我不知道是否有一个标准的方式拉这个。

回答

6

我了解到,在即将推出的版本(6.3)中,将会有一种生成可访问相关模块字段的计算字段的方法。

如果是这种情况,那么一个选项是创建引用帐户字段的计算字段,然后使用引用的帐户字段向联系人详细视图添加面板。

虽然,我原来的预感被证明是可行的,以及不作为哈克我曾以为起初:

<?php 
    require_once('include/MVC/View/views/view.detail.php'); 

    class ContactsViewDetail extends ViewDetail { 

    function ContactsViewDetail() { 
     parent::ViewDetail(); 
    } 

    function preDisplay(){ 
     parent::preDisplay(); 
     // Configuration to display All account info 
     $this->dv2 = new DetailView2(); 
     $this->dv2->ss =& $this->dv->ss; 
     $this->bean2 = new Account(); 
     $this->bean2->retrieve($this->bean->account_id); 
     $accountMetadataFile = 'custom/modules/Accounts/metadata/detailviewdefs.php'; 
     $accountTemplate = 'custom/modules/Accounts/tpls/AccountsDetailView.tpl'; 
     $this->dv2->setup('Accounts', $this->bean2, $accountMetadataFile, $accountTemplate); 
    } 

    function display(){ 
     parent::display(); 

     // Display Accounts information. 
     $this->dv2->process(); 
     echo $this->dv2->display(); 
    } 
    } 
?> 

总之

  1. 覆盖详细信息视图。
  2. 向当前视图添加新显示。
  3. 向视图添加一个新的bean(模块)。
  4. 使用新的bean处理显示。
  5. 回显示。
2

另一个更简单的选项可能只是添加一个iframe字段,该字段在其内部的帐户上加载detailview。不如漂亮,但少了很多黑客。

相关问题