[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/modules/Import/ -> ImportAccount.php (source)

   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   ********************************************************************************/
  20  
  21  include_once ('config.php');
  22  require_once ('include/logging.php');
  23  require_once ('include/database/PearDatabase.php');
  24  require_once ('data/SugarBean.php');
  25  require_once ('modules/Contacts/Contacts.php');
  26  require_once ('modules/Potentials/Potentials.php');
  27  require_once ('modules/Notes/Notes.php');
  28  require_once ('modules/Emails/Emails.php');
  29  require_once ('modules/Accounts/Accounts.php');
  30  require_once ('include/ComboUtil.php');
  31  
  32  // Account is used to store vtiger_account information.
  33  class ImportAccount extends Accounts {
  34       var $db;
  35  
  36      // Get _dom arrays from Database
  37      //$comboFieldNames = Array('accounttype'=>'account_type_dom'
  38      //                      ,'industry'=>'industry_dom');
  39      //$comboFieldArray = getComboArray($comboFieldNames);
  40  
  41  
  42      // This is the list of vtiger_fields that are required.
  43      var $required_fields =  array("accountname"=>1);
  44      
  45      // This is the list of the functions to run when importing
  46      var $special_functions =  array(
  47                          //"add_billing_address_streets"
  48                          //,"add_shipping_address_streets"
  49                          //,"fix_website"
  50                         );
  51  
  52      /*
  53      function fix_website()
  54      {
  55          if ( isset($this->website) &&
  56              preg_match("/^http:\/\//",$this->website) )
  57          {
  58              $this->website = substr($this->website,7);
  59          }    
  60      }
  61  
  62      
  63      function add_industry()
  64      {
  65          if ( isset($this->industry) &&
  66              ! isset( $comboFieldArray['industry_dom'][$this->industry]))
  67          {
  68              unset($this->industry);
  69          }    
  70      }
  71  
  72      function add_type()
  73      {
  74          if ( isset($this->type) &&
  75              ! isset($comboFieldArray['account_type_dom'][$this->type]))
  76          {
  77              unset($this->type);
  78          }    
  79      }
  80  
  81      function add_billing_address_streets() 
  82      { 
  83          if ( isset($this->billing_address_street_2)) 
  84          { 
  85              $this->billing_address_street .= 
  86                  " ". $this->billing_address_street_2; 
  87          } 
  88  
  89          if ( isset($this->billing_address_street_3)) 
  90          {  
  91              $this->billing_address_street .= 
  92                  " ". $this->billing_address_street_3; 
  93          } 
  94          if ( isset($this->billing_address_street_4)) 
  95          {  
  96              $this->billing_address_street .= 
  97                  " ". $this->billing_address_street_4; 
  98          }
  99      }
 100  
 101      function add_shipping_address_streets() 
 102      { 
 103          if ( isset($this->shipping_address_street_2)) 
 104          { 
 105              $this->shipping_address_street .= 
 106                  " ". $this->shipping_address_street_2; 
 107          } 
 108  
 109          if ( isset($this->shipping_address_street_3)) 
 110          {  
 111              $this->shipping_address_street .= 
 112                  " ". $this->shipping_address_street_3; 
 113          } 
 114  
 115          if ( isset($this->shipping_address_street_4)) 
 116          {  
 117              $this->shipping_address_street .= 
 118                  " ". $this->shipping_address_street_4; 
 119          } 
 120      }
 121      */
 122  
 123      // This is the list of vtiger_fields that are importable.
 124      // some if these do not map directly to database columns
 125      /*var $importable_fields = Array(
 126          "id"=>1
 127          ,"name"=>1
 128          ,"website"=>1
 129          ,"industry"=>1
 130          ,"account_type"=>1
 131          ,"ticker_symbol"=>1
 132          ,"parent_name"=>1
 133          ,"employees"=>1
 134          ,"ownership"=>1
 135          ,"phone_office"=>1
 136          ,"phone_fax"=>1
 137          ,"phone_alternate"=>1
 138          ,"email1"=>1
 139          ,"email2"=>1
 140          ,"rating"=>1
 141          ,"sic_code"=>1
 142          ,"annual_revenue"=>1
 143          ,"billing_address_street"=>1
 144          ,"billing_address_street_2"=>1
 145          ,"billing_address_street_3"=>1
 146          ,"billing_address_street_4"=>1
 147          ,"billing_address_city"=>1
 148          ,"billing_address_state"=>1
 149          ,"billing_address_postalcode"=>1
 150          ,"billing_address_country"=>1
 151          ,"shipping_address_street"=>1
 152          ,"shipping_address_street_2"=>1
 153          ,"shipping_address_street_3"=>1
 154          ,"shipping_address_street_4"=>1
 155          ,"shipping_address_city"=>1
 156          ,"shipping_address_state"=>1
 157          ,"shipping_address_postalcode"=>1
 158          ,"shipping_address_country"=>1
 159          ,"description"=>1
 160          );
 161          */
 162  
 163          var $importable_fields = Array();
 164  
 165          /** 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
 166           */
 167  	function ImportAccount() {
 168          
 169          $this->log = LoggerManager::getLogger('import_account');
 170          $this->db = new PearDatabase();
 171          $this->db->println("IMP ImportAccount");
 172          $colf = getColumnFields("Accounts");
 173          foreach($colf as $key=>$value)
 174              $this->importable_fields[$key]=1;
 175          
 176          $this->db->println($this->importable_fields);
 177      }
 178  
 179  }
 180  
 181  
 182  
 183  ?>


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