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