From: yashodha Date: Tue, 18 Aug 2015 13:12:59 +0000 (+0530) Subject: CRM-10808: Campaign filter not available for Mailings in Adv Search but is on Schedul... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=04cac635e093dbb4659e5890f1aac66b37f84dc7;p=civicrm-core.git CRM-10808: Campaign filter not available for Mailings in Adv Search but is on Scheduled Mailings etc ---------------------------------------- * CRM-10808: Campaign filter not available for Mailings in Adv Search but is on Scheduled Mailings etc https://issues.civicrm.org/jira/browse/CRM-10808 --- diff --git a/CRM/Mailing/BAO/Query.php b/CRM/Mailing/BAO/Query.php index 7b8e0cd0c2..8305322a5b 100644 --- a/CRM/Mailing/BAO/Query.php +++ b/CRM/Mailing/BAO/Query.php @@ -123,6 +123,12 @@ class CRM_Mailing_BAO_Query { $query->_element['mailing_recipients_id'] = 1; } } + + if (CRM_Utils_Array::value('mailing_campaign_id', $query->_returnProperties)) { + $query->_select['mailing_campaign_id'] = 'civicrm_mailing.campaign_id as mailing_campaign_id'; + $query->_element['mailing_campaign_id'] = 1; + $query->_tables['civicrm_campaign'] = 1; + } } /** @@ -207,6 +213,7 @@ class CRM_Mailing_BAO_Query { if ($mode & CRM_Contact_BAO_Query::MODE_MAILING) { $properties = array( 'mailing_id' => 1, + 'mailing_campaign_id' => 1, 'mailing_name' => 1, 'sort_name' => 1, 'email' => 1, @@ -375,6 +382,17 @@ class CRM_Mailing_BAO_Query { $query->_qill[$grouping][] = "Mailing Job Status IS \"$value\""; } return; + + case 'mailing_campaign_id': + $campParams = array( + 'op' => $op, + 'campaign' => $value, + 'grouping' => $grouping, + 'tableName' => 'civicrm_mailing', + ); + CRM_Campaign_BAO_Query::componentSearchClause($campParams, $query); + $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1; + return; } } @@ -423,6 +441,9 @@ class CRM_Mailing_BAO_Query { $form->add('checkbox', 'mailing_unsubscribe', ts('Unsubscribe Requests')); $form->add('checkbox', 'mailing_optout', ts('Opt-out Requests')); $form->add('checkbox', 'mailing_forward', ts('Forwards')); + + // Campaign select field + CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'mailing_campaign_id'); $form->assign('validCiviMailing', TRUE); } diff --git a/CRM/Mailing/Form/Schedule.php b/CRM/Mailing/Form/Schedule.php index bed7590956..5d83daa674 100644 --- a/CRM/Mailing/Form/Schedule.php +++ b/CRM/Mailing/Form/Schedule.php @@ -279,6 +279,8 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form { $params[$parameter] = $this->controller->exportValue($this->_name, $parameter); } + dpm($this->controller->exportValues(), 'values'); + // Previously, we checked if $mailing->is_template, and did *not* // schedule if it was set. Discussed with Lobo, removed that check // as it appeared to prevent mails being scheduled if they were diff --git a/templates/CRM/Mailing/Form/Search/Common.tpl b/templates/CRM/Mailing/Form/Search/Common.tpl index cb24ac6180..a309a36c1b 100644 --- a/templates/CRM/Mailing/Form/Search/Common.tpl +++ b/templates/CRM/Mailing/Form/Search/Common.tpl @@ -65,3 +65,9 @@ + + {* campaign in Advance search *} + {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignContext="componentSearch" + campaignTrClass='crmCampaign' campaignTdClass='crmCampaignContainer'} + +