Merge pull request #4692 from kurund/CRM-14696
[civicrm-core.git] / CRM / Contact / Form / RelatedContact.php
index fc0617ab3fd13ee6b2edfc061c244711e8210c9f..ec8a205936a4c01becae6ceb4d847c807326ba48 100644 (file)
@@ -58,14 +58,14 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
   public $_contactId;
 
   /**
-   * form defaults
+   * Form defaults
    *
    * @var array
    */
   protected $_defaults = array();
 
   /**
-   * build all the data structures needed to build the form
+   * Build all the data structures needed to build the form
    *
    * @return void
    * @access public
@@ -104,7 +104,7 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
   }
 
   /**
-   * This function sets the default values for the form. Note that in edit/view mode
+   * Set default values for the form. Note that in edit/view mode
    * the default values are retrieved from the database
    *
    * @access public
@@ -116,7 +116,7 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
   }
 
   /**
-   * Function to actually build the form
+   * Build the form object
    *
    * @return void
    * @access public
@@ -181,6 +181,10 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
     }
 
     $params['contact_type'] = $this->_contactType;
+    //CRM-14904
+    if ( isset($this->_defaults['contact_sub_type']) ) {
+      $params['contact_sub_type'] = $this->_defaults['contact_sub_type'];
+    }
     $params['contact_id'] = $this->_contactId;
 
     $contact = CRM_Contact_BAO_Contact::create($params, TRUE);