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 | |
929a1c14 | 9 | * (GenCodeChecksum:2ccef6f7cc6a43d833301e93a2a0d61f) |
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. | |
111 | */ | |
112 | public static function getEntityTitle() { | |
113 | return ts('Action Logs'); | |
114 | } | |
115 | ||
e501603b | 116 | /** |
f41f0342 | 117 | * Returns foreign keys and entity references. |
e501603b TO |
118 | * |
119 | * @return array | |
120 | * [CRM_Core_Reference_Interface] | |
121 | */ | |
c3fc2621 | 122 | public static function getReferenceColumns() { |
346aaaba | 123 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 124 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
125 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
126 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'action_schedule_id', 'civicrm_action_schedule', 'id'); | |
127 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
346aaaba | 128 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 129 | } |
346aaaba | 130 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 131 | } |
c3fc2621 | 132 | |
e501603b TO |
133 | /** |
134 | * Returns all the column names of this table | |
135 | * | |
136 | * @return array | |
137 | */ | |
c3fc2621 | 138 | public static function &fields() { |
346aaaba | 139 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
140 | Civi::$statics[__CLASS__]['fields'] = [ |
141 | 'id' => [ | |
e501603b TO |
142 | 'name' => 'id', |
143 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
144 | 'title' => ts('Action Schedule ID'), |
145 | 'required' => TRUE, | |
a36434b9 | 146 | 'where' => 'civicrm_action_log.id', |
522a26c9 | 147 | 'table_name' => 'civicrm_action_log', |
148 | 'entity' => 'ActionLog', | |
149 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 150 | 'localizable' => 0, |
a9d0587b | 151 | 'add' => '3.4', |
c3fc2621 CW |
152 | ], |
153 | 'contact_id' => [ | |
e501603b TO |
154 | 'name' => 'contact_id', |
155 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 156 | 'title' => ts('Action Schedule Contact ID'), |
215b423e | 157 | 'description' => ts('FK to Contact ID'), |
a36434b9 | 158 | 'where' => 'civicrm_action_log.contact_id', |
522a26c9 | 159 | 'table_name' => 'civicrm_action_log', |
160 | 'entity' => 'ActionLog', | |
161 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 162 | 'localizable' => 0, |
e501603b | 163 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
a9d0587b | 164 | 'add' => '3.4', |
c3fc2621 CW |
165 | ], |
166 | 'entity_id' => [ | |
e501603b TO |
167 | 'name' => 'entity_id', |
168 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 169 | 'title' => ts('Entity ID'), |
215b423e | 170 | 'description' => ts('FK to id of the entity that the action was performed on. Pseudo - FK.'), |
c3fc2621 | 171 | 'required' => TRUE, |
a36434b9 | 172 | 'where' => 'civicrm_action_log.entity_id', |
522a26c9 | 173 | 'table_name' => 'civicrm_action_log', |
174 | 'entity' => 'ActionLog', | |
175 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 176 | 'localizable' => 0, |
a9d0587b | 177 | 'add' => '3.4', |
c3fc2621 CW |
178 | ], |
179 | 'entity_table' => [ | |
e501603b TO |
180 | 'name' => 'entity_table', |
181 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 182 | 'title' => ts('Entity Table'), |
215b423e | 183 | 'description' => ts('name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant'), |
e501603b TO |
184 | 'maxlength' => 255, |
185 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 186 | 'where' => 'civicrm_action_log.entity_table', |
522a26c9 | 187 | 'table_name' => 'civicrm_action_log', |
188 | 'entity' => 'ActionLog', | |
189 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 190 | 'localizable' => 0, |
a9d0587b | 191 | 'add' => '3.4', |
c3fc2621 CW |
192 | ], |
193 | 'action_schedule_id' => [ | |
e501603b TO |
194 | 'name' => 'action_schedule_id', |
195 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 196 | 'title' => ts('Schedule'), |
215b423e | 197 | 'description' => ts('FK to the action schedule that this action originated from.'), |
c3fc2621 | 198 | 'required' => TRUE, |
a36434b9 | 199 | 'where' => 'civicrm_action_log.action_schedule_id', |
522a26c9 | 200 | 'table_name' => 'civicrm_action_log', |
201 | 'entity' => 'ActionLog', | |
202 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 203 | 'localizable' => 0, |
e501603b | 204 | 'FKClassName' => 'CRM_Core_DAO_ActionSchedule', |
a9d0587b | 205 | 'add' => '3.4', |
c3fc2621 CW |
206 | ], |
207 | 'action_date_time' => [ | |
e501603b TO |
208 | 'name' => 'action_date_time', |
209 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 210 | 'title' => ts('Action Date And Time'), |
215b423e | 211 | 'description' => ts('date time that the action was performed on.'), |
a36434b9 | 212 | 'where' => 'civicrm_action_log.action_date_time', |
522a26c9 | 213 | 'table_name' => 'civicrm_action_log', |
214 | 'entity' => 'ActionLog', | |
215 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 216 | 'localizable' => 0, |
a9d0587b | 217 | 'add' => '3.4', |
c3fc2621 CW |
218 | ], |
219 | 'is_error' => [ | |
e501603b TO |
220 | 'name' => 'is_error', |
221 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 222 | 'title' => ts('Error?'), |
215b423e | 223 | 'description' => ts('Was there any error sending the reminder?'), |
a36434b9 | 224 | 'where' => 'civicrm_action_log.is_error', |
45a83e42 | 225 | 'default' => '0', |
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 | 'message' => [ | |
e501603b TO |
233 | 'name' => 'message', |
234 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 235 | 'title' => ts('Message'), |
215b423e | 236 | 'description' => ts('Description / text in case there was an error encountered.'), |
a36434b9 | 237 | 'where' => 'civicrm_action_log.message', |
522a26c9 | 238 | 'table_name' => 'civicrm_action_log', |
239 | 'entity' => 'ActionLog', | |
240 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 241 | 'localizable' => 0, |
a9d0587b | 242 | 'add' => '3.4', |
c3fc2621 CW |
243 | ], |
244 | 'repetition_number' => [ | |
e501603b TO |
245 | 'name' => 'repetition_number', |
246 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 247 | 'title' => ts('Repetition Number'), |
215b423e | 248 | 'description' => ts('Keeps track of the sequence number of this repetition.'), |
a36434b9 | 249 | 'where' => 'civicrm_action_log.repetition_number', |
522a26c9 | 250 | 'table_name' => 'civicrm_action_log', |
251 | 'entity' => 'ActionLog', | |
252 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 253 | 'localizable' => 0, |
a9d0587b | 254 | 'add' => '3.4', |
c3fc2621 CW |
255 | ], |
256 | 'reference_date' => [ | |
e501603b | 257 | 'name' => 'reference_date', |
74db51d3 | 258 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, |
c3fc2621 | 259 | 'title' => ts('Reference Date'), |
215b423e | 260 | 'description' => ts('Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)'), |
a36434b9 | 261 | 'where' => 'civicrm_action_log.reference_date', |
e501603b | 262 | 'default' => 'NULL', |
522a26c9 | 263 | 'table_name' => 'civicrm_action_log', |
264 | 'entity' => 'ActionLog', | |
265 | 'bao' => 'CRM_Core_BAO_ActionLog', | |
6a7e5e5d | 266 | 'localizable' => 0, |
a9d0587b | 267 | 'add' => '4.6', |
c3fc2621 CW |
268 | ], |
269 | ]; | |
346aaaba | 270 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 271 | } |
346aaaba | 272 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 273 | } |
c3fc2621 | 274 | |
e501603b | 275 | /** |
bd8e0b14 | 276 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
277 | * |
278 | * @return array | |
bd8e0b14 | 279 | * Array(string $name => string $uniqueName). |
e501603b | 280 | */ |
c3fc2621 | 281 | public static function &fieldKeys() { |
bd8e0b14 TO |
282 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
283 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 284 | } |
bd8e0b14 | 285 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 286 | } |
c3fc2621 | 287 | |
e501603b TO |
288 | /** |
289 | * Returns the names of this table | |
290 | * | |
291 | * @return string | |
292 | */ | |
c3fc2621 | 293 | public static function getTableName() { |
e501603b TO |
294 | return self::$_tableName; |
295 | } | |
c3fc2621 | 296 | |
e501603b TO |
297 | /** |
298 | * Returns if this table needs to be logged | |
299 | * | |
c3fc2621 | 300 | * @return bool |
e501603b | 301 | */ |
c3fc2621 | 302 | public function getLog() { |
e501603b TO |
303 | return self::$_log; |
304 | } | |
c3fc2621 | 305 | |
e501603b TO |
306 | /** |
307 | * Returns the list of fields that can be imported | |
308 | * | |
309 | * @param bool $prefix | |
310 | * | |
311 | * @return array | |
312 | */ | |
c3fc2621 CW |
313 | public static function &import($prefix = FALSE) { |
314 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, []); | |
60808919 | 315 | return $r; |
e501603b | 316 | } |
c3fc2621 | 317 | |
e501603b TO |
318 | /** |
319 | * Returns the list of fields that can be exported | |
320 | * | |
321 | * @param bool $prefix | |
322 | * | |
323 | * @return array | |
324 | */ | |
c3fc2621 CW |
325 | public static function &export($prefix = FALSE) { |
326 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, []); | |
60808919 | 327 | return $r; |
e501603b | 328 | } |
c3fc2621 | 329 | |
e7a6b91a AS |
330 | /** |
331 | * Returns the list of indices | |
c3fc2621 CW |
332 | * |
333 | * @param bool $localize | |
334 | * | |
335 | * @return array | |
e7a6b91a AS |
336 | */ |
337 | public static function indices($localize = TRUE) { | |
c3fc2621 | 338 | $indices = []; |
e7a6b91a AS |
339 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
340 | } | |
c3fc2621 | 341 | |
e501603b | 342 | } |