Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-04-04-00-08-28
[civicrm-core.git] / api / v3 / Job.php
index 06316253c6da0ded0e50ace19066254d92f10cf8..aa5d8ae351df3ce1ddae0c928b485ced265eaab6 100644 (file)
@@ -3,9 +3,9 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -34,7 +34,7 @@
  *
  * @package CiviCRM_APIv3
  * @subpackage API_Job
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id: Contact.php 30879 2010-11-22 15:45:55Z shot $
  *
  */
@@ -190,7 +190,7 @@ function civicrm_api3_job_send_reminder($params) {
     return civicrm_api3_create_error('Could not acquire lock, another EmailProcessor process is running');
   }
 
-  $result = CRM_Core_BAO_ActionSchedule::processQueue(CRM_Utils_Array::value('now', $params));
+  $result = CRM_Core_BAO_ActionSchedule::processQueue(CRM_Utils_Array::value('now', $params), $params);
   $lock->release();
 
   if ($result['is_error'] == 0) {
@@ -200,7 +200,20 @@ function civicrm_api3_job_send_reminder($params) {
     return civicrm_api3_create_error($result['messages']);
   }
 }
-
+/**
+ * Adjust metadata for "send_reminder" action
+ *
+ * The metadata is used for setting defaults, documentation & validation
+ * @param array $params array or parameters determined by getfields
+ */
+function _civicrm_api3_job_send_reminder(&$params) {
+  //@todo this function will now take all fields in action_schedule as params
+  // as it is calling the api fn to set the filters - update getfields to reflect
+  $params['id'] = array(
+    'type' => CRM_Utils_Type::T_INT,
+    'title' => 'Action Schedule ID'
+  );
+}
 /**
  * Execute a specific report instance and send the output via email
  *
@@ -421,7 +434,7 @@ function civicrm_api3_job_process_participant($params) {
 function civicrm_api3_job_process_membership($params) {
   $lock = new CRM_Core_Lock('civimail.job.updateMembership');
   if (!$lock->isAcquired()) {
-    return civicrm_api3_create_error('Could not acquire lock, another EmailProcessor process is running');
+    return civicrm_api3_create_error('Could not acquire lock, another Membership Processing process is running');
   }
 
   $result = CRM_Member_BAO_Membership::updateAllMembershipStatus();