[Vtigercrm-commits] [vtiger-commits] r4505 - /vtigercrm/trunk/include/CustomFieldUtil.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Mar 28 00:08:36 EST 2006


Author: saraj
Date: Mon Mar 27 22:08:32 2006
New Revision: 4505

Log:
junk code has been removed and changes made for multiselectcombo box

Modified:
    vtigercrm/trunk/include/CustomFieldUtil.php

Modified: vtigercrm/trunk/include/CustomFieldUtil.php
==============================================================================
--- vtigercrm/trunk/include/CustomFieldUtil.php (original)
+++ vtigercrm/trunk/include/CustomFieldUtil.php Mon Mar 27 22:08:32 2006
@@ -12,6 +12,11 @@
 require_once('include/database/PearDatabase.php');
 require_once('include/utils/utils.php');
 
+/**
+ * Function to get field typename
+ * @param $uitype :: uitype -- Type integer
+ * returns the field type name -- Type string
+ */
 function getCustomFieldTypeName($uitype)
 {
 	global $log;
@@ -73,215 +78,11 @@
 	return $fldname;
 }
 
-
-function CustomFieldEditView($id, $fldModule, $tableName, $colidName, $app_strings, $theme)
-{
-
-	global $adb;
-	//Custom Field Addition
-	$dbquery = "select  * from field where tablename='".$fldModule."'";
-	$result = $adb->query($dbquery);
-	if($adb->num_rows($result) != 0)
-	{
-		if(isset($id))
-		{
-			$custquery = 'select * from '.$tableName.' where '.$colidName."='".$id."'";
-			$cust_result = $adb->query($custquery);
-		}
-		$noofrows = $adb->num_rows($result);
-
-		$custfld = '<table width="100%" border="0" cellspacing="1" cellpadding="0">';
-		$custfld .= '<tr><th align="left" class="formSecHeader" colspan="4">Custom Information</th></tr>';
-		for($i=0; $i<$noofrows; $i++)
-		{
-			$colName=$adb->query_result($result,$i,"fieldlabel");
-			$setName=$adb->query_result($result,$i,"column_name");
-			$uitype=$adb->query_result($result,$i,"uitype");
-			if(isset($id) && $adb->num_rows($cust_result) != 0)
-			{
-				$value=$adb->query_result($cust_result,0,strtolower($setName));
-			}
-			else
-			{
-				$value='';
-			}
-			$custfld .= '<tr>
-				<td width="20%" class="dataLabel">'.$colName.':</td>';
-			if($uitype == 5)
-			{
-				$date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
-				$custfld .= '<td width="30%"><input name="'.$setName.'" id="jscal_field_'.$setName.'" type="text" tabindex="2" size="11" maxlength="10" value="'.$value.'"> <img src="themes/'.$theme.'/images/calendar.gif" id="jscal_trigger_'.$setName.'"> <font size=1><em old="(yyyy-mm-dd)">(yyyy-mm-dd)</em></font></td>';
-				$custfld .= '<script type="text/javascript">';
-				$custfld .= 'Calendar.setup ({';
-						$custfld .= 'inputField : "jscal_field_'.$setName.'", ifFormat : "'.$date_format.'", showsTime : false, button : "jscal_trigger_'.$setName.'", singleClick : true, step : 1';
-						$custfld .= '});';
-				$custfld .= '</script>';
-			}
-			elseif($uitype == 15)
-			{
-				$pick_query="select * from ".$fldModule."_".$setName;
-				$pickListResult = $adb->query($pick_query);
-				$noofpickrows = $adb->num_rows($pickListResult);
-				$custfld .= '<td width="30%"><select name="'.$setName.'" tabindex="1">';
-				for($j = 0; $j < $noofpickrows; $j++)
-				{
-					$pickListValue=$adb->query_result($pickListResult,$j,strtolower($setName));
-					
-					if($value == $pickListValue)
-					{
-						$chk_val = "selected";	
-					}
-					else
-					{	
-						$chk_val = '';	
-					}
-					
-					$custfld .= '<OPTION value="'.$pickListValue.'" '.$chk_val.'>'.$pickListValue.'</OPTION>';
-				}
-				$custfld .= '</td>';
-			}
-			else
-			{
-
-				$custfld .= '<td width="30%"><input name="'.$setName.'" type="text" tabindex="'.$i.'" size="25" maxlength="25" value="'.$value.'"></td>';
-			}
-			$i++;
-			if($i<$noofrows)
-			{
-				$colName=$adb->query_result($result,$i,"fieldlabel");
-				$setName=$adb->query_result($result,$i,"column_name");
-				$uitype=$adb->query_result($result,$i,"uitype");
-				if(isset($id) && $adb->num_rows($cust_result) != 0)
-				{
-					$value=$adb->query_result($cust_result,0,$setName);
-				}
-				else
-				{
-					$value='';
-				}
-				$custfld .= '<td width="20%" class="dataLabel">'.$colName.':</td>';
-				if($uitype == 5)
-				{
-					$date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
-					$custfld .= '<td width="30%"><input name="'.$setName.'" id="jscal_field_'.$setName.'" type="text" tabindex="2" size="11" maxlength="10" value="'.$value.'"> <img src="themes/'.$theme.'/images/calendar.gif" id="jscal_trigger_'.$setName.'"> <font size=1><em old="(yyyy-mm-dd)">(yyyy-mm-dd)</em></font></td>';
-					$custfld .= '<script type="text/javascript">';
-					$custfld .= 'Calendar.setup ({';
-							$custfld .= 'inputField : "jscal_field_'.$setName.'", ifFormat : "'.$date_format.'", showsTime : false, button : "jscal_trigger_'.$setName.'", singleClick : true, step : 1';
-							$custfld .= '});';
-					$custfld .= '</script>';
-
-				}
-				elseif($uitype == 15)
-				{
-					$pick_query="select * from ".$fldModule."_".$setName;
-					$pickListResult = $adb->query($pick_query);
-					$noofpickrows = $adb->num_rows($pickListResult);
-					$custfld .= '<td width="30%"><select name="'.$setName.'" tabindex="1">';
-					for($j = 0; $j < $noofpickrows; $j++)
-					{
-						$pickListValue=$adb->query_result($pickListResult,$j,strtolower($setName));
-
-						if($value == $pickListValue)
-						{
-							$chk_val = "selected";	
-						}
-						else
-						{	
-							$chk_val = '';	
-						}
-
-						$custfld .= '<OPTION value="'.$pickListValue.'" '.$chk_val.'>'.$pickListValue.'</OPTION>';
-					}
-					$custfld .= '</td>';
-				}
-				else
-				{
-					$custfld .= '<td width="30%"><input name="'.$setName.'" type="text" tabindex="'.$i.'" size="25" maxlength="25" value="'.$value.'"></td>';
-				}
-			}
-
-			$custfld .= '<tr>';
-
-		}
-		$custfld .= '</table>';
-		return $custfld;
-
-	}
-}
-
-function CustomFieldDetailView($id, $fldModule, $tableName, $colidName)
-{
-	global $adb;
-	//Assigning custom field values
-	$dbquery = "select  * from field where tablename='".$fldModule."'";
-	$result = $adb->query($dbquery);
-	$adb->println($result);
-	if($adb->num_rows($result) != 0)
-	{
-		$custquery = 'select * from '.$tableName.' where '.$colidName."='".$id."'";
-		$cust_result = $adb->query($custquery);
-		$adb->println($cust_result);
-
-		$noofrows=$adb->num_rows($result);
-		$custfld = '';	
-		for($i=0; $i<$noofrows; $i++)
-		{
-			$fldName=$adb->query_result($result,$i,"fieldlabel");
-			$colName=$adb->query_result($result,$i,"column_name");
-			$uitype=$adb->query_result($result,$i,"uitype");
-			if($adb->num_rows($cust_result) != 0)
-			{
-				$value=$adb->query_result($cust_result,0,strtolower($colName));
-			}
-			else
-			{
-				$value='';
-				$adb->println("emply value ");
-			}
-			$custfld .= '<tr>';
-			$custfld .= '<td width="20%" valign="top" class="dataLabel">'.$fldName.':</td>';
-			if($uitype == 13)
-			{
-				$custfld .= '<td width="30%" valign="top" class="dataField"><a href="mailto:'.$value.'">'.$value.'</a></td>';
-			}
-			else
-			{
-				$custfld .= '<td width="30%" valign="top" class="dataField">'.$value.'</td>';
-			}	
-			$i++;
-			if($i<$noofrows)
-			{
-				$fldName=$adb->query_result($result,$i,"fieldlabel");
-				$colName=$adb->query_result($result,$i,"column_name");
-				$uitype=$adb->query_result($result,$i,"uitype");
-				if($adb->num_rows($cust_result) != 0)
-				{
-					$value=$adb->query_result($cust_result,0,strtolower($colName));
-				}
-				else
-				{
-					$value='';
-				}
-				$custfld .= '<td width="20%" valign="top" class="dataLabel">'.$fldName.':</td>';
-				if($uitype == 13)
-				{
-
-					$custfld .= '<td width="30%" valign="top" class="dataField"><a href="mailto:'.$value.'">'.$value.'</a></td>';
-				}
-				else
-				{
-					$custfld .= '<td width="30%" valign="top" class="dataField">'.$value.'</td>';
-				}
-			}
-
-
-			$custfld .= '<tr>';
-
-		}
-	}
-	return $custfld;
-}
-
+/**
+ * Function to get custom fields
+ * @param $module :: table name -- Type string
+ * returns customfields in key-value pair array format
+ */
 function getCustomFieldArray($module)
 {
 	global $adb;
@@ -298,6 +99,12 @@
 	
 }
 
+/**
+ * Function to get columnname and fieldlabel from field table
+ * @param $module :: module name -- Type string
+ * @param $trans_array :: translated column fields -- Type array
+ * returns trans_array in key-value pair array format
+ */
 function getCustomFieldTrans($module, $trans_array)
 {
 	global $adb;
@@ -315,89 +122,13 @@
 }
 
 
-function CustomFieldSearch($customfieldarray, $fldModule, $tableName,$colidName,$app_strings,$theme,$fieldlabel,$column)
-{
-	global $adb;
-	$adb->println("function CustomFieldSearch to display the customfields in search -- include/CustomFieldUtil.php");
-	//for($i=0;$i<count($customfieldarray);$i++){echo '<br> Custom Field : '.$i.'...'.$customfieldarray[$i];}
-
-        //Custom Field Addition
-        $dbquery = "select  * from field  where tablename='".$fldModule."' order by fieldlabel";
-        $result = $adb->query($dbquery);
-        if($adb->num_rows($result) != 0)
-        {
-                $noofrows = $adb->num_rows($result);
-
-                $custfld = '<table width="85%" border="0" cellspacing="0" cellpadding="0">';
-                $custfld .= '<tr><th align="left" class="formSecHeader" colspan="4">'.$app_strings['LBL_CUSTOM_INFORMATION'].'</th></tr>';
-                for($i=0; $i<$noofrows; $i++)
-                {
-                        $id=$customfieldarray[$i];
-                        $colName=$column[$i];
-                        $setName=$fieldlabel[$i];
-			$uitype[$i] = $adb->query_result($result,$i,'uitype');
-
-			if($uitype[$i] == 56)
-		        {
-                		$custfld .= '<td width="20%" class="dataLabel">'.$colName.':</td>';
-		                if($customfieldarray[$i] == 'on')
-                		{
-		                        $custfld .='<td width="30%"><input name="'.$setName.'" type="checkbox"  checked></td>';
-                		}
-		                else
-                		{
-		                        $custfld .='<td width="30%"><input name="'.$setName.'" type="checkbox"></td>';
-                		}
-		        }
-			elseif($uitype[$i] == 15)
-                        {
-				//This elseif part is added to handle the picklist values in search -- after 4.2 patch2 
-                                $pick_query="select * from ".$setName;
-                                $pickListResult = $adb->query($pick_query);
-                                $noofpickrows = $adb->num_rows($pickListResult);
-
-                                $custfld .= '<td width="20%" class="dataLabel">'.$colName.':</td>';
-                                $custfld .= '<td width="30%"><select name="'.$setName.'" tabindex="1">';
-				//Set --None-- as default when search value for this field is empty
-				if($customfieldarray[$i] != '')
-				{
-					$default_selected = 'selected';
-				}
-				$custfld .= '<OPTION value="" '.$default_selected.'>--None--</OPTION>';
-                                for($j = 0; $j < $noofpickrows; $j++)
-                                {
-                                        $pickListValue=$adb->query_result($pickListResult,$j,strtolower($setName));
-                                        if($customfieldarray[$i] == $pickListValue)
-                                        {
-                                                $chk_val = "selected";
-                                        }
-                                        else
-                                        {
-                                                $chk_val = '';
-                                        }
-
-                                        $custfld .= '<OPTION value="'.$pickListValue.'" '.$chk_val.'>'.$pickListValue.'</OPTION>';
-                                }
-                                $custfld .= '</td>';
-                        }
-			else
-			{
-	                        $custfld .= '<td width="20%" class="dataLabel">'.$colName.':</td>';
-
-        	                $custfld .= '<td width="30%"><input name="'.$setName.'" type="text" tabindex="'.$i.'" size="25" maxlength="25" value="'.$customfieldarray[$i].'"></td>';
-	                        if($i%2==1)
-        	                {
-                	                $custfld .= '<tr>';
-                        	}
-			}
-                }
-
-                $custfld .= '</table>';
-                return $custfld;
-
-        }
-}
-
+/**
+ * Function to get customfield record from field table
+ * @param $tab :: Tab ID -- Type integer
+ * @param $datatype :: field name -- Type string
+ * @param $id :: field Id -- Type integer
+ * returns the data result in string format
+ */
 function getCustomFieldData($tab,$id,$datatype)
 {
 	global $adb;
@@ -407,6 +138,14 @@
 	return $return_data[$datatype];
 }
 
+
+/**
+ * Function to get customfield type,length value,decimal value and picklist value
+ * @param $label :: field typename -- Type string
+ * @param $typeofdata :: datatype -- Type string
+ * returns the field type,length,decimal
+ * and picklist value in ';' separated array format
+ */
 function getFldTypeandLengthValue($label,$typeofdata)
 {
 	if($label == 'Text')
@@ -463,6 +202,10 @@
 	{
 		$fieldtype = '10';
 	}
+	elseif($label == 'Multi-Select Combo Box')
+        {
+                $fieldtype = '11';
+        }
 	return $fieldtype;
 }
 ?>





More information about the vtigercrm-commits mailing list