[Solved] Remove Sub-Accounts from Default List View

Please pardon the rookie question. I’m 90% certain this is a .php question, and I’m a stranger in a strange land.

Any recommendations on a way to “hide” sub-accounts from the account list? Most of our accounts have multiple locations, but all role up into the parent account. I’d like to hide “SubAccounts” from the list view. Basically, hide the result in the list view if MemberOf is not blank.

I seem to find conflicting information between modules/Accounts/AccountsListViewSmarty.php and modules/Accounts/views/view.list.php ; Any insight of how to achieve this is greatly appreciated.

Create or edit custom/modules/Accounts/views/view.list.php and add following code,

<?php

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

class AccountsViewList extends ViewList {

    function listViewProcess() {
        global $current_user;
        $this->processSearchForm();
        $this->params['custom_where'] = ' AND accounts.parent_id = "" ';
      
        if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
            $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
            $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
            echo $this->lv->display();
        }
    }

}

The Params supports following keys that can be customised.

custom_select
custom_from
custom_where
custom_order_by

2 Likes

Thank you, cherub-chum, You’ve gotten me so much father then I thought I would be. I feel like I’m so close, but oh, so far.

I understand the basic theory, we’re doing here, but I’ve got something wrong, either in Syntax, or my understanding of your directions. I get a generic error when trying to go to my account list.

I don’t see an /MVC/ path in my install. Is that a Literal, or does that get translated somewhere?
I’m checking a 17th time for typos… (I made enough of them, I"m sure.) Any additional insight?

cherub-chum 's solution should work. Can you explain what error are you facing?
Did you created/edited the file custom/modules/Accounts/views/view.list.php ?
For any errors please refer the suitecrm.log on the root directory of crm. Also check for apache php log.

urdhavatech:

Thanks for the help. PHP was reporting a syntax error with the { in line 12. which is the if (empty…) statement., which lead me to a missing ) in that line.

THANK YOU BOTH!