Merge pull request #9960 from colemanw/CRM-20029
[civicrm-core.git] / api / v3 / ContributionSoft.php
index 3bfe307f2f31146b4a1e4400df542eba840bd5f9..e4997d90fbaebffd29ff3dd78e1c5f2e10c0867e 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.                                    |
  |                                                                    |
@@ -62,11 +62,15 @@ function _civicrm_api3_contribution_soft_create_spec(&$params) {
  * Deletes an existing Soft Credit.
  *
  * @param array $params
+ * @throws API_Exception
  */
 function civicrm_api3_contribution_soft_delete($params) {
   // Non standard BAO - we have to write custom code to cope.
-  CRM_Contribute_BAO_ContributionSoft::del(array('id' => $params['id']));
-
+  $result = CRM_Contribute_BAO_ContributionSoft::del(array('id' => $params['id']));
+  if (!$result) {
+    throw new API_Exception('Cannot delete contributionSoft ' . $params['id']);
+  }
+  civicrm_api3_create_success(TRUE);
 }
 
 /**