From bd8766139068751de1dce807ca0b3b98b9e285c5 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 6 Mar 2015 10:27:00 -0500 Subject: [PATCH] CRM-16063 - Set is_active default at the api layer --- CRM/Mailing/Info.php | 2 -- api/v3/MailingComponent.php | 12 +++++++++++- api/v3/MessageTemplate.php | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php index ae39a6e230..fb3c94c2e1 100644 --- a/CRM/Mailing/Info.php +++ b/CRM/Mailing/Info.php @@ -101,7 +101,6 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { $mailStatus = civicrm_api3('MailingJob', 'get', array()); $groupNames = civicrm_api3('Group', 'get', array()); $headerfooterList = civicrm_api3('MailingComponent', 'get', array( - 'is_active' => 1, 'options' => array( 'limit' => 0, ), @@ -115,7 +114,6 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info { $mesTemplate = civicrm_api3('MessageTemplate', 'get', array( 'sequential' => 1, 'return' => array("msg_html", "id", "msg_title", "msg_subject", "msg_text"), - 'is_active' => 1, 'workflow_id' => array('IS NULL' => ""), )); $mailGrp = civicrm_api3('MailingGroup', 'get', array()); diff --git a/api/v3/MailingComponent.php b/api/v3/MailingComponent.php index db953772ed..a44f6fd36e 100644 --- a/api/v3/MailingComponent.php +++ b/api/v3/MailingComponent.php @@ -26,7 +26,7 @@ */ /** - * This api exposes CiviCRM MailingComponent. + * This api exposes CiviCRM MailingComponent (header and footer). * * @package CiviCRM_APIv3 */ @@ -56,6 +56,16 @@ function civicrm_api3_mailing_component_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } +/** + * Adjust metadata for get. + * + * @param array $params + */ +function _civicrm_api3_mailing_component_get_spec(&$params) { + // fetch active records by default + $params['is_active']['api.default'] = 1; +} + /** * Delete a MailingComponent. * diff --git a/api/v3/MessageTemplate.php b/api/v3/MessageTemplate.php index 1623a5ba85..370cb833a0 100644 --- a/api/v3/MessageTemplate.php +++ b/api/v3/MessageTemplate.php @@ -77,6 +77,8 @@ function civicrm_api3_message_template_delete($params) { * @param array $params */ function _civicrm_api3_message_template_get_spec(&$params) { + // fetch active records by default + $params['is_active']['api.default'] = 1; } /** -- 2.25.1