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