CRM-16976 allow to filter campaigns based on active state
authorTim Mallezie <tim.mallezie@chiro.be>
Thu, 6 Aug 2015 10:19:07 +0000 (12:19 +0200)
committerTim Mallezie <tim.mallezie@chiro.be>
Thu, 6 Aug 2015 10:19:07 +0000 (12:19 +0200)
CRM/Campaign/Form/Search/Campaign.php
CRM/Campaign/Page/AJAX.php
templates/CRM/Campaign/Form/Search/Campaign.tpl

index 188b4029ef9ff214e4e2f2c9fd0e7f66808e1f90..01989937fa2411a9d355c18e39468d0cbff6ace3 100755 (executable)
@@ -112,6 +112,14 @@ class CRM_Campaign_Form_Search_Campaign extends CRM_Core_Form {
     $this->set('campaignStatus', $campaignStatus);
     $this->assign('campaignStatus', json_encode($campaignStatus));
 
+    //active campaigns
+    $this->addElement('select', 'is_active', ts('Is Actief?'), array(
+      '' => ts('- select -'),
+      '0' => ts('Yes'),
+      '1' => ts('No'),
+        )
+    );
+
     //build the array of all search params.
     $this->_searchParams = array();
     foreach ($this->_elements as $element) {
index 423e5903f695ced06135cdb786ff23c5ff2b9dc5..dc036e05ce3707869dfeb61cb2bd50766cb6ebfc 100644 (file)
@@ -573,7 +573,7 @@ class CRM_Campaign_Page_AJAX {
 
     $params = $searchRows = array();
     foreach ($searchParams as $param) {
-      if (!empty($_POST[$param])) {
+      if (isset($_POST[$param])) {
         $params[$param] = $_POST[$param];
       }
     }
index b81c952b39e62de40f1e69a622a60a15314561d9..8c54e470c2a9c1c738d5717c901895347f091a43 100755 (executable)
               <td>{$form.status_id.label}<br/>
                 {$form.status_id.html}
               </td>
+              <td>{$form.is_active.label}<br/>
+                {$form.is_active.html}
+              </td>
             </tr>
 
             <tr>