[Vtigercrm-commits] [vtiger-commits] r10928 - in /vtigercrm/branches/5.0.3: Smarty/templates/ListView.tpl include/js/general.js include/language/en_us.lang.php include/utils/SearchUtils.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue May 15 08:29:33 EDT 2007


Author: saraj
Date: Tue May 15 06:29:21 2007
New Revision: 10928

Log:
Fixes #3762 and #3753

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/ListView.tpl
    vtigercrm/branches/5.0.3/include/js/general.js
    vtigercrm/branches/5.0.3/include/language/en_us.lang.php
    vtigercrm/branches/5.0.3/include/utils/SearchUtils.php

Modified: vtigercrm/branches/5.0.3/Smarty/templates/ListView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/ListView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/ListView.tpl Tue May 15 06:29:21 2007
@@ -16,6 +16,106 @@
 <script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
 <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">
+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>&nbsp;"+alert_arr.LBL_AND;
+	else
+		$("and"+sel.id).innerHTML =  "<em old='(yyyy-mm-dd)'>("+$("user_dateformat").value+")</em>&nbsp;";
+    }
+    else {
+	$("and"+sel.id).innerHTML =  "";
+	if(sel.id != "fcol5")
+		$("and"+sel.id).innerHTML =  "&nbsp;"+alert_arr.LBL_AND;
+	else
+		$("and"+sel.id).innerHTML =  "&nbsp;";
+    } 	
+*/
+    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>
 {if $MODULE eq 'Contacts'}
 <div id="dynloadarea" style="z-index:100000001;float:left;position:absolute;left:350px;top:150px;"></div>
 {/if}
@@ -145,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>&nbsp;&nbsp;-->
 		</td>
 		<td class="small" nowrap align=right><b>{$APP.LBL_SEARCH_FOR}</b></td>
@@ -202,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/js/general.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/general.js (original)
+++ vtigercrm/branches/5.0.3/include/js/general.js Tue May 15 06:29:21 2007
@@ -1370,7 +1370,7 @@
 
     var colthree = row.insertCell(2);
 
-    colone.innerHTML="<select id='Fields"+count+"' name='Fields"+count+"' class='detailedViewTextBox'>"+option_values+"</select>";
+    colone.innerHTML="<select id='Fields"+count+"' name='Fields"+count+"' onchange=\"updatefOptions(this, 'Condition"+count+"')\" class='detailedViewTextBox'>"+option_values+"</select>";
 
     coltwo.innerHTML="<select id='Condition"+count+"' name='Condition"+count+"' class='detailedViewTextBox'>"+criteria_values+"</select> ";
 

Modified: vtigercrm/branches/5.0.3/include/language/en_us.lang.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/language/en_us.lang.php (original)
+++ vtigercrm/branches/5.0.3/include/language/en_us.lang.php Tue May 15 06:29:21 2007
@@ -646,16 +646,17 @@
 'individual'=>'individual',
 
 //Added for values of picklist in Advanced Search filter
+//Modified for 5.0.3 GA release
 'contains'=>'contains',
-'does not contains'=>'does not contains',
+'does_not_contains'=>'does not contains',
 'is'=>'is',
-'is not'=>'is not',
-'begins with'=>'begins with',
-'ends with'=>'ends with',
-'greater than'=>'greater than',
-'less than'=>'less than',
-'greater or equal'=>'greater or equal',
-'less or equal'=>'less or equal',
+'is_not'=>'is not',
+'begins_with'=>'begins with',
+'ends_with'=>'ends with',
+'greater_than'=>'greater than',
+'less_than'=>'less than',
+'greater_or_equal'=>'greater or equal',
+'less_or_equal'=>'less or equal',
 
 //For Product Details
 'LABEL_SET_DISCOUNT_FOR_COLON'=>'Set Discount for :',

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 15 06:29:21 2007
@@ -74,6 +74,8 @@
 		{
 			$field_list .= ', ';
 		}
+		if($fieldname == "accountname")
+			$fieldname = "account_id";
 		$field_list .= "'".$fieldname."'";
 		$j++;
 	}
@@ -306,7 +308,9 @@
 			$search_field = "parent_id";
 		}
 		//Check ends
-		if(($module == "Calendar" || $module == "Invoice" || $module == "SalesOrder" || $module== "PurchaseOrder") && ($search_field == "contact_id"))
+		
+		//Added to search contact name by lastname
+		if(($module == "Calendar" || $module == "Invoice" || $module == "Notes" || $module == "SalesOrder" || $module== "PurchaseOrder") && ($search_field == "contact_id"))
 	       {
 	                 $module = 'Contacts';
 	                 $search_field = 'lastname';
@@ -446,6 +450,7 @@
 		$fieldtablename = $adb->query_result($result,$i,"tablename");
 		$fieldcolname = $adb->query_result($result,$i,"columnname");
 		$block = $adb->query_result($result,$i,"block");
+		$fieldtype = $adb->query_result($result,$i,"typeofdata");
 		$fieldtype = explode("~",$fieldtype);
 		$fieldtypeofdata = $fieldtype[0];
 		$fieldlabel = $mod_strings[$adb->query_result($result,$i,"fieldlabel")];
@@ -479,14 +484,14 @@
 				$select_flag = "selected";
 
 			if($fieldlabel == "Product Code")
-				$OPTION_SET .= "<option value=\'".$fieldtablename.".".$fieldcolname."\'".$select_flag.">".$mod_strings[$fieldlabel]."</option>";
+				$OPTION_SET .= "<option value=\'".$fieldtablename.".".$fieldcolname."::::".$fieldtypeofdata."\'".$select_flag.">".$mod_strings[$fieldlabel]."</option>";
 			elseif($fieldcolname == "contactid" || $fieldcolname == "contact_id")
 			{
-				$OPTION_SET .= "<option value=\'vtiger_contactdetails.lastname\' ".$select_flag.">".$app_strings['LBL_CONTACT_LAST_NAME']."</option>";
-				$OPTION_SET .= "<option value=\'vtiger_contactdetails.firstname\'>".$app_strings['LBL_CONTACT_FIRST_NAME']."</option>";
+				$OPTION_SET .= "<option value=\'vtiger_contactdetails.lastname::::".$fieldtypeofdata."\' ".$select_flag.">".$app_strings['LBL_CONTACT_LAST_NAME']."</option>";
+				$OPTION_SET .= "<option value=\'vtiger_contactdetails.firstname::::".$fieldtypeofdata."\'>".$app_strings['LBL_CONTACT_FIRST_NAME']."</option>";
 			}
 			elseif($fieldcolname == "campaignid")
-				$OPTION_SET .= "<option value=\'vtiger_campaign.campaignname\' ".$select_flag.">".$mod_strings[$fieldlabel]."</option>";
+				$OPTION_SET .= "<option value=\'vtiger_campaign.campaignname::::".$fieldtypeofdata."\' ".$select_flag.">".$mod_strings[$fieldlabel]."</option>";
 			else
 				$OPTION_SET .= "<option value=\'".$fieldtablename.".".$fieldcolname."\' ".$select_flag.">".$fieldlabel."</option>";
 		}
@@ -494,12 +499,12 @@
 	//Added to include Ticket ID in HelpDesk advance search
 	if($module == 'HelpDesk')
 	{
-		$OPTION_SET .= "<option value=\'vtiger_crmentity.crmid\'>".$mod_strings['Ticket ID']."</option>";
+		$OPTION_SET .= "<option value=\'vtiger_crmentity.crmid::::".$fieldtypeofdata."\'>".$mod_strings['Ticket ID']."</option>";
 	}
 	//Added to include activity type in activity advance search
 	if($module == 'Activities')
 	{
-		$OPTION_SET .= "<option value=\'vtiger_activity.activitytype\'>".$mod_strings['Activity Type']."</option>";
+		$OPTION_SET .= "<option value=\'vtiger_activity.activitytype::::".$fieldtypeofdata."\'>".$mod_strings['Activity Type']."</option>";
 	}
 	$log->debug("Exiting getAdvSearchfields method ...");
 	return $OPTION_SET;
@@ -514,7 +519,7 @@
 {
 	global $log,$app_strings;
 	$log->debug("Entering getcriteria_options() method ...");
-	$CRIT_OPT = "<option value=\'cts\'>".$app_strings['contains']."</option><option value=\'dcts\'>".$app_strings['does not contains']."</option><option value=\'is\'>".$app_strings['is']."</option><option value=\'isn\'>".$app_strings['is not']."</option><option value=\'bwt\'>".$app_strings['begins with']."</option><option value=\'ewt\'>".$app_strings['ends with']."</option><option value=\'grt\'>".$app_strings['greater than']."</option><option value=\'lst\'>".$app_strings['less than']."</option><option value=\'grteq\'>".$app_strings['greater or equal']."</option><option value=\'lsteq\'>".$app_strings['less or equal']."</option>";
+	$CRIT_OPT = "<option value=\'cts\'>".$app_strings['contains']."</option><option value=\'dcts\'>".$app_strings['does_not_contains']."</option><option value=\'is\'>".$app_strings['is']."</option><option value=\'isn\'>".$app_strings['is_not']."</option><option value=\'bwt\'>".$app_strings['begins_with']."</option><option value=\'ewt\'>".$app_strings['ends_with']."</option><option value=\'grt\'>".$app_strings['greater_than']."</option><option value=\'lst\'>".$app_strings['less_than']."</option><option value=\'grteq\'>".$app_strings['greater_or_equal']."</option><option value=\'lsteq\'>".$app_strings['less_or_equal']."</option>";
 	$log->debug("Exiting getcriteria_options method ...");
 	return $CRIT_OPT;
 }
@@ -543,7 +548,7 @@
 			$where_string = $searchfield." like '%".$searchstring."%' ";
 			if($searchstring == NULL)
 				if($searchfield !='vtiger_products.productname')
-					$where_string = $searchfield." like '%%'";
+					$where_string = $searchfield." like ''";
 				else
 					$where_string = $searchfield." is NULL";
 			break;
@@ -625,7 +630,8 @@
 			$search_condition = 'Condition'.$i;
 			$search_value = 'Srch_value'.$i;
 
-			$tab_col = str_replace('\'','',stripslashes($_REQUEST[$table_colname]));
+			list($tab_col_val,$typeofdata) = split("::::",$_REQUEST[$table_colname]);
+			$tab_col = str_replace('\'','',stripslashes($tab_col_val));
 			$srch_cond = str_replace('\'','',stripslashes($_REQUEST[$search_condition]));
 			$srch_val = addslashes($_REQUEST[$search_value]);
 			$srch_val = function_exists(iconv) ? @iconv("UTF-8",$default_charset,$srch_val) : $srch_val;





More information about the vtigercrm-commits mailing list