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