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