From da6cc247ed5a1199bbafa5e51ea0868804d4a085 Mon Sep 17 00:00:00 2001 From: Tim Mallezie Date: Thu, 6 Aug 2015 12:19:07 +0200 Subject: [PATCH] CRM-16976 allow to filter campaigns based on active state --- CRM/Campaign/Form/Search/Campaign.php | 8 ++++++++ CRM/Campaign/Page/AJAX.php | 2 +- templates/CRM/Campaign/Form/Search/Campaign.tpl | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CRM/Campaign/Form/Search/Campaign.php b/CRM/Campaign/Form/Search/Campaign.php index 188b4029ef..01989937fa 100755 --- a/CRM/Campaign/Form/Search/Campaign.php +++ b/CRM/Campaign/Form/Search/Campaign.php @@ -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) { diff --git a/CRM/Campaign/Page/AJAX.php b/CRM/Campaign/Page/AJAX.php index 423e5903f6..dc036e05ce 100644 --- a/CRM/Campaign/Page/AJAX.php +++ b/CRM/Campaign/Page/AJAX.php @@ -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]; } } diff --git a/templates/CRM/Campaign/Form/Search/Campaign.tpl b/templates/CRM/Campaign/Form/Search/Campaign.tpl index b81c952b39..8c54e470c2 100755 --- a/templates/CRM/Campaign/Form/Search/Campaign.tpl +++ b/templates/CRM/Campaign/Form/Search/Campaign.tpl @@ -115,6 +115,9 @@ {$form.status_id.label}
{$form.status_id.html} + {$form.is_active.label}
+ {$form.is_active.html} + -- 2.25.1