[Vtigercrm-commits] [vtiger-commits] r9349 - /vtigercrm/trunk/modules/Settings/DeleteCustomField.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Sep 7 06:47:13 EDT 2006


Author: saraj
Date: Thu Sep  7 04:47:08 2006
New Revision: 9349

Log:
* Modified to delete the customfield from corresponding module tables and add the missed module tables

Modified:
    vtigercrm/trunk/modules/Settings/DeleteCustomField.php

Modified: vtigercrm/trunk/modules/Settings/DeleteCustomField.php
==============================================================================
--- vtigercrm/trunk/modules/Settings/DeleteCustomField.php (original)
+++ vtigercrm/trunk/modules/Settings/DeleteCustomField.php Thu Sep  7 04:47:08 2006
@@ -11,10 +11,9 @@
 require_once('include/database/PearDatabase.php');
 
 $fld_module = $_REQUEST["fld_module"];
-//echo $fld_module;
+
 $id = $_REQUEST["fld_id"];
-//echo '<BR>';
-//echo $id;
+
 $colName = $_REQUEST["colName"];
 $uitype = $_REQUEST["uitype"];
 
@@ -22,43 +21,37 @@
 $query='delete from vtiger_field where fieldid="'.$id.'"';
 $adb->query($query);
 
-//Deleting from vtiger_profile2field vtiger_table
+//Deleting from vtiger_profile2field table
 $query='delete from vtiger_profile2field where fieldid="'.$id.'"';
 $adb->query($query);
 
-//Deleting from vtiger_def_org_field vtiger_table
+//Deleting from vtiger_def_org_field table
 $query='delete from vtiger_def_org_field where fieldid="'.$id.'"';
 $adb->query($query);
 
-//Dropping the column in the module vtiger_table
-if($fld_module == "Leads")
-{
-	$tableName = "leadscf";
-}
-elseif($fld_module == "Accounts")
-{
-	$tableName = "accountscf";
-}
-elseif($fld_module == "Contacts")
-{
-	$tableName = "contactscf";
-}
-elseif($fld_module == "Potentials")
-{
-	$tableName = "potentialscf";
-}
-elseif($fld_module == "HelpDesk")
-{
-	$tableName = "ticketcf";
-}
-elseif($fld_module == "Products")
-{
-	$tableName = "productcf";
-}
-//echo '<BR>';
-//echo $tableName;
-$dbquery = 'Alter table '.$tableName.' Drop Column '.$colName;
+//Drop the column in the corresponding module table
+$delete_module_tables = Array(
+				"Leads"=>"vtiger_leadscf",
+				"Accounts"=>"vtiger_accountscf",
+				"Contacts"=>"vtiger_contactscf",
+				"Potentials"=>"vtiger_potentialscf",
+				"HelpDesk"=>"vtiger_ticketcf",
+				"Products"=>"vtiger_productcf",
+				"Vendors"=>"vtiger_vendorcf",
+				"PriceBooks"=>"vtiger_pricebookcf",
+				"PurchaseOrder"=>"vtiger_purchaseordercf",
+				"SalesOrder"=>"vtiger_salesordercf",
+				"Quotes"=>"vtiger_quotescf",
+				"Invoice"=>"vtiger_invoicecf",
+				"Campaigns"=>"vtiger_campaignscf",
+			     );
+
+$dbquery = 'alter table '.$delete_module_tables[$fld_module].' drop column '.$colName;
 $adb->query($dbquery);
+
+
+//HANDLE HERE - we have to remove the entries in customview and report related tables which have this field ($colName)
+
 
 //Deleting from convert lead mapping vtiger_table- Jaguar
 if($fld_module=="Leads")
@@ -67,11 +60,12 @@
 	$adb->query($deletequery);
 }
 
-
+//HANDLE HERE - we have to remove the table for other picklist type values which are text area and multiselect combo box 
 if($uitype == 15)
 {
-$deltablequery = 'drop table '.$colName;
-$adb->query($deltablequery);
+	$deltablequery = 'drop table '.$colName;
+	$adb->query($deltablequery);
 }
+
 header("Location:index.php?module=Settings&action=CustomFieldList&fld_module=".$fld_module."&parenttab=Settings");
 ?>





More information about the vtigercrm-commits mailing list