Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#2066 Use shared function to set the next url #18773

Merged
merged 1 commit into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions CRM/Campaign/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,7 @@ public function preProcess() {
$this->_voterIds = $this->_contactIds = $this->_componentIds = $ids;

$this->assign('totalSelectedContacts', count($this->_contactIds));

//set the context for redirection for any task actions
$session = CRM_Core_Session::singleton();
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= '&qfKey=' . $qfKey;
}
$session->replaceUserContext(CRM_Utils_System::url('civicrm/survey/search', $urlParams));
$this->setNextUrl('survey');
}

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

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

//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/event/search', $urlParams));
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
$urlParams
));
}
$form->setNextUrl('event');
}

/**
Expand Down
10 changes: 1 addition & 9 deletions CRM/Grant/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,7 @@ public static function preProcessCommon(&$form) {

$form->_grantIds = $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();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/grant/search', $urlParams));
$form->setNextUrl('grant');
}

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

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

//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/member/search', $urlParams));
}
else {
$session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName",
$urlParams
));
}
$form->setNextUrl('member');
}

/**
Expand Down
13 changes: 2 additions & 11 deletions CRM/Pledge/Form/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function preProcess() {
/**
* Common pre-processing.
*
* @param CRM_Core_Form $form
* @param CRM_Pledge_Form_Task $form
*/
public static function preProcessCommon(&$form) {
$form->_pledgeIds = [];
Expand Down Expand Up @@ -79,16 +79,7 @@ public static function preProcessCommon(&$form) {
}

$form->_pledgeIds = $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();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/pledge/search', $urlParams));
$form->setNextUrl('pledge');
}

/**
Expand Down