/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
// make sure tax calculation is handled via api
$params = CRM_Contribute_BAO_Contribution::checkTaxAmount($params);
-
+
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Contribution');
}
);
$params['soft_credit_to'] = array(
'name' => 'soft_credit_to',
- 'title' => 'Soft Credit contact ID',
+ 'title' => 'Soft Credit contact ID (legacy)',
'type' => 1,
- 'description' => 'ID of Contact to be Soft credited to',
+ 'description' => 'ID of Contact to be Soft credited to (deprecated - use contribution_soft api)',
'FKClassName' => 'CRM_Contact_DAO_Contact',
);
$params['honor_contact_id'] = array(
'name' => 'honor_contact_id',
- 'title' => 'Honoree contact ID',
+ 'title' => 'Honoree contact ID (legacy)',
'type' => 1,
- 'description' => 'ID of honoree contact',
+ 'description' => 'ID of honoree contact (deprecated - use contribution_soft api)',
'FKClassName' => 'CRM_Contact_DAO_Contact',
);
+ $params['honor_type_id'] = array(
+ 'name' => 'honor_type_id',
+ 'title' => 'Honoree Type (legacy)',
+ 'type' => 1,
+ 'description' => 'Type of honoree contact (deprecated - use contribution_soft api)',
+ 'pseudoconstant' => TRUE,
+ );
// note this is a recommended option but not adding as a default to avoid
// creating unnecessary changes for the dev
$params['skipRecentView'] = array(
function _civicrm_api3_contribution_create_legacy_support_45(&$params){
//legacy soft credit handling - recommended approach is chaining
if(!empty($params['soft_credit_to'])){
- $params['soft_credit'] = array(array(
+ $params['soft_credit'][] = array(
'contact_id' => $params['soft_credit_to'],
'amount' => $params['total_amount'],
- 'soft_credit_type_id' => CRM_Core_OptionGroup::getDefaultValue("soft_credit_type")));
+ 'soft_credit_type_id' => CRM_Core_OptionGroup::getDefaultValue("soft_credit_type")
+ );
}
if(!empty($params['honor_contact_id'])){
- $params['soft_credit'] = array(array(
+ $params['soft_credit'][] = array(
'contact_id' => $params['honor_contact_id'],
'amount' => $params['total_amount'],
- 'soft_credit_type_id' => CRM_Core_OptionGroup::getValue('soft_credit_type', 'in_honor_of', 'name')));
+ 'soft_credit_type_id' => CRM_Utils_Array::value('honor_type_id', $params, CRM_Core_OptionGroup::getValue('soft_credit_type', 'in_honor_of', 'name'))
+ );
}
}
*
* @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.
- *
- * @return array (reference ) array of contributions, if error an array with an error id and error message
+ * @return array of contributions, if error an array with an error id and error message
* @static void
* @access public
* {@getfields Contribution_get}
// @todo required for base ipn but problematic as api layer handles this
$transaction = new CRM_Core_Transaction();
$ipn = new CRM_Core_Payment_BaseIPN();
- $ipn->completeTransaction($input, $ids, $objects, $transaction);
+ $ipn->completeTransaction($input, $ids, $objects, $transaction, !empty($contribution->contribution_recur_id));
}
catch(Exception $e) {
throw new API_Exception('failed to load related objects' . $e->getMessage() . "\n" . $e->getTraceAsString());
}
/**
- * @param $params
+ * provide function metadata
+ * @param array $params
*/
-function _civicrm_api3_contribution_completetransaction(&$params) {
+function _civicrm_api3_contribution_completetransaction_spec(&$params) {
$params['id'] = array(
'title' => 'Contribution ID',
'type' => CRM_Utils_Type::T_INT,