[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
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 12 13 global $conn; 14 //we have to get all customfields from customview and report related tables (cvcolumnlist, cvstdfilter, etc) and remove the entries from these tables if the customfields are not available in field table and cf table 15 16 $tables_array = Array( 17 "vtiger_cvcolumnlist"=>"columnname", 18 "vtiger_cvstdfilter"=>"columnname", 19 "vtiger_cvadvfilter"=>"columnname", 20 "vtiger_selectcolumn"=>"columnname", 21 "vtiger_relcriteria"=>"columnname", 22 "vtiger_reportsortcol"=>"columnname", 23 "vtiger_reportdatefilter"=>"datecolumnname", 24 "vtiger_reportsummary"=>"columnname", 25 ); 26 27 28 foreach($tables_array as $tablename => $columnname) 29 { 30 $query = "select $columnname from $tablename where $columnname like '%:cf_%'"; 31 $result = $conn->query($query); 32 $noofrows = $conn->num_rows($result); 33 34 for($i=0;$i<$noofrows;$i++) 35 { 36 //First get the fieldname from the result 37 $col_value = $conn->query_result($result,$i,$columnname); 38 $fieldname = substr($col_value,strpos($col_value,':cf_')+1,6); 39 40 //Now check whether this field is available in field table 41 $sql1 = "select fieldid from vtiger_field where fieldname='".$fieldname."'"; 42 $result1 = $conn->query($sql1); 43 $noofrows1 = $conn->num_rows($result1); 44 $fieldid = $conn->query_result($result1,0,"fieldid"); 45 46 //if there is no field then we have to delete that field entries 47 if($noofrows1 == 0 && !isset($fieldid)) 48 { 49 //Now we have to delete that customfield from the $tablename 50 Execute("delete from $tablename where $columnname like '%:".$fieldname.":%'"); 51 } 52 } 53 } 54 55 56 57 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |