5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Mailing/Mailing.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e2de6d8875a7f838b190810bcec4e27e)
13 * Database access object for the Mailing entity.
15 class CRM_Mailing_DAO_Mailing
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '';
18 const COMPONENT
= 'CiviMail';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_mailing';
28 * Icon associated with this entity.
32 public static $_icon = 'fa-envelope-o';
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 public static $_log = FALSE;
42 * Paths for accessing this entity in the UI.
46 protected static $_paths = [
47 'add' => 'civicrm/a/#/mailing/new',
48 'update' => 'civicrm/a/#/mailing/[id]',
57 * Which site is this mailing for
64 * FK to the header component.
71 * FK to the footer component.
78 * FK to the auto-responder component.
85 * FK to the unsubscribe component.
89 public $unsubscribe_id;
94 public $resubscribe_id;
97 * FK to the opt-out component.
111 * differentiate between standalone mailings, A/B tests, and A/B final-winner
115 public $mailing_type;
118 * From Header of mailing
125 * From Email of mailing
132 * Reply-To Email of mailing
136 public $replyto_email;
139 * The language/processing system used for email templates.
143 public $template_type;
146 * Advanced options used by the email templating system. (JSON encoded)
150 public $template_options;
160 * Body of the mailing in text format.
167 * Body of the mailing in html format.
174 * Should we track URL click-throughs for this mailing?
178 public $url_tracking;
181 * Should we forward replies back to the author?
185 public $forward_replies;
188 * Should we enable the auto-responder?
192 public $auto_responder;
195 * Should we track when recipients open/read this mailing?
199 public $open_tracking;
202 * Has at least one job associated with this mailing finished?
206 public $is_completed;
209 * FK to the message template.
213 public $msg_template_id;
216 * Overwrite the VERP address in Reply-To
220 public $override_verp;
223 * FK to Contact ID who first created this mailing
230 * Date and time this mailing was created.
234 public $created_date;
237 * When the mailing (or closely related entity) was created or modified or deleted.
241 public $modified_date;
244 * FK to Contact ID who scheduled this mailing
248 public $scheduled_id;
251 * Date and time this mailing was scheduled.
255 public $scheduled_date;
258 * FK to Contact ID who approved this mailing
265 * Date and time this mailing was approved.
269 public $approval_date;
272 * The status of this mailing. Values: none, approved, rejected
276 public $approval_status_id;
279 * Note behind the decision.
283 public $approval_note;
286 * Is this mailing archived?
293 * In what context(s) is the mailing contents visible (online viewing)
300 * The campaign for which this mailing has been initiated.
307 * Remove duplicate emails?
311 public $dedupe_email;
316 public $sms_provider_id;
319 * Key for validating requests related to this mailing.
326 * With email_selection_method, determines which email address to use
330 public $location_type_id;
333 * With location_type_id, determine how to choose the email address to use.
337 public $email_selection_method;
340 * Language of the content of the mailing. Useful for tokens.
349 public function __construct() {
350 $this->__table
= 'civicrm_mailing';
351 parent
::__construct();
355 * Returns localized title of this entity.
357 * @param bool $plural
358 * Whether to return the plural version of the title.
360 public static function getEntityTitle($plural = FALSE) {
361 return $plural ?
ts('Mailings') : ts('Mailing');
365 * Returns foreign keys and entity references.
368 * [CRM_Core_Reference_Interface]
370 public static function getReferenceColumns() {
371 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
372 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
386 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
388 return Civi
::$statics[__CLASS__
]['links'];
392 * Returns all the column names of this table
396 public static function &fields() {
397 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
398 Civi
::$statics[__CLASS__
]['fields'] = [
401 'type' => CRM_Utils_Type
::T_INT
,
402 'title' => ts('Mailing ID'),
404 'where' => 'civicrm_mailing.id',
405 'table_name' => 'civicrm_mailing',
406 'entity' => 'Mailing',
407 'bao' => 'CRM_Mailing_BAO_Mailing',
412 'name' => 'domain_id',
413 'type' => CRM_Utils_Type
::T_INT
,
414 'title' => ts('Mailing Domain'),
415 'description' => ts('Which site is this mailing for'),
416 'where' => 'civicrm_mailing.domain_id',
417 'table_name' => 'civicrm_mailing',
418 'entity' => 'Mailing',
419 'bao' => 'CRM_Mailing_BAO_Mailing',
421 'FKClassName' => 'CRM_Core_DAO_Domain',
422 'pseudoconstant' => [
423 'table' => 'civicrm_domain',
425 'labelColumn' => 'name',
430 'name' => 'header_id',
431 'type' => CRM_Utils_Type
::T_INT
,
432 'title' => ts('Mailing Header'),
433 'description' => ts('FK to the header component.'),
434 'where' => 'civicrm_mailing.header_id',
435 'table_name' => 'civicrm_mailing',
436 'entity' => 'Mailing',
437 'bao' => 'CRM_Mailing_BAO_Mailing',
439 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
440 'pseudoconstant' => [
441 'table' => 'civicrm_mailing_component',
443 'labelColumn' => 'name',
444 'condition' => 'component_type = "Header"',
449 'name' => 'footer_id',
450 'type' => CRM_Utils_Type
::T_INT
,
451 'title' => ts('Mailing Footer'),
452 'description' => ts('FK to the footer component.'),
453 'where' => 'civicrm_mailing.footer_id',
454 'table_name' => 'civicrm_mailing',
455 'entity' => 'Mailing',
456 'bao' => 'CRM_Mailing_BAO_Mailing',
458 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
459 'pseudoconstant' => [
460 'table' => 'civicrm_mailing_component',
462 'labelColumn' => 'name',
463 'condition' => 'component_type = "Footer"',
468 'name' => 'reply_id',
469 'type' => CRM_Utils_Type
::T_INT
,
470 'title' => ts('Mailing Reply'),
471 'description' => ts('FK to the auto-responder component.'),
472 'where' => 'civicrm_mailing.reply_id',
473 'table_name' => 'civicrm_mailing',
474 'entity' => 'Mailing',
475 'bao' => 'CRM_Mailing_BAO_Mailing',
477 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
480 'unsubscribe_id' => [
481 'name' => 'unsubscribe_id',
482 'type' => CRM_Utils_Type
::T_INT
,
483 'title' => ts('Mailing Unsubscribe'),
484 'description' => ts('FK to the unsubscribe component.'),
485 'where' => 'civicrm_mailing.unsubscribe_id',
486 'table_name' => 'civicrm_mailing',
487 'entity' => 'Mailing',
488 'bao' => 'CRM_Mailing_BAO_Mailing',
490 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
493 'resubscribe_id' => [
494 'name' => 'resubscribe_id',
495 'type' => CRM_Utils_Type
::T_INT
,
496 'title' => ts('Mailing Resubscribe'),
497 'where' => 'civicrm_mailing.resubscribe_id',
498 'table_name' => 'civicrm_mailing',
499 'entity' => 'Mailing',
500 'bao' => 'CRM_Mailing_BAO_Mailing',
505 'name' => 'optout_id',
506 'type' => CRM_Utils_Type
::T_INT
,
507 'title' => ts('Mailing Opt Out'),
508 'description' => ts('FK to the opt-out component.'),
509 'where' => 'civicrm_mailing.optout_id',
510 'table_name' => 'civicrm_mailing',
511 'entity' => 'Mailing',
512 'bao' => 'CRM_Mailing_BAO_Mailing',
514 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
519 'type' => CRM_Utils_Type
::T_STRING
,
520 'title' => ts('Mailing Name'),
521 'description' => ts('Mailing Name.'),
523 'size' => CRM_Utils_Type
::HUGE
,
524 'where' => 'civicrm_mailing.name',
525 'table_name' => 'civicrm_mailing',
526 'entity' => 'Mailing',
527 'bao' => 'CRM_Mailing_BAO_Mailing',
535 'name' => 'mailing_type',
536 'type' => CRM_Utils_Type
::T_STRING
,
537 'title' => ts('Mailing Type'),
538 'description' => ts('differentiate between standalone mailings, A/B tests, and A/B final-winner'),
540 'size' => CRM_Utils_Type
::MEDIUM
,
541 'where' => 'civicrm_mailing.mailing_type',
542 'table_name' => 'civicrm_mailing',
543 'entity' => 'Mailing',
544 'bao' => 'CRM_Mailing_BAO_Mailing',
549 'pseudoconstant' => [
550 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
555 'name' => 'from_name',
556 'type' => CRM_Utils_Type
::T_STRING
,
557 'title' => ts('Mailing From Name'),
558 'description' => ts('From Header of mailing'),
560 'size' => CRM_Utils_Type
::HUGE
,
561 'where' => 'civicrm_mailing.from_name',
562 'table_name' => 'civicrm_mailing',
563 'entity' => 'Mailing',
564 'bao' => 'CRM_Mailing_BAO_Mailing',
572 'name' => 'from_email',
573 'type' => CRM_Utils_Type
::T_STRING
,
574 'title' => ts('Mailing From Email'),
575 'description' => ts('From Email of mailing'),
577 'size' => CRM_Utils_Type
::HUGE
,
578 'where' => 'civicrm_mailing.from_email',
579 'table_name' => 'civicrm_mailing',
580 'entity' => 'Mailing',
581 'bao' => 'CRM_Mailing_BAO_Mailing',
589 'name' => 'replyto_email',
590 'type' => CRM_Utils_Type
::T_STRING
,
591 'title' => ts('Replyto Email'),
592 'description' => ts('Reply-To Email of mailing'),
594 'size' => CRM_Utils_Type
::HUGE
,
595 'where' => 'civicrm_mailing.replyto_email',
596 'table_name' => 'civicrm_mailing',
597 'entity' => 'Mailing',
598 'bao' => 'CRM_Mailing_BAO_Mailing',
606 'name' => 'template_type',
607 'type' => CRM_Utils_Type
::T_STRING
,
608 'title' => ts('Template Type'),
609 'description' => ts('The language/processing system used for email templates.'),
612 'size' => CRM_Utils_Type
::BIG
,
613 'where' => 'civicrm_mailing.template_type',
614 'default' => 'traditional',
615 'table_name' => 'civicrm_mailing',
616 'entity' => 'Mailing',
617 'bao' => 'CRM_Mailing_BAO_Mailing',
619 'pseudoconstant' => [
620 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
624 'template_options' => [
625 'name' => 'template_options',
626 'type' => CRM_Utils_Type
::T_LONGTEXT
,
627 'title' => ts('Template Options (JSON)'),
628 'description' => ts('Advanced options used by the email templating system. (JSON encoded)'),
629 'where' => 'civicrm_mailing.template_options',
630 'table_name' => 'civicrm_mailing',
631 'entity' => 'Mailing',
632 'bao' => 'CRM_Mailing_BAO_Mailing',
638 'type' => CRM_Utils_Type
::T_STRING
,
639 'title' => ts('Subject'),
640 'description' => ts('Subject of mailing'),
642 'size' => CRM_Utils_Type
::HUGE
,
643 'where' => 'civicrm_mailing.subject',
644 'table_name' => 'civicrm_mailing',
645 'entity' => 'Mailing',
646 'bao' => 'CRM_Mailing_BAO_Mailing',
654 'name' => 'body_text',
655 'type' => CRM_Utils_Type
::T_LONGTEXT
,
656 'title' => ts('Body Text'),
657 'description' => ts('Body of the mailing in text format.'),
658 'where' => 'civicrm_mailing.body_text',
659 'table_name' => 'civicrm_mailing',
660 'entity' => 'Mailing',
661 'bao' => 'CRM_Mailing_BAO_Mailing',
666 'name' => 'body_html',
667 'type' => CRM_Utils_Type
::T_LONGTEXT
,
668 'title' => ts('Body Html'),
669 'description' => ts('Body of the mailing in html format.'),
670 'where' => 'civicrm_mailing.body_html',
671 'table_name' => 'civicrm_mailing',
672 'entity' => 'Mailing',
673 'bao' => 'CRM_Mailing_BAO_Mailing',
678 'name' => 'url_tracking',
679 'type' => CRM_Utils_Type
::T_BOOLEAN
,
680 'title' => ts('Url Tracking'),
681 'description' => ts('Should we track URL click-throughs for this mailing?'),
682 'where' => 'civicrm_mailing.url_tracking',
683 'table_name' => 'civicrm_mailing',
684 'entity' => 'Mailing',
685 'bao' => 'CRM_Mailing_BAO_Mailing',
688 'type' => 'CheckBox',
692 'forward_replies' => [
693 'name' => 'forward_replies',
694 'type' => CRM_Utils_Type
::T_BOOLEAN
,
695 'title' => ts('Forward Replies'),
696 'description' => ts('Should we forward replies back to the author?'),
697 'where' => 'civicrm_mailing.forward_replies',
698 'table_name' => 'civicrm_mailing',
699 'entity' => 'Mailing',
700 'bao' => 'CRM_Mailing_BAO_Mailing',
703 'type' => 'CheckBox',
707 'auto_responder' => [
708 'name' => 'auto_responder',
709 'type' => CRM_Utils_Type
::T_BOOLEAN
,
710 'title' => ts('Auto Responder'),
711 'description' => ts('Should we enable the auto-responder?'),
712 'where' => 'civicrm_mailing.auto_responder',
713 'table_name' => 'civicrm_mailing',
714 'entity' => 'Mailing',
715 'bao' => 'CRM_Mailing_BAO_Mailing',
718 'type' => 'CheckBox',
723 'name' => 'open_tracking',
724 'type' => CRM_Utils_Type
::T_BOOLEAN
,
725 'title' => ts('Track Mailing?'),
726 'description' => ts('Should we track when recipients open/read this mailing?'),
727 'where' => 'civicrm_mailing.open_tracking',
728 'table_name' => 'civicrm_mailing',
729 'entity' => 'Mailing',
730 'bao' => 'CRM_Mailing_BAO_Mailing',
735 'name' => 'is_completed',
736 'type' => CRM_Utils_Type
::T_BOOLEAN
,
737 'title' => ts('Mailing Completed'),
738 'description' => ts('Has at least one job associated with this mailing finished?'),
739 'where' => 'civicrm_mailing.is_completed',
740 'table_name' => 'civicrm_mailing',
741 'entity' => 'Mailing',
742 'bao' => 'CRM_Mailing_BAO_Mailing',
745 'type' => 'CheckBox',
749 'msg_template_id' => [
750 'name' => 'msg_template_id',
751 'type' => CRM_Utils_Type
::T_INT
,
752 'title' => ts('Mailing Message Template'),
753 'description' => ts('FK to the message template.'),
754 'where' => 'civicrm_mailing.msg_template_id',
755 'table_name' => 'civicrm_mailing',
756 'entity' => 'Mailing',
757 'bao' => 'CRM_Mailing_BAO_Mailing',
759 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
763 'name' => 'override_verp',
764 'type' => CRM_Utils_Type
::T_BOOLEAN
,
765 'title' => ts('Override Verp'),
766 'description' => ts('Overwrite the VERP address in Reply-To'),
767 'where' => 'civicrm_mailing.override_verp',
769 'table_name' => 'civicrm_mailing',
770 'entity' => 'Mailing',
771 'bao' => 'CRM_Mailing_BAO_Mailing',
774 'type' => 'CheckBox',
779 'name' => 'created_id',
780 'type' => CRM_Utils_Type
::T_INT
,
781 'title' => ts('Mailing Creator'),
782 'description' => ts('FK to Contact ID who first created this mailing'),
783 'where' => 'civicrm_mailing.created_id',
784 'table_name' => 'civicrm_mailing',
785 'entity' => 'Mailing',
786 'bao' => 'CRM_Mailing_BAO_Mailing',
788 'FKClassName' => 'CRM_Contact_DAO_Contact',
792 'name' => 'created_date',
793 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
794 'title' => ts('Mailing Created Date'),
795 'description' => ts('Date and time this mailing was created.'),
797 'where' => 'civicrm_mailing.created_date',
799 'table_name' => 'civicrm_mailing',
800 'entity' => 'Mailing',
801 'bao' => 'CRM_Mailing_BAO_Mailing',
804 'type' => 'Select Date',
805 'formatType' => 'activityDateTime',
809 'mailing_modified_date' => [
810 'name' => 'modified_date',
811 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
812 'title' => ts('Modified Date'),
813 'description' => ts('When the mailing (or closely related entity) was created or modified or deleted.'),
815 'where' => 'civicrm_mailing.modified_date',
817 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
818 'table_name' => 'civicrm_mailing',
819 'entity' => 'Mailing',
820 'bao' => 'CRM_Mailing_BAO_Mailing',
825 'name' => 'scheduled_id',
826 'type' => CRM_Utils_Type
::T_INT
,
827 'title' => ts('Scheduled By'),
828 'description' => ts('FK to Contact ID who scheduled this mailing'),
829 'where' => 'civicrm_mailing.scheduled_id',
830 'table_name' => 'civicrm_mailing',
831 'entity' => 'Mailing',
832 'bao' => 'CRM_Mailing_BAO_Mailing',
834 'FKClassName' => 'CRM_Contact_DAO_Contact',
837 'scheduled_date' => [
838 'name' => 'scheduled_date',
839 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
840 'title' => ts('Mailing Scheduled Date'),
841 'description' => ts('Date and time this mailing was scheduled.'),
843 'where' => 'civicrm_mailing.scheduled_date',
845 'table_name' => 'civicrm_mailing',
846 'entity' => 'Mailing',
847 'bao' => 'CRM_Mailing_BAO_Mailing',
850 'type' => 'Select Date',
851 'formatType' => 'activityDateTime',
856 'name' => 'approver_id',
857 'type' => CRM_Utils_Type
::T_INT
,
858 'title' => ts('Approved By'),
859 'description' => ts('FK to Contact ID who approved this mailing'),
860 'where' => 'civicrm_mailing.approver_id',
861 'table_name' => 'civicrm_mailing',
862 'entity' => 'Mailing',
863 'bao' => 'CRM_Mailing_BAO_Mailing',
865 'FKClassName' => 'CRM_Contact_DAO_Contact',
869 'name' => 'approval_date',
870 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
871 'title' => ts('Mailing Approved Date'),
872 'description' => ts('Date and time this mailing was approved.'),
874 'where' => 'civicrm_mailing.approval_date',
876 'table_name' => 'civicrm_mailing',
877 'entity' => 'Mailing',
878 'bao' => 'CRM_Mailing_BAO_Mailing',
881 'type' => 'Select Date',
882 'formatType' => 'activityDateTime',
886 'approval_status_id' => [
887 'name' => 'approval_status_id',
888 'type' => CRM_Utils_Type
::T_INT
,
889 'title' => ts('Approval Status'),
890 'description' => ts('The status of this mailing. Values: none, approved, rejected'),
891 'where' => 'civicrm_mailing.approval_status_id',
892 'table_name' => 'civicrm_mailing',
893 'entity' => 'Mailing',
894 'bao' => 'CRM_Mailing_BAO_Mailing',
899 'pseudoconstant' => [
900 'optionGroupName' => 'mail_approval_status',
901 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
906 'name' => 'approval_note',
907 'type' => CRM_Utils_Type
::T_LONGTEXT
,
908 'title' => ts('Approval Note'),
909 'description' => ts('Note behind the decision.'),
910 'where' => 'civicrm_mailing.approval_note',
911 'table_name' => 'civicrm_mailing',
912 'entity' => 'Mailing',
913 'bao' => 'CRM_Mailing_BAO_Mailing',
916 'type' => 'TextArea',
921 'name' => 'is_archived',
922 'type' => CRM_Utils_Type
::T_BOOLEAN
,
923 'title' => ts('Is Mailing Archived?'),
924 'description' => ts('Is this mailing archived?'),
925 'where' => 'civicrm_mailing.is_archived',
927 'table_name' => 'civicrm_mailing',
928 'entity' => 'Mailing',
929 'bao' => 'CRM_Mailing_BAO_Mailing',
932 'type' => 'CheckBox',
937 'name' => 'visibility',
938 'type' => CRM_Utils_Type
::T_STRING
,
939 'title' => ts('Mailing Visibility'),
940 'description' => ts('In what context(s) is the mailing contents visible (online viewing)'),
942 'size' => CRM_Utils_Type
::BIG
,
943 'where' => 'civicrm_mailing.visibility',
944 'default' => 'Public Pages',
945 'table_name' => 'civicrm_mailing',
946 'entity' => 'Mailing',
947 'bao' => 'CRM_Mailing_BAO_Mailing',
952 'pseudoconstant' => [
953 'callback' => 'CRM_Core_SelectValues::groupVisibility',
958 'name' => 'campaign_id',
959 'type' => CRM_Utils_Type
::T_INT
,
960 'title' => ts('Mailing Campaign'),
961 'description' => ts('The campaign for which this mailing has been initiated.'),
962 'where' => 'civicrm_mailing.campaign_id',
963 'table_name' => 'civicrm_mailing',
964 'entity' => 'Mailing',
965 'bao' => 'CRM_Mailing_BAO_Mailing',
967 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
971 'pseudoconstant' => [
972 'table' => 'civicrm_campaign',
974 'labelColumn' => 'title',
979 'name' => 'dedupe_email',
980 'type' => CRM_Utils_Type
::T_BOOLEAN
,
981 'title' => ts('No Duplicate emails?'),
982 'description' => ts('Remove duplicate emails?'),
983 'where' => 'civicrm_mailing.dedupe_email',
985 'table_name' => 'civicrm_mailing',
986 'entity' => 'Mailing',
987 'bao' => 'CRM_Mailing_BAO_Mailing',
990 'type' => 'CheckBox',
994 'sms_provider_id' => [
995 'name' => 'sms_provider_id',
996 'type' => CRM_Utils_Type
::T_INT
,
997 'title' => ts('Mailing SMS Provider'),
998 'where' => 'civicrm_mailing.sms_provider_id',
999 'table_name' => 'civicrm_mailing',
1000 'entity' => 'Mailing',
1001 'bao' => 'CRM_Mailing_BAO_Mailing',
1003 'FKClassName' => 'CRM_SMS_DAO_Provider',
1011 'type' => CRM_Utils_Type
::T_STRING
,
1012 'title' => ts('Mailing Hash'),
1013 'description' => ts('Key for validating requests related to this mailing.'),
1015 'size' => CRM_Utils_Type
::TWELVE
,
1016 'where' => 'civicrm_mailing.hash',
1017 'table_name' => 'civicrm_mailing',
1018 'entity' => 'Mailing',
1019 'bao' => 'CRM_Mailing_BAO_Mailing',
1023 'location_type_id' => [
1024 'name' => 'location_type_id',
1025 'type' => CRM_Utils_Type
::T_INT
,
1026 'title' => ts('Location Type'),
1027 'description' => ts('With email_selection_method, determines which email address to use'),
1028 'where' => 'civicrm_mailing.location_type_id',
1029 'table_name' => 'civicrm_mailing',
1030 'entity' => 'Mailing',
1031 'bao' => 'CRM_Mailing_BAO_Mailing',
1033 'FKClassName' => 'CRM_Core_DAO_LocationType',
1034 'pseudoconstant' => [
1035 'table' => 'civicrm_location_type',
1036 'keyColumn' => 'id',
1037 'labelColumn' => 'display_name',
1041 'email_selection_method' => [
1042 'name' => 'email_selection_method',
1043 'type' => CRM_Utils_Type
::T_STRING
,
1044 'title' => ts('Email Selection Method'),
1045 'description' => ts('With location_type_id, determine how to choose the email address to use.'),
1047 'size' => CRM_Utils_Type
::MEDIUM
,
1048 'where' => 'civicrm_mailing.email_selection_method',
1049 'default' => 'automatic',
1050 'table_name' => 'civicrm_mailing',
1051 'entity' => 'Mailing',
1052 'bao' => 'CRM_Mailing_BAO_Mailing',
1054 'pseudoconstant' => [
1055 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
1060 'name' => 'language',
1061 'type' => CRM_Utils_Type
::T_STRING
,
1062 'title' => ts('Mailing Language'),
1063 'description' => ts('Language of the content of the mailing. Useful for tokens.'),
1065 'size' => CRM_Utils_Type
::SIX
,
1066 'where' => 'civicrm_mailing.language',
1067 'table_name' => 'civicrm_mailing',
1068 'entity' => 'Mailing',
1069 'bao' => 'CRM_Mailing_BAO_Mailing',
1074 'pseudoconstant' => [
1075 'optionGroupName' => 'languages',
1076 'keyColumn' => 'name',
1077 'optionEditPath' => 'civicrm/admin/options/languages',
1082 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1084 return Civi
::$statics[__CLASS__
]['fields'];
1088 * Return a mapping from field-name to the corresponding key (as used in fields()).
1091 * Array(string $name => string $uniqueName).
1093 public static function &fieldKeys() {
1094 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1095 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1097 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1101 * Returns the names of this table
1105 public static function getTableName() {
1106 return self
::$_tableName;
1110 * Returns if this table needs to be logged
1114 public function getLog() {
1119 * Returns the list of fields that can be imported
1121 * @param bool $prefix
1125 public static function &import($prefix = FALSE) {
1126 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing', $prefix, []);
1131 * Returns the list of fields that can be exported
1133 * @param bool $prefix
1137 public static function &export($prefix = FALSE) {
1138 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing', $prefix, []);
1143 * Returns the list of indices
1145 * @param bool $localize
1149 public static function indices($localize = TRUE) {
1152 'name' => 'index_hash',
1156 'localizable' => FALSE,
1157 'sig' => 'civicrm_mailing::0::hash',
1160 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;