Skip to content

Commit

Permalink
Merge pull request #18767 from eileenmcnaughton/task
Browse files Browse the repository at this point in the history
dev/core#2066 Use shared function to set the next url
  • Loading branch information
mattwire authored Oct 14, 2020
2 parents 58ebeee + faa31fa commit 8eda840
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 38 deletions.
19 changes: 1 addition & 18 deletions CRM/Activity/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,7 @@ public static function preProcessCommon(&$form) {
}

$form->_activityHolderIds = $form->_componentIds = $ids;

// Set the context for redirection for any task actions.
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey=$qfKey";
}

$session = CRM_Core_Session::singleton();
$searchFormName = strtolower($form->get('searchFormName'));
if ($searchFormName == 'search') {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/activity/search', $urlParams));
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
$urlParams
));
}
$form->setNextUrl('activity');
}

/**
Expand Down
20 changes: 1 addition & 19 deletions CRM/Contribute/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,7 @@ public static function preProcessCommon(&$form) {

$form->_contributionIds = $form->_componentIds = $ids;
$form->set('contributionIds', $form->_contributionIds);

//set the context for redirection for any task actions
$session = CRM_Core_Session::singleton();

$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey=$qfKey";
}

$searchFormName = strtolower($form->get('searchFormName'));
if ($searchFormName == 'search') {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contribute/search', $urlParams));
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
$urlParams
));
}
$form->setNextUrl('contribute');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ abstract class CRM_Core_Form_Task extends CRM_Core_Form {
*
* @throws \CRM_Core_Exception
*/
protected function setNextUrl(string $pathPart) {
public function setNextUrl(string $pathPart) {
//set the context for redirection for any task actions
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlParams = 'force=1';
Expand Down

0 comments on commit 8eda840

Please sign in to comment.