From 7ab9bfe887ee64514fcb27bd8b7fc413ebd38fab Mon Sep 17 00:00:00 2001
From: Pratik Joshi <pratik.joshi@webaccess.co.in>
Date: Fri, 28 Mar 2014 14:44:42 +0530
Subject: [PATCH] CRM-14400

---
 CRM/Profile/Form/Edit.php                     | 24 ------------------
 .../Page/MultipleRecordFieldsListing.php      |  9 +++----
 templates/CRM/Profile/Form/Dynamic.tpl        | 25 -------------------
 3 files changed, 4 insertions(+), 54 deletions(-)

diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php
index 0ff19796b3..4c5289b4f8 100644
--- a/CRM/Profile/Form/Edit.php
+++ b/CRM/Profile/Form/Edit.php
@@ -203,30 +203,6 @@ SELECT module
         }
       }
 
-      if ($this->_multiRecordProfile) {
-        $urlParams = "reset=1&id={$this->_id}&gid={$gidString}";
-
-        // get checksum if present
-        if ($this->get('cs')) {
-          $urlParams .= "&cs=" . $this->get('cs');
-        }
-        $this->_postURL = CRM_Utils_System::url('civicrm/profile/edit', $urlParams);
-        $this->_cancelURL = CRM_Utils_System::url('civicrm/profile/edit', $urlParams);
-
-        //passing the post url to template so the popup form does
-        //proper redirection and proccess form errors if any
-        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);
-      }
-
       // we do this gross hack since qf also does entity replacement
       $this->_postURL = str_replace('&amp;', '&', $this->_postURL);
       $this->_cancelURL = str_replace('&amp;', '&', $this->_cancelURL);
diff --git a/CRM/Profile/Page/MultipleRecordFieldsListing.php b/CRM/Profile/Page/MultipleRecordFieldsListing.php
index 316edbc0f2..2631801728 100644
--- a/CRM/Profile/Page/MultipleRecordFieldsListing.php
+++ b/CRM/Profile/Page/MultipleRecordFieldsListing.php
@@ -96,13 +96,13 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic {
       // urls and queryStrings
       if ($this->_pageViewType == 'profileDataView') {
         $links[CRM_Core_Action::VIEW]['url'] = 'civicrm/profile/view';
-        $links[CRM_Core_Action::VIEW]['qs'] = "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$view}&context=multiProfileDialog&onPopupClose=%%onPopupClose%%";
+        $links[CRM_Core_Action::VIEW]['qs'] = "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$view}";
 
         $links[CRM_Core_Action::UPDATE]['url'] = 'civicrm/profile/edit';
-        $links[CRM_Core_Action::UPDATE]['qs'] = "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$update}&context=multiProfileDialog&onPopupClose=%%onPopupClose%%";
+        $links[CRM_Core_Action::UPDATE]['qs'] = "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$update}";
 
         $links[CRM_Core_Action::DELETE]['url'] = 'civicrm/profile/edit';
-        $links[CRM_Core_Action::DELETE]['qs'] = "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$delete}&context=multiProfileDialog&onPopupClose=%%onPopupClose%%";
+        $links[CRM_Core_Action::DELETE]['qs'] = "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$delete}";
 
       }
       elseif ($this->_pageViewType == 'customDataView') {
@@ -143,7 +143,6 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic {
   function run() {
     // get the requested action, default to 'browse'
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, FALSE);
-    $this->_onPopupClose = CRM_Utils_Request::retrieve('onPopupClose', 'String', $this);
 
     // assign vars to templates
     $this->assign('action', $action);
@@ -305,7 +304,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic {
               $op = NULL;
               if ($this->_pageViewType == 'profileDataView') {
                 $actionParams = array('recordId' => $recId, 'gid' => $this->_profileId,
-                  'id' => $this->_contactId, 'onPopupClose' => $this->_onPopupClose);
+                  'id' => $this->_contactId);
                 $op = 'profile.multiValue.row';
               }
               else {
diff --git a/templates/CRM/Profile/Form/Dynamic.tpl b/templates/CRM/Profile/Form/Dynamic.tpl
index 9907249f85..8356500363 100644
--- a/templates/CRM/Profile/Form/Dynamic.tpl
+++ b/templates/CRM/Profile/Form/Dynamic.tpl
@@ -28,31 +28,6 @@
 
 {* Profile forms when embedded in CMS account create (mode=1) or
     cms account edit (mode=8) or civicrm/profile (mode=4) pages *}
-{if ($context eq 'multiProfileDialog')}
-{literal}
-<script type="text/javascript">
-cj(function($) {
-  $('#profile-dialog .crm-container-snippet #Edit').validate(CRM.validate.params);
-  var formOptions = {
-    success:       checkResponse  // post-submit callback 
-  };
-
-  //binding the callback to snippet profile form
-  $('.crm-container-snippet #Edit').ajaxForm(formOptions);
-});
-
-// post-submit callback 
-function checkResponse(responseText, statusText, xhr, $form) { 
-  //if there is any form error show the dialog
-  //else redirect to post url
-  if (!cj(responseText).find('.crm-error').html()) {
-    window.location.href = '{/literal}{$postUrl}{literal}';
-  }
-} 
-</script>
-{/literal}
-{include file="CRM/Form/validate.tpl"}
-{/if}
 {if $deleteRecord}
 <div class="messages status no-popup">
   <div class="icon inform-icon"></div>&nbsp;
-- 
GitLab