curious
[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
25ad69f2 9 * (GenCodeChecksum:0889788ebb2ad430999bb9eda9524621)
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
2562d09a
CW
364 /**
365 * Returns user-friendly description of this entity.
366 *
367 * @return string
368 */
369 public static function getEntityDescription() {
370 return ts('Mass emails sent from CiviMail.');
371 }
372
e501603b 373 /**
f41f0342 374 * Returns foreign keys and entity references.
e501603b
TO
375 *
376 * @return array
377 * [CRM_Core_Reference_Interface]
378 */
c3fc2621 379 public static function getReferenceColumns() {
346aaaba 380 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 381 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
382 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
383 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'header_id', 'civicrm_mailing_component', 'id');
384 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'footer_id', 'civicrm_mailing_component', 'id');
385 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'reply_id', 'civicrm_mailing_component', 'id');
386 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'unsubscribe_id', 'civicrm_mailing_component', 'id');
387 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'optout_id', 'civicrm_mailing_component', 'id');
388 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'msg_template_id', 'civicrm_msg_template', 'id');
389 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
390 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'scheduled_id', 'civicrm_contact', 'id');
391 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'approver_id', 'civicrm_contact', 'id');
392 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
393 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'sms_provider_id', 'civicrm_sms_provider', 'id');
394 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
346aaaba 395 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 396 }
346aaaba 397 return Civi::$statics[__CLASS__]['links'];
e501603b 398 }
c3fc2621 399
e501603b
TO
400 /**
401 * Returns all the column names of this table
402 *
403 * @return array
404 */
c3fc2621 405 public static function &fields() {
346aaaba 406 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
407 Civi::$statics[__CLASS__]['fields'] = [
408 'id' => [
e501603b
TO
409 'name' => 'id',
410 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
411 'title' => ts('Mailing ID'),
412 'required' => TRUE,
a36434b9 413 'where' => 'civicrm_mailing.id',
522a26c9 414 'table_name' => 'civicrm_mailing',
415 'entity' => 'Mailing',
416 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 417 'localizable' => 0,
2cbbebe8
A
418 'html' => [
419 'type' => 'Number',
420 ],
1fe423d6 421 'readonly' => TRUE,
a9d0587b 422 'add' => NULL,
c3fc2621
CW
423 ],
424 'domain_id' => [
e501603b
TO
425 'name' => 'domain_id',
426 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 427 'title' => ts('Domain ID'),
215b423e 428 'description' => ts('Which site is this mailing for'),
a36434b9 429 'where' => 'civicrm_mailing.domain_id',
522a26c9 430 'table_name' => 'civicrm_mailing',
431 'entity' => 'Mailing',
432 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 433 'localizable' => 0,
e501603b 434 'FKClassName' => 'CRM_Core_DAO_Domain',
2cbbebe8
A
435 'html' => [
436 'label' => ts("Domain"),
437 ],
c3fc2621 438 'pseudoconstant' => [
e501603b
TO
439 'table' => 'civicrm_domain',
440 'keyColumn' => 'id',
441 'labelColumn' => 'name',
e6ca0a57 442 ],
a9d0587b 443 'add' => '3.4',
c3fc2621
CW
444 ],
445 'header_id' => [
e501603b
TO
446 'name' => 'header_id',
447 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 448 'title' => ts('Header ID'),
215b423e 449 'description' => ts('FK to the header component.'),
a36434b9 450 'where' => 'civicrm_mailing.header_id',
522a26c9 451 'table_name' => 'civicrm_mailing',
452 'entity' => 'Mailing',
453 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 454 'localizable' => 0,
807f8008 455 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
2cbbebe8
A
456 'html' => [
457 'label' => ts("Header"),
458 ],
3992bdad
TO
459 'pseudoconstant' => [
460 'table' => 'civicrm_mailing_component',
461 'keyColumn' => 'id',
462 'labelColumn' => 'name',
463 'condition' => 'component_type = "Header"',
464 ],
a9d0587b 465 'add' => NULL,
c3fc2621
CW
466 ],
467 'footer_id' => [
e501603b
TO
468 'name' => 'footer_id',
469 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 470 'title' => ts('Footer ID'),
215b423e 471 'description' => ts('FK to the footer component.'),
a36434b9 472 'where' => 'civicrm_mailing.footer_id',
522a26c9 473 'table_name' => 'civicrm_mailing',
474 'entity' => 'Mailing',
475 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 476 'localizable' => 0,
807f8008 477 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
2cbbebe8
A
478 'html' => [
479 'label' => ts("Footer"),
480 ],
3992bdad
TO
481 'pseudoconstant' => [
482 'table' => 'civicrm_mailing_component',
483 'keyColumn' => 'id',
484 'labelColumn' => 'name',
485 'condition' => 'component_type = "Footer"',
486 ],
a9d0587b 487 'add' => NULL,
c3fc2621
CW
488 ],
489 'reply_id' => [
e501603b
TO
490 'name' => 'reply_id',
491 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 492 'title' => ts('Reply ID'),
215b423e 493 'description' => ts('FK to the auto-responder component.'),
a36434b9 494 'where' => 'civicrm_mailing.reply_id',
522a26c9 495 'table_name' => 'civicrm_mailing',
496 'entity' => 'Mailing',
497 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 498 'localizable' => 0,
807f8008 499 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
2cbbebe8
A
500 'html' => [
501 'label' => ts("Reply"),
502 ],
a9d0587b 503 'add' => NULL,
c3fc2621
CW
504 ],
505 'unsubscribe_id' => [
e501603b
TO
506 'name' => 'unsubscribe_id',
507 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 508 'title' => ts('Unsubscribe ID'),
215b423e 509 'description' => ts('FK to the unsubscribe component.'),
a36434b9 510 'where' => 'civicrm_mailing.unsubscribe_id',
522a26c9 511 'table_name' => 'civicrm_mailing',
512 'entity' => 'Mailing',
513 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 514 'localizable' => 0,
807f8008 515 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
2cbbebe8
A
516 'html' => [
517 'label' => ts("Unsubscribe"),
518 ],
a9d0587b 519 'add' => NULL,
c3fc2621
CW
520 ],
521 'resubscribe_id' => [
e501603b
TO
522 'name' => 'resubscribe_id',
523 'type' => CRM_Utils_Type::T_INT,
c3fc2621 524 'title' => ts('Mailing Resubscribe'),
a36434b9 525 'where' => 'civicrm_mailing.resubscribe_id',
522a26c9 526 'table_name' => 'civicrm_mailing',
527 'entity' => 'Mailing',
528 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 529 'localizable' => 0,
a9d0587b 530 'add' => NULL,
c3fc2621
CW
531 ],
532 'optout_id' => [
e501603b
TO
533 'name' => 'optout_id',
534 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 535 'title' => ts('Opt Out ID'),
215b423e 536 'description' => ts('FK to the opt-out component.'),
a36434b9 537 'where' => 'civicrm_mailing.optout_id',
522a26c9 538 'table_name' => 'civicrm_mailing',
539 'entity' => 'Mailing',
540 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 541 'localizable' => 0,
807f8008 542 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
2cbbebe8
A
543 'html' => [
544 'label' => ts("Opt Out"),
545 ],
a9d0587b 546 'add' => NULL,
c3fc2621 547 ],
08d08c03 548 'mailing_name' => [
e501603b
TO
549 'name' => 'name',
550 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 551 'title' => ts('Mailing Name'),
215b423e 552 'description' => ts('Mailing Name.'),
e501603b
TO
553 'maxlength' => 128,
554 'size' => CRM_Utils_Type::HUGE,
a36434b9 555 'where' => 'civicrm_mailing.name',
522a26c9 556 'table_name' => 'civicrm_mailing',
557 'entity' => 'Mailing',
558 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 559 'localizable' => 0,
c3fc2621 560 'html' => [
e501603b 561 'type' => 'Text',
c3fc2621 562 ],
a9d0587b 563 'add' => NULL,
c3fc2621
CW
564 ],
565 'mailing_type' => [
e501603b
TO
566 'name' => 'mailing_type',
567 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 568 'title' => ts('Mailing Type'),
215b423e 569 'description' => ts('differentiate between standalone mailings, A/B tests, and A/B final-winner'),
e501603b
TO
570 'maxlength' => 32,
571 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 572 'where' => 'civicrm_mailing.mailing_type',
522a26c9 573 'table_name' => 'civicrm_mailing',
574 'entity' => 'Mailing',
575 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 576 'localizable' => 0,
c3fc2621 577 'html' => [
e501603b 578 'type' => 'Select',
c3fc2621
CW
579 ],
580 'pseudoconstant' => [
e501603b 581 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
e6ca0a57 582 ],
a9d0587b 583 'add' => '4.6',
c3fc2621
CW
584 ],
585 'from_name' => [
e501603b
TO
586 'name' => 'from_name',
587 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 588 'title' => ts('Mailing From Name'),
215b423e 589 'description' => ts('From Header of mailing'),
e501603b
TO
590 'maxlength' => 128,
591 'size' => CRM_Utils_Type::HUGE,
a36434b9 592 'where' => 'civicrm_mailing.from_name',
522a26c9 593 'table_name' => 'civicrm_mailing',
594 'entity' => 'Mailing',
595 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 596 'localizable' => 0,
c3fc2621 597 'html' => [
e501603b 598 'type' => 'Text',
c3fc2621 599 ],
a9d0587b 600 'add' => NULL,
c3fc2621
CW
601 ],
602 'from_email' => [
e501603b
TO
603 'name' => 'from_email',
604 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 605 'title' => ts('Mailing From Email'),
215b423e 606 'description' => ts('From Email of mailing'),
e501603b
TO
607 'maxlength' => 128,
608 'size' => CRM_Utils_Type::HUGE,
a36434b9 609 'where' => 'civicrm_mailing.from_email',
522a26c9 610 'table_name' => 'civicrm_mailing',
611 'entity' => 'Mailing',
612 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 613 'localizable' => 0,
c3fc2621 614 'html' => [
e501603b 615 'type' => 'Text',
c3fc2621 616 ],
a9d0587b 617 'add' => NULL,
c3fc2621
CW
618 ],
619 'replyto_email' => [
e501603b
TO
620 'name' => 'replyto_email',
621 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 622 'title' => ts('Replyto Email'),
215b423e 623 'description' => ts('Reply-To Email of mailing'),
e501603b
TO
624 'maxlength' => 128,
625 'size' => CRM_Utils_Type::HUGE,
a36434b9 626 'where' => 'civicrm_mailing.replyto_email',
522a26c9 627 'table_name' => 'civicrm_mailing',
628 'entity' => 'Mailing',
629 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 630 'localizable' => 0,
c3fc2621 631 'html' => [
e501603b 632 'type' => 'Text',
c23563e3 633 'label' => ts("Reply-To Email"),
c3fc2621 634 ],
a9d0587b 635 'add' => NULL,
c3fc2621
CW
636 ],
637 'template_type' => [
703875d8
TO
638 'name' => 'template_type',
639 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 640 'title' => ts('Template Type'),
215b423e 641 'description' => ts('The language/processing system used for email templates.'),
c3fc2621 642 'required' => TRUE,
703875d8
TO
643 'maxlength' => 64,
644 'size' => CRM_Utils_Type::BIG,
a36434b9 645 'where' => 'civicrm_mailing.template_type',
703875d8 646 'default' => 'traditional',
522a26c9 647 'table_name' => 'civicrm_mailing',
648 'entity' => 'Mailing',
649 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 650 'localizable' => 0,
c3fc2621 651 'pseudoconstant' => [
703875d8 652 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
e6ca0a57 653 ],
a9d0587b 654 'add' => NULL,
c3fc2621
CW
655 ],
656 'template_options' => [
703875d8
TO
657 'name' => 'template_options',
658 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 659 'title' => ts('Template Options (JSON)'),
215b423e 660 'description' => ts('Advanced options used by the email templating system. (JSON encoded)'),
a36434b9 661 'where' => 'civicrm_mailing.template_options',
522a26c9 662 'table_name' => 'civicrm_mailing',
663 'entity' => 'Mailing',
664 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 665 'localizable' => 0,
a9d0587b 666 'add' => NULL,
c3fc2621
CW
667 ],
668 'subject' => [
e501603b
TO
669 'name' => 'subject',
670 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 671 'title' => ts('Subject'),
215b423e 672 'description' => ts('Subject of mailing'),
e501603b
TO
673 'maxlength' => 128,
674 'size' => CRM_Utils_Type::HUGE,
a36434b9 675 'where' => 'civicrm_mailing.subject',
522a26c9 676 'table_name' => 'civicrm_mailing',
677 'entity' => 'Mailing',
678 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 679 'localizable' => 0,
c3fc2621 680 'html' => [
e501603b 681 'type' => 'Text',
c23563e3 682 'label' => ts("Subject"),
c3fc2621 683 ],
a9d0587b 684 'add' => NULL,
c3fc2621
CW
685 ],
686 'body_text' => [
e501603b
TO
687 'name' => 'body_text',
688 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 689 'title' => ts('Body Text'),
215b423e 690 'description' => ts('Body of the mailing in text format.'),
a36434b9 691 'where' => 'civicrm_mailing.body_text',
522a26c9 692 'table_name' => 'civicrm_mailing',
693 'entity' => 'Mailing',
694 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 695 'localizable' => 0,
c23563e3
SL
696 'html' => [
697 'label' => ts("Body Text"),
698 ],
a9d0587b 699 'add' => NULL,
c3fc2621
CW
700 ],
701 'body_html' => [
e501603b
TO
702 'name' => 'body_html',
703 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 704 'title' => ts('Body Html'),
215b423e 705 'description' => ts('Body of the mailing in html format.'),
a36434b9 706 'where' => 'civicrm_mailing.body_html',
522a26c9 707 'table_name' => 'civicrm_mailing',
708 'entity' => 'Mailing',
709 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 710 'localizable' => 0,
c23563e3
SL
711 'html' => [
712 'label' => ts("Body HTML"),
713 ],
a9d0587b 714 'add' => NULL,
c3fc2621
CW
715 ],
716 'url_tracking' => [
e501603b
TO
717 'name' => 'url_tracking',
718 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 719 'title' => ts('Url Tracking'),
215b423e 720 'description' => ts('Should we track URL click-throughs for this mailing?'),
a36434b9 721 'where' => 'civicrm_mailing.url_tracking',
522a26c9 722 'table_name' => 'civicrm_mailing',
723 'entity' => 'Mailing',
724 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 725 'localizable' => 0,
c3fc2621 726 'html' => [
e501603b 727 'type' => 'CheckBox',
c23563e3 728 'label' => ts("Url Tracking"),
c3fc2621 729 ],
a9d0587b 730 'add' => NULL,
c3fc2621
CW
731 ],
732 'forward_replies' => [
e501603b
TO
733 'name' => 'forward_replies',
734 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 735 'title' => ts('Forward Replies'),
215b423e 736 'description' => ts('Should we forward replies back to the author?'),
a36434b9 737 'where' => 'civicrm_mailing.forward_replies',
522a26c9 738 'table_name' => 'civicrm_mailing',
739 'entity' => 'Mailing',
740 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 741 'localizable' => 0,
c3fc2621 742 'html' => [
e501603b 743 'type' => 'CheckBox',
c23563e3 744 'label' => ts("Forward Replies"),
c3fc2621 745 ],
a9d0587b 746 'add' => NULL,
c3fc2621
CW
747 ],
748 'auto_responder' => [
e501603b
TO
749 'name' => 'auto_responder',
750 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 751 'title' => ts('Auto Responder'),
215b423e 752 'description' => ts('Should we enable the auto-responder?'),
a36434b9 753 'where' => 'civicrm_mailing.auto_responder',
522a26c9 754 'table_name' => 'civicrm_mailing',
755 'entity' => 'Mailing',
756 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 757 'localizable' => 0,
c3fc2621 758 'html' => [
e501603b 759 'type' => 'CheckBox',
c23563e3 760 'label' => ts("Auto Responder"),
c3fc2621 761 ],
a9d0587b 762 'add' => NULL,
c3fc2621
CW
763 ],
764 'open_tracking' => [
e501603b
TO
765 'name' => 'open_tracking',
766 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 767 'title' => ts('Track Mailing?'),
215b423e 768 'description' => ts('Should we track when recipients open/read this mailing?'),
a36434b9 769 'where' => 'civicrm_mailing.open_tracking',
522a26c9 770 'table_name' => 'civicrm_mailing',
771 'entity' => 'Mailing',
772 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 773 'localizable' => 0,
a9d0587b 774 'add' => NULL,
c3fc2621
CW
775 ],
776 'is_completed' => [
e501603b
TO
777 'name' => 'is_completed',
778 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 779 'title' => ts('Mailing Completed'),
215b423e 780 'description' => ts('Has at least one job associated with this mailing finished?'),
a36434b9 781 'where' => 'civicrm_mailing.is_completed',
522a26c9 782 'table_name' => 'civicrm_mailing',
783 'entity' => 'Mailing',
784 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 785 'localizable' => 0,
c3fc2621 786 'html' => [
e501603b 787 'type' => 'CheckBox',
c3fc2621 788 ],
a9d0587b 789 'add' => NULL,
c3fc2621
CW
790 ],
791 'msg_template_id' => [
e501603b
TO
792 'name' => 'msg_template_id',
793 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 794 'title' => ts('Message Template ID'),
215b423e 795 'description' => ts('FK to the message template.'),
a36434b9 796 'where' => 'civicrm_mailing.msg_template_id',
522a26c9 797 'table_name' => 'civicrm_mailing',
798 'entity' => 'Mailing',
799 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 800 'localizable' => 0,
e501603b 801 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
2cbbebe8
A
802 'html' => [
803 'label' => ts("Message Template"),
804 ],
a9d0587b 805 'add' => NULL,
c3fc2621
CW
806 ],
807 'override_verp' => [
e501603b
TO
808 'name' => 'override_verp',
809 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 810 'title' => ts('Override Verp'),
d63dedfa 811 'description' => ts('Overwrite the VERP address in Reply-To'),
a36434b9 812 'where' => 'civicrm_mailing.override_verp',
45a83e42 813 'default' => '0',
522a26c9 814 'table_name' => 'civicrm_mailing',
815 'entity' => 'Mailing',
816 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 817 'localizable' => 0,
c3fc2621 818 'html' => [
e501603b 819 'type' => 'CheckBox',
c23563e3 820 'label' => ts("Overwrite VERP"),
c3fc2621 821 ],
a9d0587b 822 'add' => '2.2',
c3fc2621
CW
823 ],
824 'created_id' => [
e501603b
TO
825 'name' => 'created_id',
826 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 827 'title' => ts('Created By Contact ID'),
215b423e 828 'description' => ts('FK to Contact ID who first created this mailing'),
a36434b9 829 'where' => 'civicrm_mailing.created_id',
522a26c9 830 'table_name' => 'civicrm_mailing',
831 'entity' => 'Mailing',
832 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 833 'localizable' => 0,
e501603b 834 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
835 'html' => [
836 'label' => ts("Creator"),
837 ],
a9d0587b 838 'add' => NULL,
c3fc2621
CW
839 ],
840 'created_date' => [
e501603b 841 'name' => 'created_date',
6c2b97b7 842 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 843 'title' => ts('Mailing Created Date'),
215b423e 844 'description' => ts('Date and time this mailing was created.'),
c3fc2621 845 'required' => FALSE,
a36434b9 846 'where' => 'civicrm_mailing.created_date',
f6205b84 847 'default' => 'CURRENT_TIMESTAMP',
522a26c9 848 'table_name' => 'civicrm_mailing',
849 'entity' => 'Mailing',
850 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 851 'localizable' => 0,
c3fc2621 852 'html' => [
e501603b 853 'type' => 'Select Date',
6c2b97b7 854 'formatType' => 'activityDateTime',
c3fc2621 855 ],
a9d0587b 856 'add' => '3.0',
c3fc2621
CW
857 ],
858 'mailing_modified_date' => [
e7a6eae8
SL
859 'name' => 'modified_date',
860 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 861 'title' => ts('Modified Date'),
215b423e 862 'description' => ts('When the mailing (or closely related entity) was created or modified or deleted.'),
c3fc2621 863 'required' => FALSE,
e7a6eae8 864 'where' => 'civicrm_mailing.modified_date',
a36434b9 865 'export' => TRUE,
e7a6eae8
SL
866 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
867 'table_name' => 'civicrm_mailing',
868 'entity' => 'Mailing',
869 'bao' => 'CRM_Mailing_BAO_Mailing',
870 'localizable' => 0,
c23563e3
SL
871 'html' => [
872 'label' => ts("Modified Date"),
873 ],
a0e733f3 874 'readonly' => TRUE,
a9d0587b 875 'add' => '4.7',
c3fc2621
CW
876 ],
877 'scheduled_id' => [
e501603b
TO
878 'name' => 'scheduled_id',
879 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 880 'title' => ts('Scheduled By Contact ID'),
215b423e 881 'description' => ts('FK to Contact ID who scheduled this mailing'),
a36434b9 882 'where' => 'civicrm_mailing.scheduled_id',
522a26c9 883 'table_name' => 'civicrm_mailing',
884 'entity' => 'Mailing',
885 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 886 'localizable' => 0,
e501603b 887 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
888 'html' => [
889 'label' => ts("Scheduled By"),
890 ],
a9d0587b 891 'add' => NULL,
c3fc2621
CW
892 ],
893 'scheduled_date' => [
e501603b 894 'name' => 'scheduled_date',
6c2b97b7 895 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 896 'title' => ts('Mailing Scheduled Date'),
215b423e 897 'description' => ts('Date and time this mailing was scheduled.'),
c3fc2621 898 'required' => FALSE,
a36434b9 899 'where' => 'civicrm_mailing.scheduled_date',
5fb0de1f 900 'default' => NULL,
522a26c9 901 'table_name' => 'civicrm_mailing',
902 'entity' => 'Mailing',
903 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 904 'localizable' => 0,
c3fc2621 905 'html' => [
6c2b97b7 906 'type' => 'Select Date',
907 'formatType' => 'activityDateTime',
c3fc2621 908 ],
a9d0587b 909 'add' => '3.3',
c3fc2621
CW
910 ],
911 'approver_id' => [
e501603b
TO
912 'name' => 'approver_id',
913 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 914 'title' => ts('Approved By Contact ID'),
215b423e 915 'description' => ts('FK to Contact ID who approved this mailing'),
a36434b9 916 'where' => 'civicrm_mailing.approver_id',
522a26c9 917 'table_name' => 'civicrm_mailing',
918 'entity' => 'Mailing',
919 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 920 'localizable' => 0,
e501603b 921 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
922 'html' => [
923 'label' => ts("Approved By"),
924 ],
a9d0587b 925 'add' => NULL,
c3fc2621
CW
926 ],
927 'approval_date' => [
e501603b 928 'name' => 'approval_date',
6c2b97b7 929 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 930 'title' => ts('Mailing Approved Date'),
215b423e 931 'description' => ts('Date and time this mailing was approved.'),
c3fc2621 932 'required' => FALSE,
a36434b9 933 'where' => 'civicrm_mailing.approval_date',
5fb0de1f 934 'default' => NULL,
522a26c9 935 'table_name' => 'civicrm_mailing',
936 'entity' => 'Mailing',
937 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 938 'localizable' => 0,
c3fc2621 939 'html' => [
6c2b97b7 940 'type' => 'Select Date',
941 'formatType' => 'activityDateTime',
c3fc2621 942 ],
a9d0587b 943 'add' => '3.3',
c3fc2621
CW
944 ],
945 'approval_status_id' => [
e501603b
TO
946 'name' => 'approval_status_id',
947 'type' => CRM_Utils_Type::T_INT,
c3fc2621 948 'title' => ts('Approval Status'),
215b423e 949 'description' => ts('The status of this mailing. Values: none, approved, rejected'),
a36434b9 950 'where' => 'civicrm_mailing.approval_status_id',
522a26c9 951 'table_name' => 'civicrm_mailing',
952 'entity' => 'Mailing',
953 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 954 'localizable' => 0,
c3fc2621 955 'html' => [
e501603b 956 'type' => 'Select',
c3fc2621
CW
957 ],
958 'pseudoconstant' => [
e501603b
TO
959 'optionGroupName' => 'mail_approval_status',
960 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
e6ca0a57 961 ],
a9d0587b 962 'add' => '3.3',
c3fc2621
CW
963 ],
964 'approval_note' => [
e501603b
TO
965 'name' => 'approval_note',
966 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 967 'title' => ts('Approval Note'),
215b423e 968 'description' => ts('Note behind the decision.'),
a36434b9 969 'where' => 'civicrm_mailing.approval_note',
522a26c9 970 'table_name' => 'civicrm_mailing',
971 'entity' => 'Mailing',
972 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 973 'localizable' => 0,
c3fc2621 974 'html' => [
e501603b 975 'type' => 'TextArea',
c3fc2621 976 ],
a9d0587b 977 'add' => '3.3',
c3fc2621
CW
978 ],
979 'is_archived' => [
e501603b
TO
980 'name' => 'is_archived',
981 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 982 'title' => ts('Is Mailing Archived?'),
215b423e 983 'description' => ts('Is this mailing archived?'),
a36434b9 984 'where' => 'civicrm_mailing.is_archived',
45a83e42 985 'default' => '0',
522a26c9 986 'table_name' => 'civicrm_mailing',
987 'entity' => 'Mailing',
988 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 989 'localizable' => 0,
c3fc2621 990 'html' => [
e501603b 991 'type' => 'CheckBox',
c3fc2621 992 ],
a9d0587b 993 'add' => '2.2',
c3fc2621
CW
994 ],
995 'visibility' => [
e501603b
TO
996 'name' => 'visibility',
997 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 998 'title' => ts('Mailing Visibility'),
215b423e 999 'description' => ts('In what context(s) is the mailing contents visible (online viewing)'),
e501603b
TO
1000 'maxlength' => 40,
1001 'size' => CRM_Utils_Type::BIG,
a36434b9 1002 'where' => 'civicrm_mailing.visibility',
e501603b 1003 'default' => 'Public Pages',
522a26c9 1004 'table_name' => 'civicrm_mailing',
1005 'entity' => 'Mailing',
1006 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1007 'localizable' => 0,
c3fc2621 1008 'html' => [
e501603b 1009 'type' => 'Select',
c3fc2621
CW
1010 ],
1011 'pseudoconstant' => [
e501603b 1012 'callback' => 'CRM_Core_SelectValues::groupVisibility',
e6ca0a57 1013 ],
a9d0587b 1014 'add' => '3.3',
c3fc2621
CW
1015 ],
1016 'campaign_id' => [
e501603b
TO
1017 'name' => 'campaign_id',
1018 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 1019 'title' => ts('Campaign ID'),
215b423e 1020 'description' => ts('The campaign for which this mailing has been initiated.'),
a36434b9 1021 'where' => 'civicrm_mailing.campaign_id',
522a26c9 1022 'table_name' => 'civicrm_mailing',
1023 'entity' => 'Mailing',
1024 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1025 'localizable' => 0,
e501603b 1026 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
88c31c05 1027 'component' => 'CiviCampaign',
c3fc2621 1028 'html' => [
8813f972 1029 'type' => 'EntityRef',
2cbbebe8 1030 'label' => ts("Campaign"),
c3fc2621 1031 ],
25ad69f2
CW
1032 'pseudoconstant' => [
1033 'table' => 'civicrm_campaign',
1034 'keyColumn' => 'id',
1035 'labelColumn' => 'title',
1036 'prefetch' => 'FALSE',
1037 ],
a9d0587b 1038 'add' => '3.4',
c3fc2621
CW
1039 ],
1040 'dedupe_email' => [
e501603b
TO
1041 'name' => 'dedupe_email',
1042 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 1043 'title' => ts('No Duplicate emails?'),
215b423e 1044 'description' => ts('Remove duplicate emails?'),
a36434b9 1045 'where' => 'civicrm_mailing.dedupe_email',
45a83e42 1046 'default' => '0',
522a26c9 1047 'table_name' => 'civicrm_mailing',
1048 'entity' => 'Mailing',
1049 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1050 'localizable' => 0,
c3fc2621 1051 'html' => [
e501603b 1052 'type' => 'CheckBox',
c3fc2621 1053 ],
a9d0587b 1054 'add' => '4.1',
c3fc2621
CW
1055 ],
1056 'sms_provider_id' => [
e501603b
TO
1057 'name' => 'sms_provider_id',
1058 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 1059 'title' => ts('SMS Provider ID'),
a36434b9 1060 'where' => 'civicrm_mailing.sms_provider_id',
522a26c9 1061 'table_name' => 'civicrm_mailing',
1062 'entity' => 'Mailing',
1063 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1064 'localizable' => 0,
e501603b 1065 'FKClassName' => 'CRM_SMS_DAO_Provider',
c3fc2621 1066 'html' => [
e501603b 1067 'type' => 'Select',
2cbbebe8 1068 'label' => ts("SMS Provider"),
c3fc2621 1069 ],
a9d0587b 1070 'add' => '4.2',
c3fc2621
CW
1071 ],
1072 'hash' => [
e501603b
TO
1073 'name' => 'hash',
1074 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1075 'title' => ts('Mailing Hash'),
215b423e 1076 'description' => ts('Key for validating requests related to this mailing.'),
e501603b
TO
1077 'maxlength' => 16,
1078 'size' => CRM_Utils_Type::TWELVE,
a36434b9 1079 'where' => 'civicrm_mailing.hash',
522a26c9 1080 'table_name' => 'civicrm_mailing',
1081 'entity' => 'Mailing',
1082 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1083 'localizable' => 0,
58b0bf5a 1084 'readonly' => TRUE,
a9d0587b 1085 'add' => '4.5',
c3fc2621
CW
1086 ],
1087 'location_type_id' => [
e501603b
TO
1088 'name' => 'location_type_id',
1089 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 1090 'title' => ts('Location Type ID'),
215b423e 1091 'description' => ts('With email_selection_method, determines which email address to use'),
a36434b9 1092 'where' => 'civicrm_mailing.location_type_id',
522a26c9 1093 'table_name' => 'civicrm_mailing',
1094 'entity' => 'Mailing',
1095 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1096 'localizable' => 0,
e501603b 1097 'FKClassName' => 'CRM_Core_DAO_LocationType',
2cbbebe8
A
1098 'html' => [
1099 'label' => ts("Location Type"),
1100 ],
c3fc2621 1101 'pseudoconstant' => [
e501603b
TO
1102 'table' => 'civicrm_location_type',
1103 'keyColumn' => 'id',
1104 'labelColumn' => 'display_name',
e6ca0a57 1105 ],
a9d0587b 1106 'add' => '4.6',
c3fc2621
CW
1107 ],
1108 'email_selection_method' => [
e501603b
TO
1109 'name' => 'email_selection_method',
1110 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1111 'title' => ts('Email Selection Method'),
215b423e 1112 'description' => ts('With location_type_id, determine how to choose the email address to use.'),
e501603b
TO
1113 'maxlength' => 20,
1114 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 1115 'where' => 'civicrm_mailing.email_selection_method',
e501603b 1116 'default' => 'automatic',
522a26c9 1117 'table_name' => 'civicrm_mailing',
1118 'entity' => 'Mailing',
1119 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1120 'localizable' => 0,
c23563e3
SL
1121 'html' => [
1122 'label' => ts("Email Selection Method"),
1123 ],
c3fc2621 1124 'pseudoconstant' => [
e501603b 1125 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
e6ca0a57 1126 ],
a9d0587b 1127 'add' => '4.6',
c3fc2621
CW
1128 ],
1129 'language' => [
10d3f7d3
SV
1130 'name' => 'language',
1131 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 1132 'title' => ts('Mailing Language'),
215b423e 1133 'description' => ts('Language of the content of the mailing. Useful for tokens.'),
10d3f7d3
SV
1134 'maxlength' => 5,
1135 'size' => CRM_Utils_Type::SIX,
a36434b9 1136 'where' => 'civicrm_mailing.language',
522a26c9 1137 'table_name' => 'civicrm_mailing',
1138 'entity' => 'Mailing',
1139 'bao' => 'CRM_Mailing_BAO_Mailing',
6a7e5e5d 1140 'localizable' => 0,
c3fc2621 1141 'html' => [
10d3f7d3 1142 'type' => 'Select',
c3fc2621
CW
1143 ],
1144 'pseudoconstant' => [
10d3f7d3
SV
1145 'optionGroupName' => 'languages',
1146 'keyColumn' => 'name',
1147 'optionEditPath' => 'civicrm/admin/options/languages',
e6ca0a57 1148 ],
a9d0587b 1149 'add' => '4.6',
c3fc2621
CW
1150 ],
1151 ];
346aaaba 1152 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 1153 }
346aaaba 1154 return Civi::$statics[__CLASS__]['fields'];
e501603b 1155 }
c3fc2621 1156
e501603b 1157 /**
bd8e0b14 1158 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
1159 *
1160 * @return array
bd8e0b14 1161 * Array(string $name => string $uniqueName).
e501603b 1162 */
c3fc2621 1163 public static function &fieldKeys() {
bd8e0b14
TO
1164 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
1165 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 1166 }
bd8e0b14 1167 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 1168 }
c3fc2621 1169
e501603b
TO
1170 /**
1171 * Returns the names of this table
1172 *
1173 * @return string
1174 */
c3fc2621 1175 public static function getTableName() {
e501603b
TO
1176 return self::$_tableName;
1177 }
c3fc2621 1178
e501603b
TO
1179 /**
1180 * Returns if this table needs to be logged
1181 *
c3fc2621 1182 * @return bool
e501603b 1183 */
c3fc2621 1184 public function getLog() {
e501603b
TO
1185 return self::$_log;
1186 }
c3fc2621 1187
e501603b
TO
1188 /**
1189 * Returns the list of fields that can be imported
1190 *
1191 * @param bool $prefix
1192 *
1193 * @return array
1194 */
c3fc2621
CW
1195 public static function &import($prefix = FALSE) {
1196 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing', $prefix, []);
60808919 1197 return $r;
e501603b 1198 }
c3fc2621 1199
e501603b
TO
1200 /**
1201 * Returns the list of fields that can be exported
1202 *
1203 * @param bool $prefix
1204 *
1205 * @return array
1206 */
c3fc2621
CW
1207 public static function &export($prefix = FALSE) {
1208 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing', $prefix, []);
60808919 1209 return $r;
e501603b 1210 }
c3fc2621 1211
e7a6b91a
AS
1212 /**
1213 * Returns the list of indices
c3fc2621
CW
1214 *
1215 * @param bool $localize
1216 *
1217 * @return array
e7a6b91a
AS
1218 */
1219 public static function indices($localize = TRUE) {
c3fc2621
CW
1220 $indices = [
1221 'index_hash' => [
e7a6b91a 1222 'name' => 'index_hash',
c3fc2621 1223 'field' => [
e7a6b91a 1224 0 => 'hash',
c3fc2621
CW
1225 ],
1226 'localizable' => FALSE,
e7a6b91a 1227 'sig' => 'civicrm_mailing::0::hash',
c3fc2621
CW
1228 ],
1229 ];
e7a6b91a
AS
1230 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
1231 }
c3fc2621 1232
e501603b 1233}