4

我正在使用 SugarCRM 开发用于客户管理的软件。我从带有自定义字段的基本模板创建了一个自定义模块。是否可以摆脱 SugarCRM db 并通过外部 Web 服务执行 CRUD 操作?实际上,我可以通过设置自定义控制器的 bean 属性在 datailview 中显示 Web 服务数据。

class CustomerController extends SugarController{

public function action_detailview(){

        $customer = new Customer();
        $customer = getCustomerFromWebService();
        $this->bean = $customer;
        $this->view = "detail";

    }

}

我想用listview做同样的事情,但我不知道如何设置默认listview使用的列表(如果存在)的记录。

4

1 回答 1

0

您可以通过使用以下代码在 custom/modules/modulename/views/view.list.php 中自定义 view.list.php 来更改列表视图:

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('include/MVC/View/views/view.list.php');

// name of class match module
class modulenameViewList extends ViewList{

    // where clause that will be inserted in sql query
    var $where = 'like 'htc'';
    function modulenameViewList()
    {
        parent::ViewList();
    }

    /*
     * Override listViewProcess with addition to where clause to exclude project templates
     */
    function listViewProcess()
    {
            $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
            echo $this->lv->display();
    }

}

?>
于 2016-07-07T12:35:59.323 回答