X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FContribution.php;h=eb2ffc7d71fe9370610d59c3677f4289000cc3a9;hb=95b0090202aa538612981aa3cda2c71154397fec;hp=00abfe5b7a9b384d6c5763dedbb0bf4aa75d37bb;hpb=0e37ad72b0eb5885460129e75f4265fbf3f96406;p=civicrm-core.git diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 00abfe5b7a..eb2ffc7d71 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -60,7 +60,7 @@ function civicrm_api3_contribution_create(&$params) { 'amount' => $params['total_amount'])); } - if (CRM_Utils_Array::value('id', $params) && CRM_Utils_Array::value('contribution_status_id', $params)) { + if (!empty($params['id']) && !empty($params['contribution_status_id'])) { $error = array(); //throw error for invalid status change such as setting completed back to pending //@todo this sort of validation belongs in the BAO not the API - if it is not an OK @@ -83,6 +83,7 @@ function _civicrm_api3_contribution_create_spec(&$params) { $params['contact_id']['api.required'] = 1; $params['total_amount']['api.required'] = 1; $params['payment_instrument_id']['api.aliases'] = array('payment_instrument'); + $params['receive_date']['api.default'] = 'now'; $params['payment_processor'] = array( 'name' => 'payment_processor', 'title' => 'Payment Processor ID', @@ -122,6 +123,11 @@ function _civicrm_api3_contribution_create_spec(&$params) { 'api.default' => 0, 'description' => 'Do not add line items by default (if you wish to add your own)', ); + $params['batch_id'] = array( + 'title' => 'Batch', + 'type' => 1, + 'description' => 'Batch which relevant transactions should be added to', + ); } /** @@ -137,7 +143,7 @@ function _civicrm_api3_contribution_create_spec(&$params) { */ function civicrm_api3_contribution_delete($params) { - $contributionID = CRM_Utils_Array::value('contribution_id', $params) ? $params['contribution_id'] : $params['id']; + $contributionID = !empty($params['contribution_id']) ? $params['contribution_id'] : $params['id']; if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionID)) { return civicrm_api3_create_success(array($contributionID => 1)); }