How to get search form data in a ListView?

Hello.

I'm using SugarCRM Community 6.5.20.

I'm extending a listview query for a custom module.

In the listview search form there is a multi-select dropdown, which I want to get its selected values everytime the listview is loaded.

I want to put a "if" condition to customize the query parameter only if the multi-select dropdown has certain option selected.

There is a way to get listview search fields and its selected values in the view.list.php?

Or the only way to get the data I need is through a Logic Hook?

There is my view.list.php with the custom query ($this->params):

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

class PP_Pedido_ProdutoViewList extends ViewList {
    function listViewProcess() {
        global $current_user;
        $this->processSearchForm();
        $this->params['custom_where'] = " AND pp_pedido_produto.status NOT IN ('f', 'c')";
       
        if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
            $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
            echo $this->lv->display();
        }
    }
}
?>

Any help would be appreciated.

Thanks.

  • Nevermind, I found a way to solve this:

    // Going through arrays until I found the specified array key and value:

    $status_options = $this->searchForm->searchFields['status']['value'];

    // Condition needed:

    if (!in_array('c', $status_options) && !in_array('f', $status_options)) {

                $this->params['custom_where'] = " AND pp_pedido_produto.status NOT IN ('f', 'c')";

            }

    Thanks.