if (!(CRM_Utils_Array::value('name', $params))) {
$params['name'] = CRM_Utils_String::titleToVar($params['title'], 64);
}
+
+ CRM_Utils_Hook::pre('create', 'Campaign', NULL, $params);
+ } else {
+ CRM_Utils_Hook::pre('edit', 'Campaign', $params['id'], $params);
}
$campaign = new CRM_Campaign_DAO_Campaign();
$campaign->copyValues($params);
$campaign->save();
+ if (!empty($params['id'])) {
+ CRM_Utils_Hook::post('edit', 'Campaign', $campaign->id, $campaign);
+ }
+ else {
+ CRM_Utils_Hook::post('create', 'Campaign', $campaign->id, $campaign);
+ }
+
/* Create the campaign group record */
$groupTableName = CRM_Contact_BAO_Group::getTableName();
if (!$id) {
return FALSE;
}
+
+ CRM_Utils_Hook::pre('delete', 'Campaign', $id, CRM_Core_DAO::$_nullArray);
+
$dao = new CRM_Campaign_DAO_Campaign();
$dao->id = $id;
- return $dao->delete();
+ $result = $dao->delete();
+
+ CRM_Utils_Hook::post('delete', 'Campaign', $id, $dao);
+
+ return $result;
}
/**