From 3a2e7d2bddbce82e1bc8cc686ee1b841da10d39c Mon Sep 17 00:00:00 2001 From: Ravish Nair Date: Mon, 29 Jul 2013 15:12:45 +0530 Subject: [PATCH] -- CRM-13037 fix for Navigating among tabs produces wrong popups ---------------------------------------- * CRM-13037: http://issues.civicrm.org/jira/browse/CRM-13037 --- CRM/Profile/Form/Edit.php | 1 + CRM/Profile/Page/MultipleRecordFieldsListing.php | 9 +++++---- .../CRM/Profile/Page/MultipleRecordFieldsListing.tpl | 11 +++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index 5de91aab3d..e63229577f 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -63,6 +63,7 @@ class CRM_Profile_Form_Edit extends CRM_Profile_Form { $this->_mode = CRM_Profile_Form::MODE_CREATE; $this->_onPopupClose = CRM_Utils_Request::retrieve('onPopupClose', 'String', $this); + $this->assign('onPopupClose', $this->_onPopupClose); //set the context for the profile $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); diff --git a/CRM/Profile/Page/MultipleRecordFieldsListing.php b/CRM/Profile/Page/MultipleRecordFieldsListing.php index 81bc7bd191..9ac8ea0fad 100644 --- a/CRM/Profile/Page/MultipleRecordFieldsListing.php +++ b/CRM/Profile/Page/MultipleRecordFieldsListing.php @@ -75,21 +75,21 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $links[CRM_Core_Action::VIEW] = array( 'name' => ts('View'), 'url' => 'civicrm/profile/view', - 'qs' => "id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$view}&snippet=1&context=multiProfileDialog", + 'qs' => "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$view}&snippet=1&context=multiProfileDialog&onPopupClose=%%onPopupClose%%", 'title' => ts('View %1', array( 1 => $this->_customGroupTitle . ' record')), ); $links[CRM_Core_Action::UPDATE] = array( 'name' => ts('Edit'), 'url' => 'civicrm/profile/edit', - 'qs' => "id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$update}&snippet=1&context=multiProfileDialog", + 'qs' => "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$update}&snippet=1&context=multiProfileDialog&onPopupClose=%%onPopupClose%%", 'title' => ts('Edit %1', array( 1 => $this->_customGroupTitle . ' record')), ); $links[CRM_Core_Action::DELETE] = array( 'name' => ts('Delete'), 'url' => 'civicrm/profile/edit', - 'qs' => "id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$delete}&snippet=1&context=multiProfileDialog", + 'qs' => "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$delete}&snippet=1&context=multiProfileDialog&onPopupClose=%%onPopupClose%%", 'title' => ts('Delete %1', array( 1 => $this->_customGroupTitle . ' record')), ); @@ -112,6 +112,7 @@ 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); @@ -229,7 +230,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $customValue = ""; } $actionParams = array('recordId' => $recId, 'gid' => $this->_profileId, - 'id' => $this->_contactId); + 'id' => $this->_contactId, 'onPopupClose' => $this->_onPopupClose); if ($pageCheckSum) { $actionParams['cs'] = $pageCheckSum; } diff --git a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl index 1533131372..3dec6a66c4 100644 --- a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl +++ b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl @@ -62,7 +62,7 @@ {/if} {if !$reachedMax} -
{ts}Add New Record{/ts}
{/if} {/if} @@ -91,12 +91,15 @@ }}); } + var profileName = {/literal}"{$ufGroupName}"{literal}; cj('.action-item').each(function () { - cj(this).attr('jshref', cj(this).attr('href')); - cj(this).attr('href', '#browseValues'); + if (!cj(this).attr('jshref')) { + cj(this).attr('jshref', cj(this).attr('href')); + cj(this).attr('href', '#browseValues'); + } }); - cj(".action-item").click(function () { + cj(".crm-profile-name-" + profileName + " .action-item").click(function () { dataURL = cj(this).attr('jshref'); dialogTitle = cj(this).attr('title'); formDialog(dataURL, dialogTitle); -- 2.25.1