jothi s

How to hard code the where condition in list view ,basic search,advance  search in sugar CE

Discussion created by jothi s on Sep 25, 2016

Actually i am new to sugarcrm and zend frame work too .if anything not able to understand my following question means comment here . Now I am go for my query actually .i need to add custom where clause in query .so i followed this one its works only for general list view when i use search or advance search its fetching all values .so how to add HARD CODE the  where condition in search and advance search in case module 

 

i don't want list the value " where source_c not like 'Social media'";  in general list view and search and advance search how to achieve this ? 

 

i followed this link https://developer.sugarcrm.com/2011/02/28/add-where-clause-for-listview-data-in-sugarcrm/ 

 

so i add this code in sugar/modules/Cases/views

 

view.list.php

<?php


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

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

// name of class match module
class CasesViewList extends ViewList{

// where clause that will be inserted in sql query
var $where = "source_c not like 'Social media'";   //this is my where clause 
//var $where = "";

function CasesViewList()
{
parent::ViewList();
}

/*
* Override listViewProcess with addition to where clause to exclude project templates
*/
function listViewProcess()
{

$this->processSearchForm(); // for search form
$this->lv->searchColumns = $this->searchForm->searchColumns;
if(!$this->headers)
return;
if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
$this->lv->ss->assign("SEARCH",true);
$this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params); // call the listview's file
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']); // save the last search
echo $this->lv->display();

}
}

}


?>

above code is working for general list view only . i need to hard code the where clause in search and advance search too . when i search don't need to list row " where source_c not like 'Social media'";  

 

Thanks advance 

Outcomes