Details
-
Type:
Bug
-
Status: Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 4.6.8
-
Fix Version/s: Unscheduled
-
Component/s: CiviCRM Profile, Extension System
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
This is an attempt at updating UFJoin so that pre and post hooks are called. Code is below. A bit more logic than this is necessary to get 'delete' and possibly other actions to be called.
Patch is against 4.6.8.
Here is a gist of the same so you can view without weird jira formatting. https://gist.github.com/anonymous/0428b189221924dd1ae3
{{*** civicrm/CRM/Core/BAO/UFJoin.php 2015-08-25 14:27:53.000000000 -0400
--- UFJoin.php 2015-09-28 17:19:42.505076769 -0400
***************
*** 51,65 ****
--- 51,76 ----
$id = self::findJoinEntryId($params);
if ($id) {
$params['id'] = $id;
+ CRM_Utils_Hook::pre('edit','UFJoin',$id,$params);
+ }
+ else {
+ CRM_Utils_Hook::pre('create','UFJoin',NULL,$params);
}
$dao = new CRM_Core_DAO_UFJoin();
$dao->copyValues($params);
if ($params['uf_group_id']) {
$dao->save();
+ if ($id) {
+ CRM_Utils_Hook::post('edit','UFJoin',$id,$params);
+ }
+ else {
+ CRM_Utils_Hook::post('create','UFJoin',NULL,$params);
+ }
}
else {
$dao->delete();
+ CRM_Utils_Hook::post('delete','UFJoin',$id,$params);
}
return $dao;
}}