| [ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Contacts/EditView.php,v 1.21 2005/03/24 16:18:38 samk Exp $ 17 * Description: TODO: To be written. 18 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 19 * All Rights Reserved. 20 * Contributor(s): ______________________________________.. 21 ********************************************************************************/ 22 23 require_once ('Smarty_setup.php'); 24 require_once ('data/Tracker.php'); 25 require_once ('modules/Contacts/Contacts.php'); 26 require_once ('include/CustomFieldUtil.php'); 27 require_once ('include/ComboUtil.php'); 28 require_once ('include/utils/utils.php'); 29 require_once ('include/FormValidationUtil.php'); 30 31 global $log,$mod_strings,$app_strings,$theme,$currentModule; 32 33 //added for contact image 34 $encode_val=$_REQUEST['encode_val']; 35 $decode_val=base64_decode($encode_val); 36 37 $saveimage=isset($_REQUEST['saveimage'])?$_REQUEST['saveimage']:"false"; 38 $errormessage=isset($_REQUEST['error_msg'])?$_REQUEST['error_msg']:"false"; 39 $image_error=isset($_REQUEST['image_error'])?$_REQUEST['image_error']:"false"; 40 //end 41 42 $focus = new Contacts(); 43 $smarty = new vtigerCRM_Smarty; 44 45 if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) 46 { 47 $focus->id = $_REQUEST['record']; 48 $focus->mode = 'edit'; 49 $focus->retrieve_entity_info($_REQUEST['record'],"Contacts"); 50 $log->info("Entity info successfully retrieved for EditView."); 51 $focus->firstname=$focus->column_fields['firstname']; 52 $focus->lastname=$focus->column_fields['lastname']; 53 54 } 55 56 if($image_error=="true") 57 { 58 $explode_decode_val=explode("&",$decode_val); 59 for($i=1;$i<count($explode_decode_val);$i++) 60 { 61 $test=$explode_decode_val[$i]; 62 $values=explode("=",$test); 63 $field_name_val=$values[0]; 64 $field_value=$values[1]; 65 $focus->column_fields[$field_name_val]=$field_value; 66 } 67 } 68 69 if(isset($_REQUEST['account_id']) && $_REQUEST['account_id']!='' && $_REQUEST['record']=='') 70 { 71 require_once ('modules/Accounts/Accounts.php'); 72 $focus->column_fields['account_id'] = $_REQUEST['account_id']; 73 $acct_focus = new Accounts(); 74 $acct_focus->retrieve_entity_info($_REQUEST['account_id'],"Accounts"); 75 $focus->column_fields['fax']=$acct_focus->column_fields['fax']; 76 $focus->column_fields['otherphone']=$acct_focus->column_fields['phone']; 77 $focus->column_fields['mailingcity']=$acct_focus->column_fields['bill_city']; 78 $focus->column_fields['othercity']=$acct_focus->column_fields['ship_city']; 79 $focus->column_fields['mailingstreet']=$acct_focus->column_fields['bill_street']; 80 $focus->column_fields['otherstreet']=$acct_focus->column_fields['ship_street']; 81 $focus->column_fields['mailingstate']=$acct_focus->column_fields['bill_state']; 82 $focus->column_fields['otherstate']=$acct_focus->column_fields['ship_state']; 83 $focus->column_fields['mailingzip']=$acct_focus->column_fields['bill_code']; 84 $focus->column_fields['otherzip']=$acct_focus->column_fields['ship_code']; 85 $focus->column_fields['mailingcountry']=$acct_focus->column_fields['bill_country']; 86 $focus->column_fields['othercountry']=$acct_focus->column_fields['ship_country']; 87 $log->debug("Accountid Id from the request is ".$_REQUEST['account_id']); 88 89 } 90 if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') 91 { 92 $focus->id = ""; 93 $focus->mode = ""; 94 } 95 96 $disp_view = getView($focus->mode); 97 if($disp_view == 'edit_view') 98 $smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields)); 99 else 100 { 101 $smarty->assign("BASBLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'BAS')); 102 $smarty->assign("ADVBLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'ADV')); 103 } 104 105 $smarty->assign("OP_MODE",$disp_view); 106 107 //needed when creating a new contact with a default vtiger_account value passed in 108 if (isset($_REQUEST['account_name']) && is_null($focus->account_name)) { 109 $focus->account_name = $_REQUEST['account_name']; 110 111 112 } 113 if (isset($_REQUEST['account_id']) && is_null($focus->account_id)) { 114 $focus->account_id = $_REQUEST['account_id']; 115 } 116 117 $theme_path="themes/".$theme."/"; 118 $image_path=$theme_path."images/"; 119 //retreiving the combo values array 120 $comboFieldNames = Array('leadsource'=>'lead_source_dom' 121 ,'salutationtype'=>'salutation_dom'); 122 $comboFieldArray = getComboArray($comboFieldNames); 123 124 require_once ($theme_path.'layout_utils.php'); 125 126 $log->info("Contact detail view"); 127 128 $smarty->assign("MOD", $mod_strings); 129 $smarty->assign("APP", $app_strings); 130 $smarty->assign("NAME",$focus->lastname." ".$focus->firstname); 131 if(isset($cust_fld)) 132 { 133 $smarty->assign("CUSTOMFIELD", $cust_fld); 134 } 135 $smarty->assign("ID", $focus->id); 136 $smarty->assign("MODULE",$currentModule); 137 $smarty->assign("SINGLE_MOD",'Contact'); 138 139 if($focus->mode == 'edit') 140 { 141 $smarty->assign("UPDATEINFO",updateInfo($focus->id)); 142 $smarty->assign("MODE", $focus->mode); 143 } 144 145 if(isset($_REQUEST['activity_mode']) && $_REQUEST['activity_mode'] !='') 146 $smarty->assign("ACTIVITYMODE",$_REQUEST['activity_mode']); 147 148 // Unimplemented until jscalendar language vtiger_files are fixed 149 $smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); 150 $smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT'])); 151 152 if(isset($_REQUEST['campaignid'])) 153 $smarty->assign("campaignid",$_REQUEST['campaignid']); 154 if (isset($_REQUEST['return_module'])) 155 $smarty->assign("RETURN_MODULE", $_REQUEST['return_module']); 156 if (isset($_REQUEST['return_action'])) 157 $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']); 158 if (isset($_REQUEST['return_id'])) 159 $smarty->assign("RETURN_ID", $_REQUEST['return_id']); 160 if (isset($_REQUEST['return_viewname'])) 161 $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']); 162 $smarty->assign("THEME", $theme); 163 $smarty->assign("IMAGE_PATH", $image_path); 164 $smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); 165 166 $tabid = getTabid("Contacts"); 167 $validationData = getDBValidationData($focus->tab_name,$tabid); 168 $data = split_validationdataArray($validationData); 169 170 $smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']); 171 $smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']); 172 $smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']); 173 $category = getParentTab(); 174 $smarty->assign("CATEGORY",$category); 175 176 if($errormessage==2) 177 { 178 $msg =$mod_strings['LBL_MAXIMUM_LIMIT_ERROR']; 179 $errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>"; 180 } 181 else if($errormessage==3) 182 { 183 $msg = $mod_strings['LBL_UPLOAD_ERROR']; 184 $errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>"; 185 186 } 187 else if($errormessage=="image") 188 { 189 $msg = $mod_strings['LBL_IMAGE_ERROR']; 190 $errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>"; 191 } 192 else if($errormessage =="invalid") 193 { 194 $msg = $mod_strings['LBL_INVALID_IMAGE']; 195 $errormessage ="<B><font color='red'>".$msg."</font></B> <br><br>"; 196 } 197 else 198 { 199 $errormessage=""; 200 } 201 if($errormessage!="") 202 { 203 $smarty->assign("ERROR_MESSAGE",$errormessage); 204 } 205 206 $check_button = Button_Check($module); 207 $smarty->assign("CHECK", $check_button); 208 209 if($focus->mode == 'edit') 210 $smarty->display("salesEditView.tpl"); 211 else 212 $smarty->display('CreateView.tpl'); 213 214 215 ?>
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 |