From: Jon Goldberg Date: Thu, 9 Jan 2020 22:34:13 +0000 (-0500) Subject: Add pre/post hooks on ContributionSoft entity X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2271eee8b7c678500db3ed63129af383731dd1df;p=civicrm-core.git Add pre/post hooks on ContributionSoft entity --- diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index a949c49a0f..c98c5ccd11 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -33,6 +33,9 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio * soft contribution of object that is added */ public static function add(&$params) { + $hook = empty($params['id']) ? 'create' : 'edit'; + CRM_Utils_Hook::pre($hook, 'ContributionSoft', CRM_Utils_Array::value('id', $params), $params); + $contributionSoft = new CRM_Contribute_DAO_ContributionSoft(); $contributionSoft->copyValues($params); @@ -41,7 +44,9 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio $config = CRM_Core_Config::singleton(); $contributionSoft->currency = $config->defaultCurrency; } - return $contributionSoft->save(); + $result = $contributionSoft->save(); + CRM_Utils_Hook::post($hook, 'ContributionSoft', $contributionSoft->id, $contributionSoft); + return $result; } /**