CRM-21052 - Activity.create API - Abide by setting `civicaseActivityRevisions`
[civicrm-core.git] / api / v3 / FinancialTrxn.php
index 04e5bd87a060269d4285ab476a6b09619f86f049..12058a157f5d14e0d81e1d6c9d2d45b0cc6c5ccf 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  * @return array
  */
 function civicrm_api3_financial_trxn_create($params) {
-  return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+  if (empty($params['id']) && empty($params['contribution_id']) && empty($params['entity_id'])) {
+    throw new API_Exception("Mandatory key(s) missing from params array: both contribution_id and entity_id are missing");
+  }
+
+  return _civicrm_api3_basic_create('CRM_Core_BAO_FinancialTrxn', $params);
 }
 
 /**