Blogs
17
February
February
Greetings!
Today I came across a forum question which asked to hide "Closed Lost" opportunities from list view.
Simple steps and you are through!
Step 1: Create or edit custom/modules/Opportunities/views/view.list.php and add following code,
<?php
require_once('include/MVC/View/views/view.list.php');
class OpportunitiesViewList extends ViewList {
function listViewProcess() {
global $current_user;
$this->processSearchForm();
if(!$current_user->is_admin) // remove this condition if you dont want admin user to view the "Closed Lost" Opportunities.
$this->params['custom_where'] = ' AND opportunities.sales_stage <> "Closed Lost" ';
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();
}
}
}
require_once('include/MVC/View/views/view.list.php');
class OpportunitiesViewList extends ViewList {
function listViewProcess() {
global $current_user;
$this->processSearchForm();
if(!$current_user->is_admin) // remove this condition if you dont want admin user to view the "Closed Lost" Opportunities.
$this->params['custom_where'] = ' AND opportunities.sales_stage <> "Closed Lost" ';
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();
}
}
}
Step 2: Refresh list view!
P.S. Possible customizations in the query are:
> custom_select
> custom_from
> custom_where
> custom_order_by
Order by will be considered as second order by field when user clicks on other field to sort records.
> custom_select
> custom_from
> custom_where
> custom_order_by
Order by will be considered as second order by field when user clicks on other field to sort records.
Download attachments:
Comments
- No Comments Found.