[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Settings/ -> DeleteCustomField.php (source)

   1  <?php
   2  /*********************************************************************************
   3  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9  *
  10   ********************************************************************************/
  11  require_once ('include/database/PearDatabase.php');
  12  
  13  $fld_module = $_REQUEST["fld_module"];
  14  
  15  $id = $_REQUEST["fld_id"];
  16  
  17  $colName = $_REQUEST["colName"];
  18  $uitype = $_REQUEST["uitype"];
  19  
  20  //Deleting the CustomField from the Custom Field Table
  21  $query='delete from vtiger_field where fieldid="'.$id.'"';
  22  $adb->query($query);
  23  
  24  //Deleting from vtiger_profile2field table
  25  $query='delete from vtiger_profile2field where fieldid="'.$id.'"';
  26  $adb->query($query);
  27  
  28  //Deleting from vtiger_def_org_field table
  29  $query='delete from vtiger_def_org_field where fieldid="'.$id.'"';
  30  $adb->query($query);
  31  
  32  //Drop the column in the corresponding module table
  33  $delete_module_tables = Array(
  34                  "Leads"=>"vtiger_leadscf",
  35                  "Accounts"=>"vtiger_accountscf",
  36                  "Contacts"=>"vtiger_contactscf",
  37                  "Potentials"=>"vtiger_potentialscf",
  38                  "HelpDesk"=>"vtiger_ticketcf",
  39                  "Products"=>"vtiger_productcf",
  40                  "Vendors"=>"vtiger_vendorcf",
  41                  "PriceBooks"=>"vtiger_pricebookcf",
  42                  "PurchaseOrder"=>"vtiger_purchaseordercf",
  43                  "SalesOrder"=>"vtiger_salesordercf",
  44                  "Quotes"=>"vtiger_quotescf",
  45                  "Invoice"=>"vtiger_invoicecf",
  46                  "Campaigns"=>"vtiger_campaignscf",
  47                   );
  48  
  49  $dbquery = 'alter table '.$delete_module_tables[$fld_module].' drop column '.$colName;
  50  $adb->query($dbquery);
  51  
  52  
  53  //we have to remove the entries in customview and report related tables which have this field ($colName)
  54  $adb->query("delete from vtiger_cvcolumnlist where columnname like '%".$colName."%'");
  55  $adb->query("delete from vtiger_cvstdfilter where columnname like '%".$colName."%'");
  56  $adb->query("delete from vtiger_cvadvfilter where columnname like '%".$colName."%'");
  57  $adb->query("delete from vtiger_selectcolumn where columnname like '%".$colName."%'");
  58  $adb->query("delete from vtiger_relcriteria where columnname like '%".$colName."%'");
  59  $adb->query("delete from vtiger_reportsortcol where columnname like '%".$colName."%'");
  60  $adb->query("delete from vtiger_reportdatefilter where datecolumnname like '%".$colName."%'");
  61  $adb->query("delete from vtiger_reportsummary where columnname like '%".$colName."%'");
  62  
  63  
  64  //Deleting from convert lead mapping vtiger_table- Jaguar
  65  if($fld_module=="Leads")
  66  {
  67      $deletequery = 'delete from vtiger_convertleadmapping where leadfid='.$id;
  68      $adb->query($deletequery);
  69  }
  70  
  71  //HANDLE HERE - we have to remove the table for other picklist type values which are text area and multiselect combo box 
  72  if($uitype == 15)
  73  {
  74      $deltablequery = 'drop table '.$colName;
  75      $adb->query($deltablequery);
  76  }
  77  
  78  
  79  
  80  header("Location:index.php?module=Settings&action=CustomFieldList&fld_module=".$fld_module."&parenttab=Settings");
  81  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7