Merge pull request #4896 from totten/master-movedep
[civicrm-core.git] / CRM / Contact / Import / ImportJob.php
index ffb58217c4a7434baab34d8279e499e131042a20..6b3269d7f6505b306febc0abe6f6180d9b502e06 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -118,7 +118,9 @@ class CRM_Contact_Import_ImportJob {
       'mapperRelatedContactImProvider',
       'mapperRelatedContactWebsiteType',
     );
-    foreach ($properties as $property) $this->{"_$property"} = array();
+    foreach ($properties as $property) {
+      $this->{"_$property"} = array();
+    }
   }
 
   /**
@@ -166,11 +168,11 @@ class CRM_Contact_Import_ImportJob {
    * @param int $timeout
    */
   public function runImport(&$form, $timeout = 55) {
-    $mapper        = $this->_mapper;
-    $mapperFields  = array();
-    $phoneTypes    = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
-    $imProviders   = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
-    $websiteTypes  = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
+    $mapper = $this->_mapper;
+    $mapperFields = array();
+    $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
+    $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
+    $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
     $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
 
     //initialize mapper perperty value.
@@ -190,7 +192,9 @@ class CRM_Contact_Import_ImportJob {
 
     foreach ($mapper as $key => $value) {
       //set respective mapper value to null.
-      foreach (array_values($mapperPeroperties) as $perpertyVal)$$perpertyVal = NULL;
+      foreach (array_values($mapperPeroperties) as $perpertyVal) {
+        $$perpertyVal = NULL;
+      }
 
       $fldName = CRM_Utils_Array::value(0, $mapper[$key]);
       $header = array($this->_mapFields[$fldName]);
@@ -222,9 +226,9 @@ class CRM_Contact_Import_ImportJob {
       }
 
       $fldNameParts = explode('_', $fldName, 3);
-      $id           = $fldNameParts[0];
-      $first        = isset($fldNameParts[1]) ? $fldNameParts[1] : NULL;
-      $second       = isset($fldNameParts[2]) ? $fldNameParts[2] : NULL;
+      $id = $fldNameParts[0];
+      $first = isset($fldNameParts[1]) ? $fldNameParts[1] : NULL;
+      $second = isset($fldNameParts[2]) ? $fldNameParts[2] : NULL;
       if (($first == 'a' && $second == 'b') ||
         ($first == 'b' && $second == 'a')
       ) {
@@ -344,7 +348,8 @@ class CRM_Contact_Import_ImportJob {
    *
    * @return array|bool
    */
-  private function _addImportedContactsToNewGroup($contactIds,
+  private function _addImportedContactsToNewGroup(
+    $contactIds,
     $newGroupName, $newGroupDesc
   ) {
 
@@ -397,7 +402,8 @@ class CRM_Contact_Import_ImportJob {
    *
    * @return array|bool
    */
-  private function _tagImportedContactsWithNewTag($contactIds,
+  private function _tagImportedContactsWithNewTag(
+    $contactIds,
     $newTagName, $newTagDesc
   ) {
 
@@ -450,9 +456,9 @@ class CRM_Contact_Import_ImportJob {
    * @return array
    */
   public static function getIncompleteImportTables() {
-    $dao      = new CRM_Core_DAO();
+    $dao = new CRM_Core_DAO();
     $database = $dao->database();
-    $query    = "SELECT   TABLE_NAME FROM INFORMATION_SCHEMA
+    $query = "SELECT   TABLE_NAME FROM INFORMATION_SCHEMA
                   WHERE    TABLE_SCHEMA = ? AND
                            TABLE_NAME LIKE 'civicrm_import_job_%'
                   ORDER BY TABLE_NAME";
@@ -466,4 +472,3 @@ class CRM_Contact_Import_ImportJob {
     return $incompleteImportTables;
   }
 }
-