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