Merge pull request #22629 from braders/attachmentInfo-docblock
[civicrm-core.git] / CRM / Campaign / Form / Task.php
index 61411931d0ad3017097b620e3bd4e50440334711..924e49ed4f29b6d772ff7c4dee7d476521b3e09e 100644 (file)
@@ -35,15 +35,9 @@ class CRM_Campaign_Form_Task extends CRM_Core_Form_Task {
 
     $this->_task = $values['task'];
 
-    $ids = [];
-    if ($values['radio_ts'] == 'ts_sel') {
-      foreach ($values as $name => $value) {
-        if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
-          $ids[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
-        }
-      }
-    }
-    else {
+    $ids = $this->getSelectedIDs($values);
+
+    if (!$ids) {
       $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
       $cacheKey = "civicrm search {$qfKey}";
       $allCids = Civi::service('prevnext')->getSelection($cacheKey, "getall");
@@ -58,15 +52,7 @@ class CRM_Campaign_Form_Task extends CRM_Core_Form_Task {
     $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');
   }
 
   /**