[Vtigercrm-commits] [vtiger-commits] r5100 - in /vtigercrm/trunk: include/utils/SearchUtils.php modules/Leads/ListView.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Apr 13 07:50:45 EDT 2006


Author: saraj
Date: Thu Apr 13 05:50:39 2006
New Revision: 5100

Log:
Common function added for search

Modified:
    vtigercrm/trunk/include/utils/SearchUtils.php
    vtigercrm/trunk/modules/Leads/ListView.php

Modified: vtigercrm/trunk/include/utils/SearchUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/SearchUtils.php (original)
+++ vtigercrm/trunk/include/utils/SearchUtils.php Thu Apr 13 05:50:39 2006
@@ -415,4 +415,41 @@
 	return $where_string;
 }								
 
+function getWhereCondition($currentModule)
+{
+
+	if($_REQUEST['searchtype']=='advance')
+	{
+		$adv_string='';
+		if(isset($_REQUEST['search_cnt']))
+		$tot_no_criteria = $_REQUEST['search_cnt'];
+		if($_REQUEST['matchtype'] == 'all')
+		$matchtype = "or";
+		else
+		$matchtype = "and";
+
+		for($i=0; $i<=$tot_no_criteria; $i++)
+		{
+			if($i == $tot_no_criteria-1)
+			$matchtype= "";
+
+			$table_colname = 'Fields'.$i;
+			$search_condition = 'Condition'.$i;
+			$search_value = 'Srch_value'.$i;
+
+			$tab_col = str_replace('\'','',stripslashes($_REQUEST[$table_colname]));
+			$srch_cond = str_replace('\'','',stripslashes($_REQUEST[$search_condition]));
+			$srch_val = $_REQUEST[$search_value];
+			$adv_string .= " ".getSearch_criteria($srch_cond,$srch_val,$tab_col)." ".$matchtype;
+		}
+		$where=$adv_string;
+	}
+	else
+	{
+		$where=Search($currentModule);
+	}
+	return $where;
+
+}
+
 ?>

Modified: vtigercrm/trunk/modules/Leads/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Leads/ListView.php (original)
+++ vtigercrm/trunk/modules/Leads/ListView.php Thu Apr 13 05:50:39 2006
@@ -80,36 +80,7 @@
 
 if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
 {
-	if($_REQUEST['searchtype']=='advance')
-	{
-		$adv_string='';
-		if(isset($_REQUEST['search_cnt']))
-		$tot_no_criteria = $_REQUEST['search_cnt'];
-		if($_REQUEST['matchtype'] == 'all')
-			$matchtype = "or";
-		else
-			$matchtype = "and";
-		
-		for($i=0; $i<=$tot_no_criteria; $i++)
-		{
-			if($i == $tot_no_criteria-1)
-			$matchtype= "";
-			
-			$table_colname = 'Fields'.$i;
-			$search_condition = 'Condition'.$i;
-			$search_value = 'Srch_value'.$i;
-
-			$tab_col = str_replace('\'','',stripslashes($_REQUEST[$table_colname]));
-			$srch_cond = str_replace('\'','',stripslashes($_REQUEST[$search_condition]));
-			$srch_val = $_REQUEST[$search_value];
-			$adv_string .= " ".getSearch_criteria($srch_cond,$srch_val,$tab_col)." ".$matchtype;	
-		}
-		$where=$adv_string;
-	}
-	else
-	{
- 		$where=Search($currentModule);
-	}
+	$where = getWhereCondition($currentModule);
 	// we have a query
 	$url_string .="&query=true";
 





More information about the vtigercrm-commits mailing list