如何在SuiteCRM中覆盖弹出列表视图查询(listViewProcess)?

时间:2017-01-12 16:28:08

标签: php sugarcrm suitecrm

我正在尝试显示某个WHERE子句的弹出列表视图,但是我的代码似乎没有被执行?

这就是我在自定义/ MODULE_NAME / views / view.popup.php中的内容:

<?php

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

class CustomRegistrationMetaViewPopup extends ViewPopup{

    public function listViewProcess(){

        parent::listViewProcess();

        $this->params['custom_select'] = "select * ";
        $this->params['custom_from'] = "from table ";
        $this->where .= "where condition = 'Verified'";
    }

    function CustomRegistrationMetaViewPopup(){
        parent::ViewPopup();
    }

    function preDisplay(){
        parent::preDisplay();
    }
}

我的功能永远不会被调用。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

您正在尝试覆盖listview中提供的 listViewProcess 功能。文件的正确位置是: custom \ modules \ MODULE_NAME \ views \ view.list.php

以下是帮助代码:

public class MainActivity extends AppCompatActivity {

    private TextView _screen;
    private TextView _result;
    private String display = "";
    private String currentOperator;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        _screen = (TextView) findViewById(R.id.txtScreen);
        _result = (TextView) findViewById(R.id.id_result);
    }

    public void updateScreen() {
        _screen.setText(display);
    }

    public void onClickNumber(View v) {
        Button b = (Button) v;
        display += b.getText();
        updateScreen();
    }

    public void onClickOperator(View v) {
        Button b = (Button) v;
        display += b.getText();
        currentOperator = b.getText().toString();
        updateScreen();
    }

    public void clear() {
        display = "";
        currentOperator = "";
    }

    public void onClickClear(View view) {
        clear();
        updateScreen();
    }

    public double operate(String a, String op, String b) {
        switch (op) {
            case "+":
                return Double.valueOf(a) + Double.valueOf(b);
            case "-":
                return Double.valueOf(a) - Double.valueOf(b);
            case "*":
                return Double.valueOf(a) * Double.valueOf(b);
            case "/":
                return Double.valueOf(a) / Double.valueOf(b);
            default:
                return -1;
        }
    }

    public void onClickEqual(View v) {
        String[] operation = display.split(Pattern.quote(currentOperator));
        _result.setText(String.valueOf(operate(operation[0], currentOperator,  operation[1])));
    }
}