CRM-16063 - Set is_active default at the api layer
authorColeman Watts <coleman@civicrm.org>
Fri, 6 Mar 2015 15:27:00 +0000 (10:27 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 6 Mar 2015 15:27:00 +0000 (10:27 -0500)
CRM/Mailing/Info.php
api/v3/MailingComponent.php
api/v3/MessageTemplate.php

index ae39a6e23082c6a936d223e79fd03ab45d6c5526..fb3c94c2e1b3ca42bb190a1fcb206a1f16c01953 100644 (file)
@@ -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());
index db953772ed44c1f112fe351f6f833bf0fb338611..a44f6fd36efc9ec8278109b2788494831d918d91 100644 (file)
@@ -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.
  *
index 1623a5ba85fe16bfa274e4b3d3c61962aff1b7cb..370cb833a057f8e1af8c361d8cef03759f572f5f 100644 (file)
@@ -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;
 }
 
 /**