Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre/post hooks on ContributionSoft entity #16264

Merged
merged 1 commit into from Jan 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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