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