Merge pull request #1099 from ravishnair/CiviHR
[civicrm-core.git] / CRM / Profile / Form / Edit.php
index 0770be538426b15b7bd01f6c6f7da721d75e3dc9..a18db50c9eeacdeef43f650665309e4a1c5e551b 100644 (file)
@@ -62,6 +62,8 @@ class CRM_Profile_Form_Edit extends CRM_Profile_Form {
   function preProcess() {
     $this->_mode = CRM_Profile_Form::MODE_CREATE;
 
+    $this->_onPopupClose = CRM_Utils_Request::retrieve('onPopupClose', 'String', $this);
+
     //set the context for the profile
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
 
@@ -212,7 +214,14 @@ SELECT module
 
         //passing the post url to template so the popup form does
         //proper redirection and proccess form errors if any
-        $popupRedirect = CRM_Utils_System::url('civicrm/profile/edit', $urlParams, FALSE, NULL, FALSE);
+        if (!isset($this->_onPopupClose) || $this->_onPopupClose == 'redirectToProfile') {
+          $popupRedirect = CRM_Utils_System::url('civicrm/profile/edit', $urlParams, FALSE, NULL, FALSE);
+        }
+        elseif ($this->_onPopupClose == 'redirectToTab') {
+          $popupRedirect = CRM_Utils_System::url('civicrm/contact/view', 
+            "reset=1&cid={$this->_id}&selectedChild=custom_{$this->_customGroupId}", FALSE, NULL, FALSE);
+        }
+
         $this->assign('urlParams', $urlParams);
         $this->assign('postUrl', $popupRedirect);
       }