[Vtigercrm-commits] [vtiger-commits] r10957 - in /vtigercrm/branches/5.0.3: Smarty/templates/ActivityListView.tpl include/utils/SearchUtils.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue May 22 08:47:23 EDT 2007
Author: saraj
Date: Tue May 22 06:46:57 2007
New Revision: 10957
Log:
Campaign module Search issue. Fixes #3895
Modified:
vtigercrm/branches/5.0.3/Smarty/templates/ActivityListView.tpl
vtigercrm/branches/5.0.3/include/utils/SearchUtils.php
Modified: vtigercrm/branches/5.0.3/Smarty/templates/ActivityListView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/ActivityListView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/ActivityListView.tpl Tue May 22 06:46:57 2007
@@ -17,6 +17,107 @@
<script language="JavaScript" type="text/javascript" src="include/js/ListView.js"></script>
<script language="JavaScript" type="text/javascript" src="include/js/search.js"></script>
<script language="JavaScript" type="text/javascript" src="modules/{$MODULE}/{$MODULE}.js"></script>
+<script language="javascript" type="text/javascript">
+var typeofdata = new Array();
+typeofdata['V'] = ['is','isn','bwt','ewt','cts','dcts'];
+typeofdata['N'] = ['is','isn','lst','grt','lsteq','grteq'];
+typeofdata['T'] = ['is','isn','lst','grt','lsteq','grteq'];
+typeofdata['I'] = ['is','isn','lst','grt','lsteq','grteq'];
+typeofdata['C'] = ['is','isn'];
+typeofdata['DT'] = ['is','isn','lst','grt','lsteq','grteq'];
+typeofdata['D'] = ['is','isn','lst','grt','lsteq','grteq'];
+var fLabels = new Array();
+fLabels['is'] = '{$APP.is}';
+fLabels['isn'] = '{$APP.is_not}';
+fLabels['bwt'] = '{$APP.begins_with}';
+fLabels['ewt'] = '{$APP.ends_with}';
+fLabels['cts'] = '{$APP.contains}';
+fLabels['dcts'] = '{$APP.does_not_contains}';
+fLabels['lst'] = '{$APP.less_than}';
+fLabels['grt'] = '{$APP.greater_than}';
+fLabels['lsteq'] = '{$APP.less_or_equal}';
+fLabels['grteq'] = '{$APP.greater_or_equal}';
+var noneLabel;
+{literal}
+function trimfValues(value)
+{
+ var string_array;
+ string_array = value.split(":");
+ return string_array[4];
+}
+
+function updatefOptions(sel, opSelName) {
+ var selObj = document.getElementById(opSelName);
+ var fieldtype = null ;
+
+ var currOption = selObj.options[selObj.selectedIndex];
+ var currField = sel.options[sel.selectedIndex];
+
+ var fld = currField.value.split(":");
+ var tod = fld[4];
+ /* if(fld[4] == 'D' || (fld[4] == 'T' && fld[1] != 'time_start' && fld[1] != 'time_end') || fld[4] == 'DT')
+ {
+ $("and"+sel.id).innerHTML = "";
+ if(sel.id != "fcol5")
+ $("and"+sel.id).innerHTML = "<em old='(yyyy-mm-dd)'>("+$("user_dateformat").value+")</em> "+alert_arr.LBL_AND;
+ else
+ $("and"+sel.id).innerHTML = "<em old='(yyyy-mm-dd)'>("+$("user_dateformat").value+")</em> ";
+ }
+ else {
+ $("and"+sel.id).innerHTML = "";
+ if(sel.id != "fcol5")
+ $("and"+sel.id).innerHTML = " "+alert_arr.LBL_AND;
+ else
+ $("and"+sel.id).innerHTML = " ";
+ }
+*/
+ if(currField.value != null && currField.value.length != 0)
+ {
+ fieldtype = trimfValues(currField.value);
+ fieldtype = fieldtype.replace(/\\'/g,'');
+ ops = typeofdata[fieldtype];
+ var off = 0;
+ if(ops != null)
+ {
+
+ var nMaxVal = selObj.length;
+ for(nLoop = 0; nLoop < nMaxVal; nLoop++)
+ {
+ selObj.remove(0);
+ }
+ /* selObj.options[0] = new Option ('None', '');
+ if (currField.value == '') {
+ selObj.options[0].selected = true;
+ }*/
+ for (var i = 0; i < ops.length; i++)
+ {
+ var label = fLabels[ops[i]];
+ if (label == null) continue;
+ var option = new Option (fLabels[ops[i]], ops[i]);
+ selObj.options[i] = option;
+ if (currOption != null && currOption.value == option.value)
+ {
+ option.selected = true;
+ }
+ }
+ }
+ }else
+ {
+ var nMaxVal = selObj.length;
+ for(nLoop = 0; nLoop < nMaxVal; nLoop++)
+ {
+ selObj.remove(0);
+ }
+ selObj.options[0] = new Option ('None', '');
+ if (currField.value == '') {
+ selObj.options[0].selected = true;
+ }
+ }
+
+}
+{/literal}
+</script>
+
<script language="javascript">
function checkgroup()
{ldelim}
@@ -144,7 +245,7 @@
<table width="80%" cellpadding="5" cellspacing="0" class="searchUIBasic small" align="center" border=0>
<tr>
<td class="searchUIName small" nowrap align="left">
- <span class="moduleName">{$APP.LBL_SEARCH}</span><br><span class="small"><a href="#" onClick="fnhide('searchAcc');show('advSearch');document.basicSearch.searchtype.value='advance';">{$APP.LBL_GO_TO} {$APP.LNK_ADVANCED_SEARCH}</a></span>
+ <span class="moduleName">{$APP.LBL_SEARCH}</span><br><span class="small"><a href="#" onClick="fnhide('searchAcc');show('advSearch');updatefOptions(document.getElementById('Fields0'), 'Condition0');document.basicSearch.searchtype.value='advance';">{$APP.LBL_GO_TO} {$APP.LNK_ADVANCED_SEARCH}</a></span>
<!-- <img src="{$IMAGE_PATH}basicSearchLens.gif" align="absmiddle" alt="{$APP.LNK_BASIC_SEARCH}" title="{$APP.LNK_BASIC_SEARCH}" border=0> -->
</td>
<td class="small" nowrap align=right><b>{$APP.LBL_SEARCH_FOR}</b></td>
@@ -201,13 +302,9 @@
<td align=left>
<table width="100%" border="0" cellpadding="2" cellspacing="0" id="adSrc" align="left">
<tr >
- <td width="31%"><select name="Fields0" class="detailedViewTextBox">
- {$FIELDNAMES}
- </select>
+ <td width="31%"><select name="Fields0" id="Fields0" class="detailedViewTextBox" onchange="updatefOptions(this, 'Condition0')">{$FIELDNAMES}</select>
</td>
- <td width="32%"><select name="Condition0" class="detailedViewTextBox">
- {$CRITERIA}
- </select>
+ <td width="32%"><select name="Condition0" id="Condition0" class="detailedViewTextBox">{$CRITERIA}</select>
</td>
<td width="32%"><input type="text" name="Srch_value0" class="detailedViewTextBox"></td>
</tr>
Modified: vtigercrm/branches/5.0.3/include/utils/SearchUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/SearchUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/SearchUtils.php Tue May 22 06:46:57 2007
@@ -293,6 +293,7 @@
global $log;
$log->debug("Entering BasicSearch(".$module.",".$search_field.",".$search_string.") method ...");
global $adb;
+ $search_string = ltrim(rtrim($search_string));
global $column_array,$table_col_array;
if($search_field =='crmid')
{
@@ -322,8 +323,9 @@
$noofrows = $adb->num_rows($result);
if($noofrows!=0)
{
- $column_name=$adb->query_result($result,0,'columnname');
-
+ $column_name=$adb->query_result($result,0,'columnname');
+
+
//Check added for tickets by accounts/contacts in dashboard
if ($column_name == 'parent_id')
{
@@ -334,8 +336,19 @@
//Check ends
$table_name=$adb->query_result($result,0,'tablename');
+ $uitype=getUItype($module,$column_name);
+
+ //Added to support user date format in basic search
+ if($uitype == 5 || $uitype == 6 || $uitype == 23 || $uitype == 70)
+ {
+ list($sdate,$stime) = split(" ",$search_string);
+ if($stime !='')
+ $search_string = getDBInsertDateValue($sdate)." ".$stime;
+ else
+ $search_string = getDBInsertDateValue($sdate);
+ }
+ echo $search_string;
// Added to fix errors while searching check box type fields(like product active. ie. they store 0 or 1. we search them as yes or no) in basic search.
- $uitype=getUItype($module,$column_name);
if ($uitype == 56)
{
if(stristr($search_string,'yes'))
@@ -538,10 +551,13 @@
global $log;
$log->debug("Entering getSearch_criteria(".$criteria.",".$searchstring.",".$searchfield.") method ...");
$searchstring = ltrim(rtrim($searchstring));
- if($searchfield == "vtiger_crmentity.modifiedtime" || $searchfield == "vtiger_crmentity.createdtime")
+ if($searchfield == "vtiger_crmentity.modifiedtime" || $searchfield == "vtiger_crmentity.createdtime" || stristr($searchfield,'date'))
{
list($sdate,$stime) = split(" ",$searchstring);
- $searchstring = getDBInsertDateValue($sdate)." ".$stime;
+ if($stime !='')
+ $searchstring = getDBInsertDateValue($sdate)." ".$stime;
+ else
+ $searchstring = getDBInsertDateValue($sdate);
}
$where_string = '';
switch($criteria)
More information about the vtigercrm-commits
mailing list