API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Mailing / DAO / Mailing.php
CommitLineData
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/Mailing/Mailing.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
a9d0587b 9 * (GenCodeChecksum:bfcc85d4eb2bab05f214dd946e5fdef6)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Mailing entity.
f41f0342 14 */
e501603b 15class CRM_Mailing_DAO_Mailing 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_mailing';
c3fc2621 23
449c4e6b
CW
24 /**
25 * Icon associated with this entity.
26 *
27 * @var string
28 */
29 public static $_icon = 'fa-envelope-o';
30
e501603b 31 /**
f41f0342 32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 33 *
c3fc2621 34 * @var bool
e501603b 35 */
fa45b5b9 36 public static $_log = FALSE;
c3fc2621 37
e501603b 38 /**
e6ca0a57 39 * @var int
e501603b
TO
40 */
41 public $id;
c3fc2621 42
e501603b
TO
43 /**
44 * Which site is this mailing for
45 *
e6ca0a57 46 * @var int
e501603b
TO
47 */
48 public $domain_id;
c3fc2621 49
e501603b
TO
50 /**
51 * FK to the header component.
52 *
e6ca0a57 53 * @var int
e501603b
TO
54 */
55 public $header_id;
c3fc2621 56
e501603b
TO
57 /**
58 * FK to the footer component.
59 *
e6ca0a57 60 * @var int
e501603b
TO
61 */
62 public $footer_id;
c3fc2621 63
e501603b
TO
64 /**
65 * FK to the auto-responder component.
66 *
e6ca0a57 67 * @var int
e501603b
TO
68 */
69 public $reply_id;
c3fc2621 70
e501603b
TO
71 /**
72 * FK to the unsubscribe component.
73 *
e6ca0a57 74 * @var int
e501603b
TO
75 */
76 public $unsubscribe_id;
c3fc2621 77
e501603b 78 /**
e6ca0a57 79 * @var int
e501603b
TO
80 */
81 public $resubscribe_id;
c3fc2621 82
e501603b
TO
83 /**
84 * FK to the opt-out component.
85 *
e6ca0a57 86 * @var int
e501603b
TO
87 */
88 public $optout_id;
c3fc2621 89
e501603b
TO
90 /**
91 * Mailing Name.
92 *
93 * @var string
94 */
95 public $name;
c3fc2621 96
e501603b
TO
97 /**
98 * differentiate between standalone mailings, A/B tests, and A/B final-winner
99 *
100 * @var string
101 */
102 public $mailing_type;
c3fc2621 103
e501603b
TO
104 /**
105 * From Header of mailing
106 *
107 * @var string
108 */
109 public $from_name;
c3fc2621 110
e501603b
TO
111 /**
112 * From Email of mailing
113 *
114 * @var string
115 */
116 public $from_email;
c3fc2621 117
e501603b
TO
118 /**
119 * Reply-To Email of mailing
120 *
121 * @var string
122 */
123 public $replyto_email;
c3fc2621 124
703875d8
TO
125 /**
126 * The language/processing system used for email templates.
127 *
128 * @var string
129 */
130 public $template_type;
c3fc2621 131
703875d8
TO
132 /**
133 * Advanced options used by the email templating system. (JSON encoded)
134 *
135 * @var longtext
136 */
137 public $template_options;
c3fc2621 138
e501603b
TO
139 /**
140 * Subject of mailing
141 *
142 * @var string
143 */
144 public $subject;
c3fc2621 145
e501603b
TO
146 /**
147 * Body of the mailing in text format.
148 *
149 * @var longtext
150 */
151 public $body_text;
c3fc2621 152
e501603b
TO
153 /**
154 * Body of the mailing in html format.
155 *
156 * @var longtext
157 */
158 public $body_html;
c3fc2621 159
e501603b
TO
160 /**
161 * Should we track URL click-throughs for this mailing?
162 *
e6ca0a57 163 * @var bool
e501603b
TO
164 */
165 public $url_tracking;
c3fc2621 166
e501603b
TO
167 /**
168 * Should we forward replies back to the author?
169 *
e6ca0a57 170 * @var bool
e501603b
TO
171 */
172 public $forward_replies;
c3fc2621 173
e501603b
TO
174 /**
175 * Should we enable the auto-responder?
176 *
e6ca0a57 177 * @var bool
e501603b
TO
178 */
179 public $auto_responder;
c3fc2621 180
e501603b
TO
181 /**
182 * Should we track when recipients open/read this mailing?
183 *
e6ca0a57 184 * @var bool
e501603b
TO
185 */
186 public $open_tracking;
c3fc2621 187
e501603b
TO
188 /**
189 * Has at least one job associated with this mailing finished?
190 *
e6ca0a57 191 * @var bool
e501603b
TO
192 */
193 public $is_completed;
c3fc2621 194
e501603b
TO
195 /**
196 * FK to the message template.
197 *
e6ca0a57 198 * @var int
e501603b
TO
199 */
200 public $msg_template_id;
c3fc2621 201
e501603b 202 /**
d63dedfa 203 * Overwrite the VERP address in Reply-To
e501603b 204 *
e6ca0a57 205 * @var bool
e501603b
TO
206 */
207 public $override_verp;
c3fc2621 208
e501603b
TO
209 /**
210 * FK to Contact ID who first created this mailing
211 *
e6ca0a57 212 * @var int
e501603b
TO
213 */
214 public $created_id;
c3fc2621 215
e501603b
TO
216 /**
217 * Date and time this mailing was created.
218 *
6c2b97b7 219 * @var timestamp
e501603b
TO
220 */
221 public $created_date;
c3fc2621 222
e7a6eae8
SL
223 /**
224 * When the mailing (or closely related entity) was created or modified or deleted.
225 *
226 * @var timestamp
227 */
228 public $modified_date;
c3fc2621 229
e501603b
TO
230 /**
231 * FK to Contact ID who scheduled this mailing
232 *
e6ca0a57 233 * @var int
e501603b
TO
234 */
235 public $scheduled_id;
c3fc2621 236
e501603b
TO
237 /**
238 * Date and time this mailing was scheduled.
239 *
6c2b97b7 240 * @var timestamp
e501603b
TO
241 */
242 public $scheduled_date;
c3fc2621 243
e501603b
TO
244 /**
245 * FK to Contact ID who approved this mailing
246 *
e6ca0a57 247 * @var int
e501603b
TO
248 */
249 public $approver_id;
c3fc2621 250
e501603b
TO
251 /**
252 * Date and time this mailing was approved.
253 *
6c2b97b7 254 * @var timestamp
e501603b
TO
255 */
256 public $approval_date;
c3fc2621 257
e501603b
TO
258 /**
259 * The status of this mailing. Values: none, approved, rejected
260 *
e6ca0a57 261 * @var int
e501603b
TO
262 */
263 public $approval_status_id;
c3fc2621 264
e501603b
TO
265 /**
266 * Note behind the decision.
267 *
268 * @var longtext
269 */
270 public $approval_note;
c3fc2621 271
e501603b
TO
272 /**
273 * Is this mailing archived?
274 *
e6ca0a57 275 * @var bool
e501603b
TO
276 */
277 public $is_archived;
c3fc2621 278
e501603b
TO
279 /**
280 * In what context(s) is the mailing contents visible (online viewing)
281 *
282 * @var string
283 */
284 public $visibility;
c3fc2621 285
e501603b
TO
286 /**
287 * The campaign for which this mailing has been initiated.
288 *
e6ca0a57 289 * @var int
e501603b
TO
290 */
291 public $campaign_id;
c3fc2621 292
e501603b
TO
293 /**
294 * Remove duplicate emails?
295 *
e6ca0a57 296 * @var bool
e501603b
TO
297 */
298 public $dedupe_email;
c3fc2621 299
e501603b 300 /**
e6ca0a57 301 * @var int
e501603b
TO
302 */
303 public $sms_provider_id;
c3fc2621 304
e501603b
TO
305 /**
306 * Key for validating requests related to this mailing.
307 *
308 * @var string
309 */
310 public $hash;
c3fc2621 311
e501603b
TO
312 /**
313 * With email_selection_method, determines which email address to use
314 *
e6ca0a57 315 * @var int
e501603b
TO
316 */
317 public $location_type_id;
c3fc2621 318
e501603b
TO
319 /**
320 * With location_type_id, determine how to choose the email address to use.
321 *
322 * @var string
323 */
324 public $email_selection_method;
c3fc2621 325
10d3f7d3
SV
326 /**
327 * Language of the content of the mailing. Useful for tokens.
328 *
329 * @var string
330 */
331 public $language;
c3fc2621 332
e501603b 333 /**
f41f0342 334 * Class constructor.
e501603b 335 */
c3fc2621 336 public function __construct() {
e501603b
TO
337 $this->__table = 'civicrm_mailing';
338 parent::__construct();
339 }
c3fc2621 340
449c4e6b
CW
341 /**
342 * Returns localized title of this entity.
343 */
344 public static function getEntityTitle() {
345 return ts('Mailings');
346 }
347
e501603b 348 /**
f41f0342 349 * Returns foreign keys and entity references.
e501603b
TO
350 *
351 * @return array
352 * [CRM_Core_Reference_Interface]
353 */
c3fc2621 354 public static function getReferenceColumns() {
346aaaba 355 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 356 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
357 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
358 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'header_id', 'civicrm_mailing_component', 'id');
359 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'footer_id', 'civicrm_mailing_component', 'id');
360 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'reply_id', 'civicrm_mailing_component', 'id');
361 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'unsubscribe_id', 'civicrm_mailing_component', 'id');
362 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'optout_id', 'civicrm_mailing_component', 'id');
363 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'msg_template_id', 'civicrm_msg_template', 'id');
364 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
365 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'scheduled_id', 'civicrm_contact', 'id');
366 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'approver_id', 'civicrm_contact', 'id');
367 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
368 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'sms_provider_id', 'civicrm_sms_provider', 'id');
369 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
346aaaba 370 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 371 }
346aaaba 372 return Civi::$statics[__CLASS__]['links'];
e501603b 373 }
c3fc2621 374
e501603b
TO
375 /**
376 * Returns all the column names of this table
377 *
378 * @return array
379 */
c3fc2621 380 public static function &fields() {
346aaaba 381 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
382 Civi::$statics[__CLASS__]['fields'] = [
383 'id' => [
e501603b
TO
384 'name' => 'id',
385 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
386 'title' => ts('Mailing ID'),
387 'required' => TRUE,
a36434b9 388 'where' => 'civicrm_mailing.id',
522a26c9 389 'table_name' => 'civicrm_mailing',
390 'entity' => 'Mailing',
391 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 392 'localizable' => 0,
a9d0587b 393 'add' => NULL,
c3fc2621
CW
394 ],
395 'domain_id' => [
e501603b
TO
396 'name' => 'domain_id',
397 'type' => CRM_Utils_Type::T_INT,
c3fc2621 398 'title' => ts('Mailing Domain'),
215b423e 399 'description' => ts('Which site is this mailing for'),
a36434b9 400 'where' => 'civicrm_mailing.domain_id',
522a26c9 401 'table_name' => 'civicrm_mailing',
402 'entity' => 'Mailing',
403 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 404 'localizable' => 0,
e501603b 405 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 406 'pseudoconstant' => [
e501603b
TO
407 'table' => 'civicrm_domain',
408 'keyColumn' => 'id',
409 'labelColumn' => 'name',
e6ca0a57 410 ],
a9d0587b 411 'add' => '3.4',
c3fc2621
CW
412 ],
413 'header_id' => [
e501603b
TO
414 'name' => 'header_id',
415 'type' => CRM_Utils_Type::T_INT,
c3fc2621 416 'title' => ts('Mailing Header'),
215b423e 417 'description' => ts('FK to the header component.'),
a36434b9 418 'where' => 'civicrm_mailing.header_id',
522a26c9 419 'table_name' => 'civicrm_mailing',
420 'entity' => 'Mailing',
421 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 422 'localizable' => 0,
807f8008 423 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
3992bdad
TO
424 'pseudoconstant' => [
425 'table' => 'civicrm_mailing_component',
426 'keyColumn' => 'id',
427 'labelColumn' => 'name',
428 'condition' => 'component_type = "Header"',
429 ],
a9d0587b 430 'add' => NULL,
c3fc2621
CW
431 ],
432 'footer_id' => [
e501603b
TO
433 'name' => 'footer_id',
434 'type' => CRM_Utils_Type::T_INT,
c3fc2621 435 'title' => ts('Mailing Footer'),
215b423e 436 'description' => ts('FK to the footer component.'),
a36434b9 437 'where' => 'civicrm_mailing.footer_id',
522a26c9 438 'table_name' => 'civicrm_mailing',
439 'entity' => 'Mailing',
440 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 441 'localizable' => 0,
807f8008 442 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
3992bdad
TO
443 'pseudoconstant' => [
444 'table' => 'civicrm_mailing_component',
445 'keyColumn' => 'id',
446 'labelColumn' => 'name',
447 'condition' => 'component_type = "Footer"',
448 ],
a9d0587b 449 'add' => NULL,
c3fc2621
CW
450 ],
451 'reply_id' => [
e501603b
TO
452 'name' => 'reply_id',
453 'type' => CRM_Utils_Type::T_INT,
c3fc2621 454 'title' => ts('Mailing Reply'),
215b423e 455 'description' => ts('FK to the auto-responder component.'),
a36434b9 456 'where' => 'civicrm_mailing.reply_id',
522a26c9 457 'table_name' => 'civicrm_mailing',
458 'entity' => 'Mailing',
459 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 460 'localizable' => 0,
807f8008 461 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
a9d0587b 462 'add' => NULL,
c3fc2621
CW
463 ],
464 'unsubscribe_id' => [
e501603b
TO
465 'name' => 'unsubscribe_id',
466 'type' => CRM_Utils_Type::T_INT,
c3fc2621 467 'title' => ts('Mailing Unsubscribe'),
215b423e 468 'description' => ts('FK to the unsubscribe component.'),
a36434b9 469 'where' => 'civicrm_mailing.unsubscribe_id',
522a26c9 470 'table_name' => 'civicrm_mailing',
471 'entity' => 'Mailing',
472 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 473 'localizable' => 0,
807f8008 474 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
a9d0587b 475 'add' => NULL,
c3fc2621
CW
476 ],
477 'resubscribe_id' => [
e501603b
TO
478 'name' => 'resubscribe_id',
479 'type' => CRM_Utils_Type::T_INT,
c3fc2621 480 'title' => ts('Mailing Resubscribe'),
a36434b9 481 'where' => 'civicrm_mailing.resubscribe_id',
522a26c9 482 'table_name' => 'civicrm_mailing',
483 'entity' => 'Mailing',
484 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 485 'localizable' => 0,
a9d0587b 486 'add' => NULL,
c3fc2621
CW
487 ],
488 'optout_id' => [
e501603b
TO
489 'name' => 'optout_id',
490 'type' => CRM_Utils_Type::T_INT,
c3fc2621 491 'title' => ts('Mailing Opt Out'),
215b423e 492 'description' => ts('FK to the opt-out component.'),
a36434b9 493 'where' => 'civicrm_mailing.optout_id',
522a26c9 494 'table_name' => 'civicrm_mailing',
495 'entity' => 'Mailing',
496 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 497 'localizable' => 0,
807f8008 498 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
a9d0587b 499 'add' => NULL,
c3fc2621 500 ],
08d08c03 501 'mailing_name' => [
e501603b
TO
502 'name' => 'name',
503 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 504 'title' => ts('Mailing Name'),
215b423e 505 'description' => ts('Mailing Name.'),
e501603b
TO
506 'maxlength' => 128,
507 'size' => CRM_Utils_Type::HUGE,
a36434b9 508 'where' => 'civicrm_mailing.name',
522a26c9 509 'table_name' => 'civicrm_mailing',
510 'entity' => 'Mailing',
511 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 512 'localizable' => 0,
c3fc2621 513 'html' => [
e501603b 514 'type' => 'Text',
c3fc2621 515 ],
a9d0587b 516 'add' => NULL,
c3fc2621
CW
517 ],
518 'mailing_type' => [
e501603b
TO
519 'name' => 'mailing_type',
520 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 521 'title' => ts('Mailing Type'),
215b423e 522 'description' => ts('differentiate between standalone mailings, A/B tests, and A/B final-winner'),
e501603b
TO
523 'maxlength' => 32,
524 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 525 'where' => 'civicrm_mailing.mailing_type',
522a26c9 526 'table_name' => 'civicrm_mailing',
527 'entity' => 'Mailing',
528 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 529 'localizable' => 0,
c3fc2621 530 'html' => [
e501603b 531 'type' => 'Select',
c3fc2621
CW
532 ],
533 'pseudoconstant' => [
e501603b 534 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
e6ca0a57 535 ],
a9d0587b 536 'add' => '4.6',
c3fc2621
CW
537 ],
538 'from_name' => [
e501603b
TO
539 'name' => 'from_name',
540 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 541 'title' => ts('Mailing From Name'),
215b423e 542 'description' => ts('From Header of mailing'),
e501603b
TO
543 'maxlength' => 128,
544 'size' => CRM_Utils_Type::HUGE,
a36434b9 545 'where' => 'civicrm_mailing.from_name',
522a26c9 546 'table_name' => 'civicrm_mailing',
547 'entity' => 'Mailing',
548 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 549 'localizable' => 0,
c3fc2621 550 'html' => [
e501603b 551 'type' => 'Text',
c3fc2621 552 ],
a9d0587b 553 'add' => NULL,
c3fc2621
CW
554 ],
555 'from_email' => [
e501603b
TO
556 'name' => 'from_email',
557 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 558 'title' => ts('Mailing From Email'),
215b423e 559 'description' => ts('From Email of mailing'),
e501603b
TO
560 'maxlength' => 128,
561 'size' => CRM_Utils_Type::HUGE,
a36434b9 562 'where' => 'civicrm_mailing.from_email',
522a26c9 563 'table_name' => 'civicrm_mailing',
564 'entity' => 'Mailing',
565 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 566 'localizable' => 0,
c3fc2621 567 'html' => [
e501603b 568 'type' => 'Text',
c3fc2621 569 ],
a9d0587b 570 'add' => NULL,
c3fc2621
CW
571 ],
572 'replyto_email' => [
e501603b
TO
573 'name' => 'replyto_email',
574 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 575 'title' => ts('Replyto Email'),
215b423e 576 'description' => ts('Reply-To Email of mailing'),
e501603b
TO
577 'maxlength' => 128,
578 'size' => CRM_Utils_Type::HUGE,
a36434b9 579 'where' => 'civicrm_mailing.replyto_email',
522a26c9 580 'table_name' => 'civicrm_mailing',
581 'entity' => 'Mailing',
582 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 583 'localizable' => 0,
c3fc2621 584 'html' => [
e501603b 585 'type' => 'Text',
c3fc2621 586 ],
a9d0587b 587 'add' => NULL,
c3fc2621
CW
588 ],
589 'template_type' => [
703875d8
TO
590 'name' => 'template_type',
591 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 592 'title' => ts('Template Type'),
215b423e 593 'description' => ts('The language/processing system used for email templates.'),
c3fc2621 594 'required' => TRUE,
703875d8
TO
595 'maxlength' => 64,
596 'size' => CRM_Utils_Type::BIG,
a36434b9 597 'where' => 'civicrm_mailing.template_type',
703875d8 598 'default' => 'traditional',
522a26c9 599 'table_name' => 'civicrm_mailing',
600 'entity' => 'Mailing',
601 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 602 'localizable' => 0,
c3fc2621 603 'pseudoconstant' => [
703875d8 604 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
e6ca0a57 605 ],
a9d0587b 606 'add' => NULL,
c3fc2621
CW
607 ],
608 'template_options' => [
703875d8
TO
609 'name' => 'template_options',
610 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 611 'title' => ts('Template Options (JSON)'),
215b423e 612 'description' => ts('Advanced options used by the email templating system. (JSON encoded)'),
a36434b9 613 'where' => 'civicrm_mailing.template_options',
522a26c9 614 'table_name' => 'civicrm_mailing',
615 'entity' => 'Mailing',
616 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 617 'localizable' => 0,
a9d0587b 618 'add' => NULL,
c3fc2621
CW
619 ],
620 'subject' => [
e501603b
TO
621 'name' => 'subject',
622 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 623 'title' => ts('Subject'),
215b423e 624 'description' => ts('Subject of mailing'),
e501603b
TO
625 'maxlength' => 128,
626 'size' => CRM_Utils_Type::HUGE,
a36434b9 627 'where' => 'civicrm_mailing.subject',
522a26c9 628 'table_name' => 'civicrm_mailing',
629 'entity' => 'Mailing',
630 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 631 'localizable' => 0,
c3fc2621 632 'html' => [
e501603b 633 'type' => 'Text',
c3fc2621 634 ],
a9d0587b 635 'add' => NULL,
c3fc2621
CW
636 ],
637 'body_text' => [
e501603b
TO
638 'name' => 'body_text',
639 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 640 'title' => ts('Body Text'),
215b423e 641 'description' => ts('Body of the mailing in text format.'),
a36434b9 642 'where' => 'civicrm_mailing.body_text',
522a26c9 643 'table_name' => 'civicrm_mailing',
644 'entity' => 'Mailing',
645 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 646 'localizable' => 0,
a9d0587b 647 'add' => NULL,
c3fc2621
CW
648 ],
649 'body_html' => [
e501603b
TO
650 'name' => 'body_html',
651 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 652 'title' => ts('Body Html'),
215b423e 653 'description' => ts('Body of the mailing in html format.'),
a36434b9 654 'where' => 'civicrm_mailing.body_html',
522a26c9 655 'table_name' => 'civicrm_mailing',
656 'entity' => 'Mailing',
657 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 658 'localizable' => 0,
a9d0587b 659 'add' => NULL,
c3fc2621
CW
660 ],
661 'url_tracking' => [
e501603b
TO
662 'name' => 'url_tracking',
663 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 664 'title' => ts('Url Tracking'),
215b423e 665 'description' => ts('Should we track URL click-throughs for this mailing?'),
a36434b9 666 'where' => 'civicrm_mailing.url_tracking',
522a26c9 667 'table_name' => 'civicrm_mailing',
668 'entity' => 'Mailing',
669 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 670 'localizable' => 0,
c3fc2621 671 'html' => [
e501603b 672 'type' => 'CheckBox',
c3fc2621 673 ],
a9d0587b 674 'add' => NULL,
c3fc2621
CW
675 ],
676 'forward_replies' => [
e501603b
TO
677 'name' => 'forward_replies',
678 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 679 'title' => ts('Forward Replies'),
215b423e 680 'description' => ts('Should we forward replies back to the author?'),
a36434b9 681 'where' => 'civicrm_mailing.forward_replies',
522a26c9 682 'table_name' => 'civicrm_mailing',
683 'entity' => 'Mailing',
684 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 685 'localizable' => 0,
c3fc2621 686 'html' => [
e501603b 687 'type' => 'CheckBox',
c3fc2621 688 ],
a9d0587b 689 'add' => NULL,
c3fc2621
CW
690 ],
691 'auto_responder' => [
e501603b
TO
692 'name' => 'auto_responder',
693 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 694 'title' => ts('Auto Responder'),
215b423e 695 'description' => ts('Should we enable the auto-responder?'),
a36434b9 696 'where' => 'civicrm_mailing.auto_responder',
522a26c9 697 'table_name' => 'civicrm_mailing',
698 'entity' => 'Mailing',
699 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 700 'localizable' => 0,
c3fc2621 701 'html' => [
e501603b 702 'type' => 'CheckBox',
c3fc2621 703 ],
a9d0587b 704 'add' => NULL,
c3fc2621
CW
705 ],
706 'open_tracking' => [
e501603b
TO
707 'name' => 'open_tracking',
708 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 709 'title' => ts('Track Mailing?'),
215b423e 710 'description' => ts('Should we track when recipients open/read this mailing?'),
a36434b9 711 'where' => 'civicrm_mailing.open_tracking',
522a26c9 712 'table_name' => 'civicrm_mailing',
713 'entity' => 'Mailing',
714 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 715 'localizable' => 0,
a9d0587b 716 'add' => NULL,
c3fc2621
CW
717 ],
718 'is_completed' => [
e501603b
TO
719 'name' => 'is_completed',
720 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 721 'title' => ts('Mailing Completed'),
215b423e 722 'description' => ts('Has at least one job associated with this mailing finished?'),
a36434b9 723 'where' => 'civicrm_mailing.is_completed',
522a26c9 724 'table_name' => 'civicrm_mailing',
725 'entity' => 'Mailing',
726 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 727 'localizable' => 0,
c3fc2621 728 'html' => [
e501603b 729 'type' => 'CheckBox',
c3fc2621 730 ],
a9d0587b 731 'add' => NULL,
c3fc2621
CW
732 ],
733 'msg_template_id' => [
e501603b
TO
734 'name' => 'msg_template_id',
735 'type' => CRM_Utils_Type::T_INT,
c3fc2621 736 'title' => ts('Mailing Message Template'),
215b423e 737 'description' => ts('FK to the message template.'),
a36434b9 738 'where' => 'civicrm_mailing.msg_template_id',
522a26c9 739 'table_name' => 'civicrm_mailing',
740 'entity' => 'Mailing',
741 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 742 'localizable' => 0,
e501603b 743 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
a9d0587b 744 'add' => NULL,
c3fc2621
CW
745 ],
746 'override_verp' => [
e501603b
TO
747 'name' => 'override_verp',
748 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 749 'title' => ts('Override Verp'),
d63dedfa 750 'description' => ts('Overwrite the VERP address in Reply-To'),
a36434b9 751 'where' => 'civicrm_mailing.override_verp',
45a83e42 752 'default' => '0',
522a26c9 753 'table_name' => 'civicrm_mailing',
754 'entity' => 'Mailing',
755 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 756 'localizable' => 0,
c3fc2621 757 'html' => [
e501603b 758 'type' => 'CheckBox',
c3fc2621 759 ],
a9d0587b 760 'add' => '2.2',
c3fc2621
CW
761 ],
762 'created_id' => [
e501603b
TO
763 'name' => 'created_id',
764 'type' => CRM_Utils_Type::T_INT,
c3fc2621 765 'title' => ts('Mailing Creator'),
215b423e 766 'description' => ts('FK to Contact ID who first created this mailing'),
a36434b9 767 'where' => 'civicrm_mailing.created_id',
522a26c9 768 'table_name' => 'civicrm_mailing',
769 'entity' => 'Mailing',
770 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 771 'localizable' => 0,
e501603b 772 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 773 'add' => NULL,
c3fc2621
CW
774 ],
775 'created_date' => [
e501603b 776 'name' => 'created_date',
6c2b97b7 777 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 778 'title' => ts('Mailing Created Date'),
215b423e 779 'description' => ts('Date and time this mailing was created.'),
c3fc2621 780 'required' => FALSE,
a36434b9 781 'where' => 'civicrm_mailing.created_date',
e7a6eae8 782 'default' => 'NULL',
522a26c9 783 'table_name' => 'civicrm_mailing',
784 'entity' => 'Mailing',
785 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 786 'localizable' => 0,
c3fc2621 787 'html' => [
e501603b 788 'type' => 'Select Date',
6c2b97b7 789 'formatType' => 'activityDateTime',
c3fc2621 790 ],
a9d0587b 791 'add' => '3.0',
c3fc2621
CW
792 ],
793 'mailing_modified_date' => [
e7a6eae8
SL
794 'name' => 'modified_date',
795 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 796 'title' => ts('Modified Date'),
215b423e 797 'description' => ts('When the mailing (or closely related entity) was created or modified or deleted.'),
c3fc2621 798 'required' => FALSE,
e7a6eae8 799 'where' => 'civicrm_mailing.modified_date',
a36434b9 800 'export' => TRUE,
e7a6eae8
SL
801 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
802 'table_name' => 'civicrm_mailing',
803 'entity' => 'Mailing',
804 'bao' => 'CRM_Mailing_BAO_Mailing',
805 'localizable' => 0,
a9d0587b 806 'add' => '4.7',
c3fc2621
CW
807 ],
808 'scheduled_id' => [
e501603b
TO
809 'name' => 'scheduled_id',
810 'type' => CRM_Utils_Type::T_INT,
c3fc2621 811 'title' => ts('Scheduled By'),
215b423e 812 'description' => ts('FK to Contact ID who scheduled this mailing'),
a36434b9 813 'where' => 'civicrm_mailing.scheduled_id',
522a26c9 814 'table_name' => 'civicrm_mailing',
815 'entity' => 'Mailing',
816 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 817 'localizable' => 0,
e501603b 818 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 819 'add' => NULL,
c3fc2621
CW
820 ],
821 'scheduled_date' => [
e501603b 822 'name' => 'scheduled_date',
6c2b97b7 823 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 824 'title' => ts('Mailing Scheduled Date'),
215b423e 825 'description' => ts('Date and time this mailing was scheduled.'),
c3fc2621 826 'required' => FALSE,
a36434b9 827 'where' => 'civicrm_mailing.scheduled_date',
6c2b97b7 828 'default' => 'NULL',
522a26c9 829 'table_name' => 'civicrm_mailing',
830 'entity' => 'Mailing',
831 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 832 'localizable' => 0,
c3fc2621 833 'html' => [
6c2b97b7 834 'type' => 'Select Date',
835 'formatType' => 'activityDateTime',
c3fc2621 836 ],
a9d0587b 837 'add' => '3.3',
c3fc2621
CW
838 ],
839 'approver_id' => [
e501603b
TO
840 'name' => 'approver_id',
841 'type' => CRM_Utils_Type::T_INT,
c3fc2621 842 'title' => ts('Approved By'),
215b423e 843 'description' => ts('FK to Contact ID who approved this mailing'),
a36434b9 844 'where' => 'civicrm_mailing.approver_id',
522a26c9 845 'table_name' => 'civicrm_mailing',
846 'entity' => 'Mailing',
847 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 848 'localizable' => 0,
e501603b 849 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 850 'add' => NULL,
c3fc2621
CW
851 ],
852 'approval_date' => [
e501603b 853 'name' => 'approval_date',
6c2b97b7 854 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 855 'title' => ts('Mailing Approved Date'),
215b423e 856 'description' => ts('Date and time this mailing was approved.'),
c3fc2621 857 'required' => FALSE,
a36434b9 858 'where' => 'civicrm_mailing.approval_date',
6c2b97b7 859 'default' => 'NULL',
522a26c9 860 'table_name' => 'civicrm_mailing',
861 'entity' => 'Mailing',
862 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 863 'localizable' => 0,
c3fc2621 864 'html' => [
6c2b97b7 865 'type' => 'Select Date',
866 'formatType' => 'activityDateTime',
c3fc2621 867 ],
a9d0587b 868 'add' => '3.3',
c3fc2621
CW
869 ],
870 'approval_status_id' => [
e501603b
TO
871 'name' => 'approval_status_id',
872 'type' => CRM_Utils_Type::T_INT,
c3fc2621 873 'title' => ts('Approval Status'),
215b423e 874 'description' => ts('The status of this mailing. Values: none, approved, rejected'),
a36434b9 875 'where' => 'civicrm_mailing.approval_status_id',
522a26c9 876 'table_name' => 'civicrm_mailing',
877 'entity' => 'Mailing',
878 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 879 'localizable' => 0,
c3fc2621 880 'html' => [
e501603b 881 'type' => 'Select',
c3fc2621
CW
882 ],
883 'pseudoconstant' => [
e501603b
TO
884 'optionGroupName' => 'mail_approval_status',
885 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
e6ca0a57 886 ],
a9d0587b 887 'add' => '3.3',
c3fc2621
CW
888 ],
889 'approval_note' => [
e501603b
TO
890 'name' => 'approval_note',
891 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 892 'title' => ts('Approval Note'),
215b423e 893 'description' => ts('Note behind the decision.'),
a36434b9 894 'where' => 'civicrm_mailing.approval_note',
522a26c9 895 'table_name' => 'civicrm_mailing',
896 'entity' => 'Mailing',
897 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 898 'localizable' => 0,
c3fc2621 899 'html' => [
e501603b 900 'type' => 'TextArea',
c3fc2621 901 ],
a9d0587b 902 'add' => '3.3',
c3fc2621
CW
903 ],
904 'is_archived' => [
e501603b
TO
905 'name' => 'is_archived',
906 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 907 'title' => ts('Is Mailing Archived?'),
215b423e 908 'description' => ts('Is this mailing archived?'),
a36434b9 909 'where' => 'civicrm_mailing.is_archived',
45a83e42 910 'default' => '0',
522a26c9 911 'table_name' => 'civicrm_mailing',
912 'entity' => 'Mailing',
913 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 914 'localizable' => 0,
c3fc2621 915 'html' => [
e501603b 916 'type' => 'CheckBox',
c3fc2621 917 ],
a9d0587b 918 'add' => '2.2',
c3fc2621
CW
919 ],
920 'visibility' => [
e501603b
TO
921 'name' => 'visibility',
922 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 923 'title' => ts('Mailing Visibility'),
215b423e 924 'description' => ts('In what context(s) is the mailing contents visible (online viewing)'),
e501603b
TO
925 'maxlength' => 40,
926 'size' => CRM_Utils_Type::BIG,
a36434b9 927 'where' => 'civicrm_mailing.visibility',
e501603b 928 'default' => 'Public Pages',
522a26c9 929 'table_name' => 'civicrm_mailing',
930 'entity' => 'Mailing',
931 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 932 'localizable' => 0,
c3fc2621 933 'html' => [
e501603b 934 'type' => 'Select',
c3fc2621
CW
935 ],
936 'pseudoconstant' => [
e501603b 937 'callback' => 'CRM_Core_SelectValues::groupVisibility',
e6ca0a57 938 ],
a9d0587b 939 'add' => '3.3',
c3fc2621
CW
940 ],
941 'campaign_id' => [
e501603b
TO
942 'name' => 'campaign_id',
943 'type' => CRM_Utils_Type::T_INT,
c3fc2621 944 'title' => ts('Mailing Campaign'),
215b423e 945 'description' => ts('The campaign for which this mailing has been initiated.'),
a36434b9 946 'where' => 'civicrm_mailing.campaign_id',
522a26c9 947 'table_name' => 'civicrm_mailing',
948 'entity' => 'Mailing',
949 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 950 'localizable' => 0,
e501603b 951 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
c3fc2621 952 'html' => [
e501603b 953 'type' => 'Select',
c3fc2621
CW
954 ],
955 'pseudoconstant' => [
e501603b
TO
956 'table' => 'civicrm_campaign',
957 'keyColumn' => 'id',
958 'labelColumn' => 'title',
e6ca0a57 959 ],
a9d0587b 960 'add' => '3.4',
c3fc2621
CW
961 ],
962 'dedupe_email' => [
e501603b
TO
963 'name' => 'dedupe_email',
964 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 965 'title' => ts('No Duplicate emails?'),
215b423e 966 'description' => ts('Remove duplicate emails?'),
a36434b9 967 'where' => 'civicrm_mailing.dedupe_email',
45a83e42 968 'default' => '0',
522a26c9 969 'table_name' => 'civicrm_mailing',
970 'entity' => 'Mailing',
971 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 972 'localizable' => 0,
c3fc2621 973 'html' => [
e501603b 974 'type' => 'CheckBox',
c3fc2621 975 ],
a9d0587b 976 'add' => '4.1',
c3fc2621
CW
977 ],
978 'sms_provider_id' => [
e501603b
TO
979 'name' => 'sms_provider_id',
980 'type' => CRM_Utils_Type::T_INT,
c3fc2621 981 'title' => ts('Mailing SMS Provider'),
a36434b9 982 'where' => 'civicrm_mailing.sms_provider_id',
522a26c9 983 'table_name' => 'civicrm_mailing',
984 'entity' => 'Mailing',
985 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 986 'localizable' => 0,
e501603b 987 'FKClassName' => 'CRM_SMS_DAO_Provider',
c3fc2621 988 'html' => [
e501603b 989 'type' => 'Select',
c3fc2621 990 ],
a9d0587b 991 'add' => '4.2',
c3fc2621
CW
992 ],
993 'hash' => [
e501603b
TO
994 'name' => 'hash',
995 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 996 'title' => ts('Mailing Hash'),
215b423e 997 'description' => ts('Key for validating requests related to this mailing.'),
e501603b
TO
998 'maxlength' => 16,
999 'size' => CRM_Utils_Type::TWELVE,
a36434b9 1000 'where' => 'civicrm_mailing.hash',
522a26c9 1001 'table_name' => 'civicrm_mailing',
1002 'entity' => 'Mailing',
1003 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1004 'localizable' => 0,
a9d0587b 1005 'add' => '4.5',
c3fc2621
CW
1006 ],
1007 'location_type_id' => [
e501603b
TO
1008 'name' => 'location_type_id',
1009 'type' => CRM_Utils_Type::T_INT,
c3fc2621 1010 'title' => ts('Location Type'),
215b423e 1011 'description' => ts('With email_selection_method, determines which email address to use'),
a36434b9 1012 'where' => 'civicrm_mailing.location_type_id',
522a26c9 1013 'table_name' => 'civicrm_mailing',
1014 'entity' => 'Mailing',
1015 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1016 'localizable' => 0,
e501603b 1017 'FKClassName' => 'CRM_Core_DAO_LocationType',
c3fc2621 1018 'pseudoconstant' => [
e501603b
TO
1019 'table' => 'civicrm_location_type',
1020 'keyColumn' => 'id',
1021 'labelColumn' => 'display_name',
e6ca0a57 1022 ],
a9d0587b 1023 'add' => '4.6',
c3fc2621
CW
1024 ],
1025 'email_selection_method' => [
e501603b
TO
1026 'name' => 'email_selection_method',
1027 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1028 'title' => ts('Email Selection Method'),
215b423e 1029 'description' => ts('With location_type_id, determine how to choose the email address to use.'),
e501603b
TO
1030 'maxlength' => 20,
1031 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 1032 'where' => 'civicrm_mailing.email_selection_method',
e501603b 1033 'default' => 'automatic',
522a26c9 1034 'table_name' => 'civicrm_mailing',
1035 'entity' => 'Mailing',
1036 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1037 'localizable' => 0,
c3fc2621 1038 'pseudoconstant' => [
e501603b 1039 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
e6ca0a57 1040 ],
a9d0587b 1041 'add' => '4.6',
c3fc2621
CW
1042 ],
1043 'language' => [
10d3f7d3
SV
1044 'name' => 'language',
1045 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1046 'title' => ts('Mailing Language'),
215b423e 1047 'description' => ts('Language of the content of the mailing. Useful for tokens.'),
10d3f7d3
SV
1048 'maxlength' => 5,
1049 'size' => CRM_Utils_Type::SIX,
a36434b9 1050 'where' => 'civicrm_mailing.language',
522a26c9 1051 'table_name' => 'civicrm_mailing',
1052 'entity' => 'Mailing',
1053 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1054 'localizable' => 0,
c3fc2621 1055 'html' => [
10d3f7d3 1056 'type' => 'Select',
c3fc2621
CW
1057 ],
1058 'pseudoconstant' => [
10d3f7d3
SV
1059 'optionGroupName' => 'languages',
1060 'keyColumn' => 'name',
1061 'optionEditPath' => 'civicrm/admin/options/languages',
e6ca0a57 1062 ],
a9d0587b 1063 'add' => '4.6',
c3fc2621
CW
1064 ],
1065 ];
346aaaba 1066 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 1067 }
346aaaba 1068 return Civi::$statics[__CLASS__]['fields'];
e501603b 1069 }
c3fc2621 1070
e501603b 1071 /**
bd8e0b14 1072 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
1073 *
1074 * @return array
bd8e0b14 1075 * Array(string $name => string $uniqueName).
e501603b 1076 */
c3fc2621 1077 public static function &fieldKeys() {
bd8e0b14
TO
1078 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
1079 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 1080 }
bd8e0b14 1081 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 1082 }
c3fc2621 1083
e501603b
TO
1084 /**
1085 * Returns the names of this table
1086 *
1087 * @return string
1088 */
c3fc2621 1089 public static function getTableName() {
e501603b
TO
1090 return self::$_tableName;
1091 }
c3fc2621 1092
e501603b
TO
1093 /**
1094 * Returns if this table needs to be logged
1095 *
c3fc2621 1096 * @return bool
e501603b 1097 */
c3fc2621 1098 public function getLog() {
e501603b
TO
1099 return self::$_log;
1100 }
c3fc2621 1101
e501603b
TO
1102 /**
1103 * Returns the list of fields that can be imported
1104 *
1105 * @param bool $prefix
1106 *
1107 * @return array
1108 */
c3fc2621
CW
1109 public static function &import($prefix = FALSE) {
1110 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing', $prefix, []);
60808919 1111 return $r;
e501603b 1112 }
c3fc2621 1113
e501603b
TO
1114 /**
1115 * Returns the list of fields that can be exported
1116 *
1117 * @param bool $prefix
1118 *
1119 * @return array
1120 */
c3fc2621
CW
1121 public static function &export($prefix = FALSE) {
1122 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing', $prefix, []);
60808919 1123 return $r;
e501603b 1124 }
c3fc2621 1125
e7a6b91a
AS
1126 /**
1127 * Returns the list of indices
c3fc2621
CW
1128 *
1129 * @param bool $localize
1130 *
1131 * @return array
e7a6b91a
AS
1132 */
1133 public static function indices($localize = TRUE) {
c3fc2621
CW
1134 $indices = [
1135 'index_hash' => [
e7a6b91a 1136 'name' => 'index_hash',
c3fc2621 1137 'field' => [
e7a6b91a 1138 0 => 'hash',
c3fc2621
CW
1139 ],
1140 'localizable' => FALSE,
e7a6b91a 1141 'sig' => 'civicrm_mailing::0::hash',
c3fc2621
CW
1142 ],
1143 ];
e7a6b91a
AS
1144 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
1145 }
c3fc2621 1146
e501603b 1147}