Add titles and icons to entities
[civicrm-core.git] / CRM / Core / DAO / ActionLog.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/ActionLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
449c4e6b 9 * (GenCodeChecksum:744811fde95e9b8fd7d6a0bc6ce0a4dd)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ActionLog entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_action_log';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b 31 /**
e6ca0a57 32 * @var int
e501603b
TO
33 */
34 public $id;
c3fc2621 35
e501603b
TO
36 /**
37 * FK to Contact ID
38 *
e6ca0a57 39 * @var int
e501603b
TO
40 */
41 public $contact_id;
c3fc2621 42
e501603b
TO
43 /**
44 * FK to id of the entity that the action was performed on. Pseudo - FK.
45 *
e6ca0a57 46 * @var int
e501603b
TO
47 */
48 public $entity_id;
c3fc2621 49
e501603b
TO
50 /**
51 * name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant
52 *
53 * @var string
54 */
55 public $entity_table;
c3fc2621 56
e501603b
TO
57 /**
58 * FK to the action schedule that this action originated from.
59 *
e6ca0a57 60 * @var int
e501603b
TO
61 */
62 public $action_schedule_id;
c3fc2621 63
e501603b
TO
64 /**
65 * date time that the action was performed on.
66 *
67 * @var datetime
68 */
69 public $action_date_time;
c3fc2621 70
e501603b
TO
71 /**
72 * Was there any error sending the reminder?
73 *
e6ca0a57 74 * @var bool
e501603b
TO
75 */
76 public $is_error;
c3fc2621 77
e501603b
TO
78 /**
79 * Description / text in case there was an error encountered.
80 *
81 * @var text
82 */
83 public $message;
c3fc2621 84
e501603b
TO
85 /**
86 * Keeps track of the sequence number of this repetition.
87 *
e6ca0a57 88 * @var int
e501603b
TO
89 */
90 public $repetition_number;
c3fc2621 91
e501603b
TO
92 /**
93 * Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)
94 *
74db51d3 95 * @var datetime
e501603b
TO
96 */
97 public $reference_date;
c3fc2621 98
e501603b 99 /**
f41f0342 100 * Class constructor.
e501603b 101 */
c3fc2621 102 public function __construct() {
e501603b
TO
103 $this->__table = 'civicrm_action_log';
104 parent::__construct();
105 }
c3fc2621 106
449c4e6b
CW
107 /**
108 * Returns localized title of this entity.
109 */
110 public static function getEntityTitle() {
111 return ts('Action Logs');
112 }
113
e501603b 114 /**
f41f0342 115 * Returns foreign keys and entity references.
e501603b
TO
116 *
117 * @return array
118 * [CRM_Core_Reference_Interface]
119 */
c3fc2621 120 public static function getReferenceColumns() {
346aaaba 121 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 122 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
123 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
124 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'action_schedule_id', 'civicrm_action_schedule', 'id');
125 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 126 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 127 }
346aaaba 128 return Civi::$statics[__CLASS__]['links'];
e501603b 129 }
c3fc2621 130
e501603b
TO
131 /**
132 * Returns all the column names of this table
133 *
134 * @return array
135 */
c3fc2621 136 public static function &fields() {
346aaaba 137 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
138 Civi::$statics[__CLASS__]['fields'] = [
139 'id' => [
e501603b
TO
140 'name' => 'id',
141 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
142 'title' => ts('Action Schedule ID'),
143 'required' => TRUE,
a36434b9 144 'where' => 'civicrm_action_log.id',
522a26c9 145 'table_name' => 'civicrm_action_log',
146 'entity' => 'ActionLog',
147 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 148 'localizable' => 0,
c3fc2621
CW
149 ],
150 'contact_id' => [
e501603b
TO
151 'name' => 'contact_id',
152 'type' => CRM_Utils_Type::T_INT,
c3fc2621 153 'title' => ts('Action Schedule Contact ID'),
215b423e 154 'description' => ts('FK to Contact ID'),
a36434b9 155 'where' => 'civicrm_action_log.contact_id',
522a26c9 156 'table_name' => 'civicrm_action_log',
157 'entity' => 'ActionLog',
158 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 159 'localizable' => 0,
e501603b 160 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
161 ],
162 'entity_id' => [
e501603b
TO
163 'name' => 'entity_id',
164 'type' => CRM_Utils_Type::T_INT,
c3fc2621 165 'title' => ts('Entity ID'),
215b423e 166 'description' => ts('FK to id of the entity that the action was performed on. Pseudo - FK.'),
c3fc2621 167 'required' => TRUE,
a36434b9 168 'where' => 'civicrm_action_log.entity_id',
522a26c9 169 'table_name' => 'civicrm_action_log',
170 'entity' => 'ActionLog',
171 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 172 'localizable' => 0,
c3fc2621
CW
173 ],
174 'entity_table' => [
e501603b
TO
175 'name' => 'entity_table',
176 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 177 'title' => ts('Entity Table'),
215b423e 178 'description' => ts('name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant'),
e501603b
TO
179 'maxlength' => 255,
180 'size' => CRM_Utils_Type::HUGE,
a36434b9 181 'where' => 'civicrm_action_log.entity_table',
522a26c9 182 'table_name' => 'civicrm_action_log',
183 'entity' => 'ActionLog',
184 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 185 'localizable' => 0,
c3fc2621
CW
186 ],
187 'action_schedule_id' => [
e501603b
TO
188 'name' => 'action_schedule_id',
189 'type' => CRM_Utils_Type::T_INT,
c3fc2621 190 'title' => ts('Schedule'),
215b423e 191 'description' => ts('FK to the action schedule that this action originated from.'),
c3fc2621 192 'required' => TRUE,
a36434b9 193 'where' => 'civicrm_action_log.action_schedule_id',
522a26c9 194 'table_name' => 'civicrm_action_log',
195 'entity' => 'ActionLog',
196 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 197 'localizable' => 0,
e501603b 198 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
c3fc2621
CW
199 ],
200 'action_date_time' => [
e501603b
TO
201 'name' => 'action_date_time',
202 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 203 'title' => ts('Action Date And Time'),
215b423e 204 'description' => ts('date time that the action was performed on.'),
a36434b9 205 'where' => 'civicrm_action_log.action_date_time',
522a26c9 206 'table_name' => 'civicrm_action_log',
207 'entity' => 'ActionLog',
208 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 209 'localizable' => 0,
c3fc2621
CW
210 ],
211 'is_error' => [
e501603b
TO
212 'name' => 'is_error',
213 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 214 'title' => ts('Error?'),
215b423e 215 'description' => ts('Was there any error sending the reminder?'),
a36434b9 216 'where' => 'civicrm_action_log.is_error',
45a83e42 217 'default' => '0',
522a26c9 218 'table_name' => 'civicrm_action_log',
219 'entity' => 'ActionLog',
220 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 221 'localizable' => 0,
c3fc2621
CW
222 ],
223 'message' => [
e501603b
TO
224 'name' => 'message',
225 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 226 'title' => ts('Message'),
215b423e 227 'description' => ts('Description / text in case there was an error encountered.'),
a36434b9 228 'where' => 'civicrm_action_log.message',
522a26c9 229 'table_name' => 'civicrm_action_log',
230 'entity' => 'ActionLog',
231 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 232 'localizable' => 0,
c3fc2621
CW
233 ],
234 'repetition_number' => [
e501603b
TO
235 'name' => 'repetition_number',
236 'type' => CRM_Utils_Type::T_INT,
c3fc2621 237 'title' => ts('Repetition Number'),
215b423e 238 'description' => ts('Keeps track of the sequence number of this repetition.'),
a36434b9 239 'where' => 'civicrm_action_log.repetition_number',
522a26c9 240 'table_name' => 'civicrm_action_log',
241 'entity' => 'ActionLog',
242 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 243 'localizable' => 0,
c3fc2621
CW
244 ],
245 'reference_date' => [
e501603b 246 'name' => 'reference_date',
74db51d3 247 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 248 'title' => ts('Reference Date'),
215b423e 249 'description' => ts('Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)'),
a36434b9 250 'where' => 'civicrm_action_log.reference_date',
e501603b 251 'default' => 'NULL',
522a26c9 252 'table_name' => 'civicrm_action_log',
253 'entity' => 'ActionLog',
254 'bao' => 'CRM_Core_BAO_ActionLog',
6a7e5e5d 255 'localizable' => 0,
c3fc2621
CW
256 ],
257 ];
346aaaba 258 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 259 }
346aaaba 260 return Civi::$statics[__CLASS__]['fields'];
e501603b 261 }
c3fc2621 262
e501603b 263 /**
bd8e0b14 264 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
265 *
266 * @return array
bd8e0b14 267 * Array(string $name => string $uniqueName).
e501603b 268 */
c3fc2621 269 public static function &fieldKeys() {
bd8e0b14
TO
270 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
271 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 272 }
bd8e0b14 273 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 274 }
c3fc2621 275
e501603b
TO
276 /**
277 * Returns the names of this table
278 *
279 * @return string
280 */
c3fc2621 281 public static function getTableName() {
e501603b
TO
282 return self::$_tableName;
283 }
c3fc2621 284
e501603b
TO
285 /**
286 * Returns if this table needs to be logged
287 *
c3fc2621 288 * @return bool
e501603b 289 */
c3fc2621 290 public function getLog() {
e501603b
TO
291 return self::$_log;
292 }
c3fc2621 293
e501603b
TO
294 /**
295 * Returns the list of fields that can be imported
296 *
297 * @param bool $prefix
298 *
299 * @return array
300 */
c3fc2621
CW
301 public static function &import($prefix = FALSE) {
302 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, []);
60808919 303 return $r;
e501603b 304 }
c3fc2621 305
e501603b
TO
306 /**
307 * Returns the list of fields that can be exported
308 *
309 * @param bool $prefix
310 *
311 * @return array
312 */
c3fc2621
CW
313 public static function &export($prefix = FALSE) {
314 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, []);
60808919 315 return $r;
e501603b 316 }
c3fc2621 317
e7a6b91a
AS
318 /**
319 * Returns the list of indices
c3fc2621
CW
320 *
321 * @param bool $localize
322 *
323 * @return array
e7a6b91a
AS
324 */
325 public static function indices($localize = TRUE) {
c3fc2621 326 $indices = [];
e7a6b91a
AS
327 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
328 }
c3fc2621 329
e501603b 330}