[ 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$ 17 * Description: Defines the Account SugarBean Account entity with the necessary 18 * methods and variables. 19 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 20 * All Rights Reserved. 21 * Contributor(s): ______________________________________.. 22 ********************************************************************************/ 23 24 25 include_once ('config.php'); 26 require_once ('include/logging.php'); 27 require_once ('include/database/PearDatabase.php'); 28 require_once ('data/SugarBean.php'); 29 require_once ('modules/Contacts/Contacts.php'); 30 require_once ('modules/Potentials/Potentials.php'); 31 require_once ('modules/Notes/Notes.php'); 32 require_once ('modules/Emails/Emails.php'); 33 require_once ('modules/Accounts/Accounts.php'); 34 require_once ('modules/Products/Products.php'); 35 require_once ('include/ComboUtil.php'); 36 require_once ('modules/Leads/Leads.php'); 37 38 39 class ImportProduct extends Products { 40 var $db; 41 42 // This is the list of the functions to run when importing 43 var $special_functions = array("assign_user"); 44 45 var $importable_fields = Array(); 46 47 /** function used to set the assigned_user_id value in the column_fields when we map the username during import 48 */ 49 function assign_user() 50 { 51 global $current_user; 52 $ass_user = $this->column_fields["assigned_user_id"]; 53 $this->db->println("assign_user ".$ass_user." cur_user=".$current_user->id); 54 55 if( $ass_user != $current_user->id) 56 { 57 $this->db->println("searching and assigning ".$ass_user); 58 59 //$result = $this->db->query("select id from vtiger_users where user_name = '".$ass_user."'"); 60 $result = $this->db->query("select id from vtiger_users where id = '".$ass_user."'"); 61 if($this->db->num_rows($result)!=1) 62 { 63 $this->db->println("not exact records setting current userid"); 64 $this->column_fields["assigned_user_id"] = $current_user->id; 65 } 66 else 67 { 68 69 $row = $this->db->fetchByAssoc($result, -1, false); 70 if (isset($row['id']) && $row['id'] != -1) 71 { 72 $this->db->println("setting id as ".$row['id']); 73 $this->column_fields["assigned_user_id"] = $row['id']; 74 } 75 else 76 { 77 $this->db->println("setting current userid"); 78 $this->column_fields["assigned_user_id"] = $current_user->id; 79 } 80 } 81 } 82 } 83 84 /** Constructor which will set the importable_fields as $this->importable_fields[$key]=1 in this object where key is the fieldname in the field table 85 */ 86 function ImportProduct() { 87 88 $this->log = LoggerManager::getLogger('import_product'); 89 $this->db = new PearDatabase(); 90 $this->db->println("IMP ImportProduct"); 91 $colf = getColumnFields("Products"); 92 foreach($colf as $key=>$value) 93 $this->importable_fields[$key]=1; 94 95 $this->db->println($this->importable_fields); 96 } 97 98 } 99 ?>
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 |