Skip to content
Snippets Groups Projects
Commit c45c979f authored by colemanw's avatar colemanw
Browse files

File - consistently set created_id

Some codepaths were setting this and others were not.
parent 42340d28
Branches
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@
/**
* BAO object for crm_log table
*/
class CRM_Core_BAO_File extends CRM_Core_DAO_File {
class CRM_Core_BAO_File extends CRM_Core_DAO_File implements \Civi\Core\HookInterface {
public static $_signableFields = ['entityTable', 'entityID', 'fileID'];
......@@ -38,6 +38,18 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
return self::writeRecord($params);
}
/**
* Event fired before an action is taken on a File record.
* @param \Civi\Core\Event\PreEvent $event
*/
public static function self_hook_civicrm_pre(\Civi\Core\Event\PreEvent $event) {
if ($event->action === 'create') {
if (empty($event->params['created_id'])) {
$event->params['created_id'] = CRM_Core_Session::getLoggedInContactID();
}
}
}
/**
* @param int $fileID
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment