CRM-15578 - Mailing.submit API - Accept "approval_note"
authorTim Otten <totten@civicrm.org>
Sat, 20 Dec 2014 03:06:03 +0000 (19:06 -0800)
committerTim Otten <totten@civicrm.org>
Sat, 20 Dec 2014 07:18:32 +0000 (23:18 -0800)
api/v3/Mailing.php

index 222002d44c890315f7873d29f3897f937394e415..d20a79f564857dc7baa4c23fedf65cb7869ea131 100755 (executable)
@@ -62,6 +62,7 @@ function civicrm_api3_mailing_create($params, $ids = array()) {
       unset($params['approval_date']);
       unset($params['approver_id']);
       unset($params['approval_status_id']);
+      unset($params['approval_note']);
     }
   }
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -132,6 +133,8 @@ function _civicrm_api3_mailing_submit_spec(&$spec) {
   $spec['id'] = $mailingFields['id'];
   $spec['scheduled_date'] = $mailingFields['scheduled_date'];
   $spec['approval_date'] = $mailingFields['approval_date'];
+  $spec['approval_status_id'] = $mailingFields['approval_status_id'];
+  $spec['approval_note'] = $mailingFields['approval_note'];
 }
 
 /**
@@ -164,6 +167,9 @@ function civicrm_api3_mailing_submit($params) {
     $updateParams['approver_id'] = CRM_Core_Session::getLoggedInContactID();
     $updateParams['approval_status_id'] = CRM_Utils_Array::value('approval_status_id', $updateParams, CRM_Core_OptionGroup::getDefaultValue('mail_approval_status'));
   }
+  if (isset($params['approval_note'])) {
+    $updateParams['approval_note'] = $params['approval_note'];
+  }
 
   $updateParams['options']['reload'] = 1;
   return civicrm_api3('Mailing', 'create', $updateParams);