X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FContribution.php;h=0b5b5acc2b164a06082acf14b132d08ec3097846;hb=85bb0909cffd925f4cd5c0022a68a1ff74d3ad8e;hp=4394e0628fa769faa016c0f2d0a6dd3049ee1e8d;hpb=b319421df58cfbeb99ca3016a8315b56690458ba;p=civicrm-core.git diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 4394e0628f..0b5b5acc2b 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -40,8 +40,9 @@ /** * Add or update a contribution * - * @param array $params (reference ) input parameters + * @param array $params (reference ) input parameters * + * @throws API_Exception * @return array Api result array * @static void * @access public @@ -162,8 +163,9 @@ function _civicrm_api3_contribution_delete_spec(&$params) { /** * Retrieve a set of contributions, given a set of input params * - * @param array $params (reference ) input parameters - * @param array $returnProperties Which properties should be included in the + * @param array $params (reference ) input parameters + * + * @internal param array $returnProperties Which properties should be included in the * returned Contribution object. If NULL, the default * set of properties will be included. * @@ -224,11 +226,13 @@ function _civicrm_api3_contribution_get_spec(&$params) { * take the input parameter list as specified in the data model and * convert it into the same format that we use in QF and BAO object * - * @param array $params Associative array of property name/value + * @param array $params Associative array of property name/value * pairs to insert in new contact. - * @param array $values The reformatted properties that we can use internally + * @param array $values The reformatted properties that we can use internally * ' * + * @param bool $create + * * @return array|CRM_Error * @access public */ @@ -298,16 +302,19 @@ function civicrm_api3_contribution_transact($params) { return civicrm_api('contribution', 'create', $params); } + /** * Send a contribution confirmation (receipt or invoice) * The appropriate online template will be used (the existence of related objects * (e.g. memberships ) will affect this selection + * * @param array $params input parameters * {@getfields Contribution_sendconfirmation} + * + * @throws Exception * @return array Api result array * @static void * @access public - * */ function civicrm_api3_contribution_sendconfirmation($params) { $contribution = new CRM_Contribute_BAO_Contribution(); @@ -358,10 +365,11 @@ function _civicrm_api3_contribution_sendconfirmation_spec(&$params) { * * @param array $params input parameters * {@getfields Contribution_completetransaction} + * + * @throws API_Exception * @return array Api result array * @static void * @access public - * */ function civicrm_api3_contribution_completetransaction(&$params) { @@ -376,6 +384,9 @@ function civicrm_api3_contribution_completetransaction(&$params) { if(!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)){ throw new API_Exception('failed to load related objects'); } + elseif ($contribution->contribution_status_id == CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name')) { + throw new API_Exception(ts('Contribution already completed')); + } $objects = $contribution->_relatedObjects; $objects['contribution'] = &$contribution; $input['component'] = $contribution->_component; @@ -395,6 +406,9 @@ function civicrm_api3_contribution_completetransaction(&$params) { } } +/** + * @param $params + */ function _civicrm_api3_contribution_completetransaction(&$params) { $params['id'] = array( 'title' => 'Contribution ID',