[ 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 require_once ('Smarty_setup.php'); 12 require_once ('include/database/PearDatabase.php'); 13 require_once ('include/CustomFieldUtil.php'); 14 global $mod_strings; 15 global $app_strings; 16 17 $smarty=new vtigerCRM_Smarty; 18 global $theme; 19 $theme_path="themes/".$theme."/"; 20 $image_path=$theme_path."images/"; 21 require_once ($theme_path.'layout_utils.php'); 22 $smarty->assign("IMAGE_PATH", $image_path); 23 24 /** 25 * Function to get Account custom fields 26 * @param integer $leadid - lead customfield id 27 * @param integer $accountid - account customfield id 28 * return array $accountcf - account customfield 29 */ 30 function getAccountCustomValues($leadid,$accountid) 31 { 32 global $adb; 33 $accountcf=Array(); 34 $sql="select fieldid,fieldlabel,uitype,typeofdata from vtiger_field,vtiger_tab where vtiger_field.tabid=vtiger_tab.tabid and generatedtype=2 and vtiger_tab.name='Accounts'"; 35 $result = $adb->query($sql); 36 $noofrows = $adb->num_rows($result); 37 38 for($i=0;$i<$noofrows;$i++) 39 { 40 $account_field['fieldid']=$adb->query_result($result,$i,"fieldid"); 41 $account_field['fieldlabel']=$adb->query_result($result,$i,"fieldlabel"); 42 $account_field['typeofdata']=$adb->query_result($result,$i,"typeofdata"); 43 $account_field['fieldtype']=getCustomFieldTypeName($adb->query_result($result,$i,"uitype")); 44 if($account_field['fieldid']==$accountid) 45 $account_field['selected'] = "selected"; 46 else 47 $account_field['selected'] = ""; 48 $account_cfelement[]=$account_field; 49 } 50 $accountcf[$leadid.'_account']=$account_cfelement; 51 return $accountcf; 52 } 53 54 /** 55 * Function to get contact custom fields 56 * @param integer $leadid - lead customfield id 57 * @param integer $contactid - contact customfield id 58 * return array $contactcf - contact customfield 59 */ 60 function getContactCustomValues($leadid,$contactid) 61 { 62 global $adb; 63 $contactcf=Array(); 64 $sql="select fieldid,fieldlabel,uitype,typeofdata from vtiger_field,vtiger_tab where vtiger_field.tabid=vtiger_tab.tabid and generatedtype=2 and vtiger_tab.name='Contacts'"; 65 $result = $adb->query($sql); 66 $noofrows = $adb->num_rows($result); 67 for($i=0; $i<$noofrows; $i++) 68 { 69 $contact_field['fieldid']=$adb->query_result($result,$i,"fieldid"); 70 $contact_field['fieldlabel']=$adb->query_result($result,$i,"fieldlabel"); 71 $contact_field['typeofdata']=$adb->query_result($result,$i,"typeofdata"); 72 $contact_field['fieldtype']=getCustomFieldTypeName($adb->query_result($result,$i,"uitype")); 73 74 if($contact_field['fieldid']==$contactid) 75 $contact_field['selected']="selected"; 76 else 77 $contact_field['selected'] = ""; 78 $contact_cfelement[]=$contact_field; 79 } 80 $contactcf[$leadid.'_contact'] = $contact_cfelement; 81 return $contactcf; 82 } 83 84 /** 85 * Function to get potential custom fields 86 * @param integer $leadid - lead customfield id 87 * @param integer $potentialid - potential customfield id 88 * return array $potentialcf - potential customfield 89 */ 90 function getPotentialCustomValues($leadid,$potentialid) 91 { 92 global $adb; 93 $potentialcf=Array(); 94 $sql="select fieldid,fieldlabel,uitype,typeofdata from vtiger_field,vtiger_tab where vtiger_field.tabid=vtiger_tab.tabid and generatedtype=2 and vtiger_tab.name='Potentials'"; 95 $result = $adb->query($sql); 96 $noofrows = $adb->num_rows($result); 97 for($i=0; $i<$noofrows; $i++) 98 { 99 $potential_field['fieldid']=$adb->query_result($result,$i,"fieldid"); 100 $potential_field['fieldlabel']=$adb->query_result($result,$i,"fieldlabel"); 101 $potential_field['typeofdata']=$adb->query_result($result,$i,"typeofdata"); 102 $potential_field['fieldtype']=getCustomFieldTypeName($adb->query_result($result,$i,"uitype")); 103 104 if($potential_field['fieldid']==$potentialid) 105 $potential_field['selected']="selected"; 106 else 107 $potential_field['selected'] = ""; 108 $potential_cfelement[]=$potential_field; 109 } 110 $potentialcf[$leadid.'_potential']=$potential_cfelement; 111 return $potentialcf; 112 } 113 114 /** 115 * Function to get leads mapping custom fields 116 * return array $leadcf - mapping custom fields 117 */ 118 119 function customFieldMappings() 120 { 121 global $adb; 122 123 $convert_sql="select vtiger_convertleadmapping.*,uitype,fieldlabel,typeofdata from vtiger_convertleadmapping left join vtiger_field on vtiger_field.fieldid = vtiger_convertleadmapping.leadfid"; 124 $convert_result = $adb->query($convert_sql); 125 126 $no_rows = $adb->num_rows($convert_result); 127 for($j=0; $j<$no_rows; $j++) 128 { 129 $leadid = $adb->query_result($convert_result,$j,"leadfid"); 130 $accountid=$adb->query_result($convert_result,$j,"accountfid"); 131 $contactid=$adb->query_result($convert_result,$j,"contactfid"); 132 $potentialid=$adb->query_result($convert_result,$j,"potentialfid"); 133 $lead_field['sno'] = $j+1; 134 $lead_field['leadid'] = $adb->query_result($convert_result,$j,"fieldlabel"); 135 $lead_field['typeofdata']=$adb->query_result($convert_result,$j,"typeofdata"); 136 $lead_field['fieldtype'] = getCustomFieldTypeName($adb->query_result($convert_result,$j,"uitype"));; 137 $lead_field['account'] = getAccountCustomValues($leadid,$accountid); 138 $lead_field['contact'] = getContactCustomValues($leadid,$contactid); 139 $lead_field['potential'] = getPotentialCustomValues($leadid,$potentialid); 140 $leadcf[]= $lead_field; 141 } 142 return $leadcf; 143 } 144 145 $smarty->assign("MOD",$mod_strings); 146 $smarty->assign("APP",$app_strings); 147 $smarty->assign("CUSTOMFIELDMAPPING",customFieldMappings()); 148 149 $smarty->display("CustomFieldMapping.tpl"); 150 151 ?>
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 |