Merge pull request #18891 from civicrm/5.31
[civicrm-core.git] / CRM / Grant / Form / Task.php
index b983cec3d72afac8c84b7804bc115370af162b88..a5096f91603ad4aa5586394e7c115ddc5a780d6f 100644 (file)
@@ -34,19 +34,20 @@ class CRM_Grant_Form_Task extends CRM_Core_Form_Task {
   }
 
   /**
-   * @param CRM_Core_Form $form
+   * @param \CRM_Core_Form_Task $form
+   *
+   * @throws \CRM_Core_Exception
    */
   public static function preProcessCommon(&$form) {
     $form->_grantIds = [];
 
-    $values = $form->controller->exportValues($form->get('searchFormName'));
+    $values = $form->getSearchFormValues();
 
     $form->_task = $values['task'];
     $tasks = CRM_Grant_Task::tasks();
     if (!array_key_exists($form->_task, $tasks)) {
       CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
     }
-    $form->assign('taskName', $tasks[$form->_task]);
 
     $ids = [];
     if ($values['radio_ts'] == 'ts_sel') {
@@ -80,15 +81,7 @@ class CRM_Grant_Form_Task extends CRM_Core_Form_Task {
 
     $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');
   }
 
   /**