Only add in the additional metadata if we are also adding them to the form
[civicrm-core.git] / CRM / Core / BAO / ActionLog.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
16 * $Id$
17 *
18 */
19
20/**
21 * This class contains functions for managing Action Logs
22 */
23class CRM_Core_BAO_ActionLog extends CRM_Core_DAO_ActionLog {
24
25 /**
fe482240 26 * Create or update an action log entry.
6a488035 27 *
c490a46a 28 * @param array $params
77b97be7 29 *
72b3a70c 30 * @return array
6a488035 31 */
00be9182 32 public static function create($params) {
6a488035
TO
33 $actionLog = new CRM_Core_DAO_ActionLog();
34
35 $params['action_date_time'] = CRM_Utils_Array::value('action_date_time', $params, date('YmdHis'));
36
37 $actionLog->copyValues($params);
38
39 $edit = ($actionLog->id) ? TRUE : FALSE;
40 if ($edit) {
41 CRM_Utils_Hook::pre('edit', 'ActionLog', $actionLog->id, $actionLog);
42 }
43 else {
44 CRM_Utils_Hook::pre('create', 'ActionLog', NULL, $actionLog);
45 }
46
47 $actionLog->save();
48
49 if ($edit) {
50 CRM_Utils_Hook::post('edit', 'ActionLog', $actionLog->id, $actionLog);
51 }
52 else {
53 CRM_Utils_Hook::post('create', 'ActionLog', NULL, $actionLog);
54 }
55
56 return $actionLog;
57 }
96025800 58
6a488035 59}