Where clause for module lists

I can see how to add a where clause to the History subpanel for each module (Tasks, Notes, etc) in subpaneldefs.php but would like to do something similar for the listview in the module themselves.

Could someone point me in the right direction?

Thanks

The solution I found was to add a condition to /include/ListView/LIstViewData.php (under function getListViewData) to check for a specific module and add the where condition under the following code:


           if(!is_array($params)) $params = array();
        if(!isset($params['custom_select'])) $params['custom_select'] = '';
        if(!isset($params['custom_from'])) $params['custom_from'] = '';
        if(!isset($params['custom_where'])) $params['custom_where'] = '';
        if(!isset($params['custom_order_by'])) $params['custom_order_by'] = '';

My condition:


        //MY EDIT
        if(!$current_user->is_admin && $this->seed->module_name == "Notes")
          {  $params['custom_where'] = " AND (notes.name  NOT LIKE 'Attachment' OR  notes.assigned_user_id ='{$current_user->id}' ) " ;} 
	//END MYEDIT

So if a user is not an Admin and the Module is “Notes”, then don’t show notes called “Attachment” unless that note is assigned to the current CRM user.