Merge pull request #3341 from systopia/CRM-14740
[civicrm-core.git] / CRM / Contact / Form / Inline / ContactInfo.php
index 2fff7bc931d298e17f1e3ee43bdea7dfcece41c6..796aefed89b8e37e25580a12d2267629422743cf 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -59,17 +59,7 @@ class CRM_Contact_Form_Inline_ContactInfo extends CRM_Contact_Form_Inline {
    * @access public
    */
   public function setDefaultValues() {
-    $defaults = parent::setDefaultValues();
-
-    if ($this->_contactType == 'Individual') {
-      // set current employer details
-      $currentEmployer = CRM_Contact_BAO_Relationship::getCurrentEmployer(array($this->_contactId));
-      $defaults['current_employer_id'] = CRM_Utils_Array::value('org_id', $currentEmployer[$this->_contactId]);
-
-      $this->assign('currentEmployer', CRM_Utils_Array::value('current_employer_id', $defaults));
-    }
-
-    return $defaults;
+    return parent::setDefaultValues();
   }
 
   /**
@@ -91,6 +81,11 @@ class CRM_Contact_Form_Inline_ContactInfo extends CRM_Contact_Form_Inline {
 
     CRM_Contact_BAO_Contact::create($params);
 
+    // Saving current employer affects relationship tab
+    $this->ajaxResponse['updateTabs'] = array(
+      '#tab_rel' => CRM_Contact_BAO_Contact::getCountComponent('rel', $this->_contactId),
+    );
+
     $this->response();
   }
 }