X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FActionSchedule.php;h=505a849143992637ac65e80da875bbd59438607f;hb=85bb0909cffd925f4cd5c0022a68a1ff74d3ad8e;hp=46b7cef59d3b0225763a243d3c1abb956509a6c1;hpb=2abb83f193041162f242b3636534a3cdf9155d5c;p=civicrm-core.git diff --git a/api/v3/ActionSchedule.php b/api/v3/ActionSchedule.php index 46b7cef59d..505a849143 100644 --- a/api/v3/ActionSchedule.php +++ b/api/v3/ActionSchedule.php @@ -2,9 +2,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. | | | @@ -32,7 +32,7 @@ * @package CiviCRM_APIv3 * @subpackage API_ActionSchedule * - * @copyright CiviCRM LLC (c) 2004-2013 + * @copyright CiviCRM LLC (c) 2004-2014 * */ @@ -42,11 +42,7 @@ * */ function civicrm_api3_action_schedule_get($params) { - $bao = new CRM_Core_BAO_ActionSchedule(); - _civicrm_api3_dao_set_filter($bao, $params, true, 'ActionSchedule'); - $actionSchedules = _civicrm_api3_dao_to_array($bao, $params, true,'ActionSchedule'); - - return civicrm_api3_create_success($actionSchedules, $params, 'action_schedule', 'get', $bao); + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'action_schedule'); } @@ -60,33 +56,11 @@ function civicrm_api3_action_schedule_get($params) { * {@getfields action_schedule_create} */ function civicrm_api3_action_schedule_create($params) { - if (!CRM_Utils_Array::value('id', $params)) { - // an update does not require any mandatory parameters - civicrm_api3_verify_one_mandatory($params, - NULL, - array( - 'title','mapping_id', 'entity_status', 'entity_value', - ) - ); - } - - $ids = array(); - if (isset($params['id']) && !CRM_Utils_Rule::integer($params['id'])) { - return civicrm_api3_create_error('Invalid value for ID'); - } - + civicrm_api3_verify_one_mandatory($params, NULL, array('start_action_date', 'absolute_date')); if (!array_key_exists('name', $params) && !array_key_exists('id', $params)) { $params['name'] = CRM_Utils_String::munge($params['title']); } - - $actionSchedule = new CRM_Core_BAO_ActionSchedule(); - $actionSchedule = CRM_Core_BAO_ActionSchedule::add($params, $ids); - - $actSchedule = array(); - - _civicrm_api3_object_to_array($actionSchedule, $actSchedule[$actionSchedule->id]); - - return civicrm_api3_create_success($actSchedule, $params, 'action_schedule', 'create', $actionSchedule); + return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'action_schedule'); } /** @@ -96,18 +70,19 @@ function civicrm_api3_action_schedule_create($params) { * @param array $params array or parameters determined by getfields */ function _civicrm_api3_action_schedule_create_spec(&$params) { - unset($params['version']); + $params['title']['api.required'] = TRUE; + $params['mapping_id']['api.required'] = TRUE; +// $params['entity_status']['api.required'] = TRUE; + $params['entity_value']['api.required'] = TRUE; } /** * delete an existing action_schedule * + * @param array $params array containing id of the action_schedule + * to be deleted * - * @param array $params (reference) array containing id of the action_schedule - * to be deleted - * - * @return array (referance) returns flag true if successfull, error - * message otherwise + * @return array API result array * * @access public */