[Vtigercrm-commits] [vtiger-commits] r7215 - in /vtigercrm/trunk/modules/Settings: AddCustomFieldToDB.php UpdateComboValues.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sat Jun 17 05:32:04 EDT 2006


Author: saraj
Date: Sat Jun 17 03:31:59 2006
New Revision: 7215

Log:
changes made to fix the issue 1322 and 1285

Modified:
    vtigercrm/trunk/modules/Settings/AddCustomFieldToDB.php
    vtigercrm/trunk/modules/Settings/UpdateComboValues.php

Modified: vtigercrm/trunk/modules/Settings/AddCustomFieldToDB.php
==============================================================================
--- vtigercrm/trunk/modules/Settings/AddCustomFieldToDB.php (original)
+++ vtigercrm/trunk/modules/Settings/AddCustomFieldToDB.php Sat Jun 17 03:31:59 2006
@@ -281,9 +281,13 @@
 		if($fldType == 'Picklist' || $fldType == 'MultiSelectCombo')
 		{
 			// Creating the PickList Table and Populating Values
-			$adb->createTable('vtiger_'.$columnName, $columnName." C(255)");
-			//Adding Primary Key
-			$qur = "ALTER table vtiger_".$columnName." ADD PRIMARY KEY (". $columnName.")";
+			$qur = "CREATE TABLE vtiger_".$columnName." (
+					".$columnName."id int(19) NOT NULL auto_increment,
+					".$columnName." varchar(200) NOT NULL,
+					sortorderid int(19) NOT NULL default '0',
+					presence int(1) NOT NULL default '1',
+				        PRIMARY KEY  (".$columnName."id)
+				)";
 			$adb->query($qur);
 
 			$fldPickList =  $_REQUEST['fldPickList'];
@@ -292,9 +296,10 @@
 			for($i = 0; $i < $count; $i++)
 			{
 				$pickArray[$i] = trim($pickArray[$i]);
+				$id = $adb->getUniqueID($columnName);
 				if($pickArray[$i] != '')
 				{
-					$query = "insert into vtiger_".$columnName." values('".$pickArray[$i]."')";
+					$query = "insert into vtiger_".$columnName." values(".$id.",'".$pickArray[$i]."',".$i.",1)";
 					$adb->query($query);
 				}
 			}

Modified: vtigercrm/trunk/modules/Settings/UpdateComboValues.php
==============================================================================
--- vtigercrm/trunk/modules/Settings/UpdateComboValues.php (original)
+++ vtigercrm/trunk/modules/Settings/UpdateComboValues.php Sat Jun 17 03:31:59 2006
@@ -30,11 +30,8 @@
 	$pickArray[$i] = trim($pickArray[$i]);
 	if($pickArray[$i] != '')
 	{
-		if($custom)
-			$query = "insert into vtiger_".$tableName." values('".$pickArray[$i]."')";
-		else
-			$query = "insert into vtiger_".$tableName." values('','".$pickArray[$i]."',".$i.",1)";
-        $adb->query($query);
+		$query = "insert into vtiger_".$tableName." values('','".$pickArray[$i]."',".$i.",1)";
+	        $adb->query($query);
 	}
 }
 header("Location:index.php?action=SettingsAjax&module=Settings&directmode=ajax&file=PickList&fld_module=".$fld_module);





More information about the vtigercrm-commits mailing list