Skip to content

Commit

Permalink
Add pre/post hooks on ContributionSoft entity
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaphoneJon committed Jan 10, 2020
1 parent 1d94337 commit 2271eee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CRM/Contribute/BAO/ContributionSoft.php
Expand Up @@ -33,6 +33,9 @@ public function __construct() {
* 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);

Expand All @@ -41,7 +44,9 @@ public static function add(&$params) {
$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;
}

/**
Expand Down

0 comments on commit 2271eee

Please sign in to comment.