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:0889788ebb2ad430999bb9eda9524621)
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 user-friendly description of this entity.
369 public static function getEntityDescription() {
370 return ts('Mass emails sent from CiviMail.');
374 * Returns foreign keys and entity references.
377 * [CRM_Core_Reference_Interface]
379 public static function getReferenceColumns() {
380 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
381 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
395 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
397 return Civi
::$statics[__CLASS__
]['links'];
401 * Returns all the column names of this table
405 public static function &fields() {
406 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
407 Civi
::$statics[__CLASS__
]['fields'] = [
410 'type' => CRM_Utils_Type
::T_INT
,
411 'title' => ts('Mailing ID'),
413 'where' => 'civicrm_mailing.id',
414 'table_name' => 'civicrm_mailing',
415 'entity' => 'Mailing',
416 'bao' => 'CRM_Mailing_BAO_Mailing',
425 'name' => 'domain_id',
426 'type' => CRM_Utils_Type
::T_INT
,
427 'title' => ts('Domain ID'),
428 'description' => ts('Which site is this mailing for'),
429 'where' => 'civicrm_mailing.domain_id',
430 'table_name' => 'civicrm_mailing',
431 'entity' => 'Mailing',
432 'bao' => 'CRM_Mailing_BAO_Mailing',
434 'FKClassName' => 'CRM_Core_DAO_Domain',
436 'label' => ts("Domain"),
438 'pseudoconstant' => [
439 'table' => 'civicrm_domain',
441 'labelColumn' => 'name',
446 'name' => 'header_id',
447 'type' => CRM_Utils_Type
::T_INT
,
448 'title' => ts('Header ID'),
449 'description' => ts('FK to the header component.'),
450 'where' => 'civicrm_mailing.header_id',
451 'table_name' => 'civicrm_mailing',
452 'entity' => 'Mailing',
453 'bao' => 'CRM_Mailing_BAO_Mailing',
455 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
457 'label' => ts("Header"),
459 'pseudoconstant' => [
460 'table' => 'civicrm_mailing_component',
462 'labelColumn' => 'name',
463 'condition' => 'component_type = "Header"',
468 'name' => 'footer_id',
469 'type' => CRM_Utils_Type
::T_INT
,
470 'title' => ts('Footer ID'),
471 'description' => ts('FK to the footer component.'),
472 'where' => 'civicrm_mailing.footer_id',
473 'table_name' => 'civicrm_mailing',
474 'entity' => 'Mailing',
475 'bao' => 'CRM_Mailing_BAO_Mailing',
477 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
479 'label' => ts("Footer"),
481 'pseudoconstant' => [
482 'table' => 'civicrm_mailing_component',
484 'labelColumn' => 'name',
485 'condition' => 'component_type = "Footer"',
490 'name' => 'reply_id',
491 'type' => CRM_Utils_Type
::T_INT
,
492 'title' => ts('Reply ID'),
493 'description' => ts('FK to the auto-responder component.'),
494 'where' => 'civicrm_mailing.reply_id',
495 'table_name' => 'civicrm_mailing',
496 'entity' => 'Mailing',
497 'bao' => 'CRM_Mailing_BAO_Mailing',
499 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
501 'label' => ts("Reply"),
505 'unsubscribe_id' => [
506 'name' => 'unsubscribe_id',
507 'type' => CRM_Utils_Type
::T_INT
,
508 'title' => ts('Unsubscribe ID'),
509 'description' => ts('FK to the unsubscribe component.'),
510 'where' => 'civicrm_mailing.unsubscribe_id',
511 'table_name' => 'civicrm_mailing',
512 'entity' => 'Mailing',
513 'bao' => 'CRM_Mailing_BAO_Mailing',
515 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
517 'label' => ts("Unsubscribe"),
521 'resubscribe_id' => [
522 'name' => 'resubscribe_id',
523 'type' => CRM_Utils_Type
::T_INT
,
524 'title' => ts('Mailing Resubscribe'),
525 'where' => 'civicrm_mailing.resubscribe_id',
526 'table_name' => 'civicrm_mailing',
527 'entity' => 'Mailing',
528 'bao' => 'CRM_Mailing_BAO_Mailing',
533 'name' => 'optout_id',
534 'type' => CRM_Utils_Type
::T_INT
,
535 'title' => ts('Opt Out ID'),
536 'description' => ts('FK to the opt-out component.'),
537 'where' => 'civicrm_mailing.optout_id',
538 'table_name' => 'civicrm_mailing',
539 'entity' => 'Mailing',
540 'bao' => 'CRM_Mailing_BAO_Mailing',
542 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
544 'label' => ts("Opt Out"),
550 'type' => CRM_Utils_Type
::T_STRING
,
551 'title' => ts('Mailing Name'),
552 'description' => ts('Mailing Name.'),
554 'size' => CRM_Utils_Type
::HUGE
,
555 'where' => 'civicrm_mailing.name',
556 'table_name' => 'civicrm_mailing',
557 'entity' => 'Mailing',
558 'bao' => 'CRM_Mailing_BAO_Mailing',
566 'name' => 'mailing_type',
567 'type' => CRM_Utils_Type
::T_STRING
,
568 'title' => ts('Mailing Type'),
569 'description' => ts('differentiate between standalone mailings, A/B tests, and A/B final-winner'),
571 'size' => CRM_Utils_Type
::MEDIUM
,
572 'where' => 'civicrm_mailing.mailing_type',
573 'table_name' => 'civicrm_mailing',
574 'entity' => 'Mailing',
575 'bao' => 'CRM_Mailing_BAO_Mailing',
580 'pseudoconstant' => [
581 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
586 'name' => 'from_name',
587 'type' => CRM_Utils_Type
::T_STRING
,
588 'title' => ts('Mailing From Name'),
589 'description' => ts('From Header of mailing'),
591 'size' => CRM_Utils_Type
::HUGE
,
592 'where' => 'civicrm_mailing.from_name',
593 'table_name' => 'civicrm_mailing',
594 'entity' => 'Mailing',
595 'bao' => 'CRM_Mailing_BAO_Mailing',
603 'name' => 'from_email',
604 'type' => CRM_Utils_Type
::T_STRING
,
605 'title' => ts('Mailing From Email'),
606 'description' => ts('From Email of mailing'),
608 'size' => CRM_Utils_Type
::HUGE
,
609 'where' => 'civicrm_mailing.from_email',
610 'table_name' => 'civicrm_mailing',
611 'entity' => 'Mailing',
612 'bao' => 'CRM_Mailing_BAO_Mailing',
620 'name' => 'replyto_email',
621 'type' => CRM_Utils_Type
::T_STRING
,
622 'title' => ts('Replyto Email'),
623 'description' => ts('Reply-To Email of mailing'),
625 'size' => CRM_Utils_Type
::HUGE
,
626 'where' => 'civicrm_mailing.replyto_email',
627 'table_name' => 'civicrm_mailing',
628 'entity' => 'Mailing',
629 'bao' => 'CRM_Mailing_BAO_Mailing',
633 'label' => ts("Reply-To Email"),
638 'name' => 'template_type',
639 'type' => CRM_Utils_Type
::T_STRING
,
640 'title' => ts('Template Type'),
641 'description' => ts('The language/processing system used for email templates.'),
644 'size' => CRM_Utils_Type
::BIG
,
645 'where' => 'civicrm_mailing.template_type',
646 'default' => 'traditional',
647 'table_name' => 'civicrm_mailing',
648 'entity' => 'Mailing',
649 'bao' => 'CRM_Mailing_BAO_Mailing',
651 'pseudoconstant' => [
652 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
656 'template_options' => [
657 'name' => 'template_options',
658 'type' => CRM_Utils_Type
::T_LONGTEXT
,
659 'title' => ts('Template Options (JSON)'),
660 'description' => ts('Advanced options used by the email templating system. (JSON encoded)'),
661 'where' => 'civicrm_mailing.template_options',
662 'table_name' => 'civicrm_mailing',
663 'entity' => 'Mailing',
664 'bao' => 'CRM_Mailing_BAO_Mailing',
670 'type' => CRM_Utils_Type
::T_STRING
,
671 'title' => ts('Subject'),
672 'description' => ts('Subject of mailing'),
674 'size' => CRM_Utils_Type
::HUGE
,
675 'where' => 'civicrm_mailing.subject',
676 'table_name' => 'civicrm_mailing',
677 'entity' => 'Mailing',
678 'bao' => 'CRM_Mailing_BAO_Mailing',
682 'label' => ts("Subject"),
687 'name' => 'body_text',
688 'type' => CRM_Utils_Type
::T_LONGTEXT
,
689 'title' => ts('Body Text'),
690 'description' => ts('Body of the mailing in text format.'),
691 'where' => 'civicrm_mailing.body_text',
692 'table_name' => 'civicrm_mailing',
693 'entity' => 'Mailing',
694 'bao' => 'CRM_Mailing_BAO_Mailing',
697 'label' => ts("Body Text"),
702 'name' => 'body_html',
703 'type' => CRM_Utils_Type
::T_LONGTEXT
,
704 'title' => ts('Body Html'),
705 'description' => ts('Body of the mailing in html format.'),
706 'where' => 'civicrm_mailing.body_html',
707 'table_name' => 'civicrm_mailing',
708 'entity' => 'Mailing',
709 'bao' => 'CRM_Mailing_BAO_Mailing',
712 'label' => ts("Body HTML"),
717 'name' => 'url_tracking',
718 'type' => CRM_Utils_Type
::T_BOOLEAN
,
719 'title' => ts('Url Tracking'),
720 'description' => ts('Should we track URL click-throughs for this mailing?'),
721 'where' => 'civicrm_mailing.url_tracking',
722 'table_name' => 'civicrm_mailing',
723 'entity' => 'Mailing',
724 'bao' => 'CRM_Mailing_BAO_Mailing',
727 'type' => 'CheckBox',
728 'label' => ts("Url Tracking"),
732 'forward_replies' => [
733 'name' => 'forward_replies',
734 'type' => CRM_Utils_Type
::T_BOOLEAN
,
735 'title' => ts('Forward Replies'),
736 'description' => ts('Should we forward replies back to the author?'),
737 'where' => 'civicrm_mailing.forward_replies',
738 'table_name' => 'civicrm_mailing',
739 'entity' => 'Mailing',
740 'bao' => 'CRM_Mailing_BAO_Mailing',
743 'type' => 'CheckBox',
744 'label' => ts("Forward Replies"),
748 'auto_responder' => [
749 'name' => 'auto_responder',
750 'type' => CRM_Utils_Type
::T_BOOLEAN
,
751 'title' => ts('Auto Responder'),
752 'description' => ts('Should we enable the auto-responder?'),
753 'where' => 'civicrm_mailing.auto_responder',
754 'table_name' => 'civicrm_mailing',
755 'entity' => 'Mailing',
756 'bao' => 'CRM_Mailing_BAO_Mailing',
759 'type' => 'CheckBox',
760 'label' => ts("Auto Responder"),
765 'name' => 'open_tracking',
766 'type' => CRM_Utils_Type
::T_BOOLEAN
,
767 'title' => ts('Track Mailing?'),
768 'description' => ts('Should we track when recipients open/read this mailing?'),
769 'where' => 'civicrm_mailing.open_tracking',
770 'table_name' => 'civicrm_mailing',
771 'entity' => 'Mailing',
772 'bao' => 'CRM_Mailing_BAO_Mailing',
777 'name' => 'is_completed',
778 'type' => CRM_Utils_Type
::T_BOOLEAN
,
779 'title' => ts('Mailing Completed'),
780 'description' => ts('Has at least one job associated with this mailing finished?'),
781 'where' => 'civicrm_mailing.is_completed',
782 'table_name' => 'civicrm_mailing',
783 'entity' => 'Mailing',
784 'bao' => 'CRM_Mailing_BAO_Mailing',
787 'type' => 'CheckBox',
791 'msg_template_id' => [
792 'name' => 'msg_template_id',
793 'type' => CRM_Utils_Type
::T_INT
,
794 'title' => ts('Message Template ID'),
795 'description' => ts('FK to the message template.'),
796 'where' => 'civicrm_mailing.msg_template_id',
797 'table_name' => 'civicrm_mailing',
798 'entity' => 'Mailing',
799 'bao' => 'CRM_Mailing_BAO_Mailing',
801 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
803 'label' => ts("Message Template"),
808 'name' => 'override_verp',
809 'type' => CRM_Utils_Type
::T_BOOLEAN
,
810 'title' => ts('Override Verp'),
811 'description' => ts('Overwrite the VERP address in Reply-To'),
812 'where' => 'civicrm_mailing.override_verp',
814 'table_name' => 'civicrm_mailing',
815 'entity' => 'Mailing',
816 'bao' => 'CRM_Mailing_BAO_Mailing',
819 'type' => 'CheckBox',
820 'label' => ts("Overwrite VERP"),
825 'name' => 'created_id',
826 'type' => CRM_Utils_Type
::T_INT
,
827 'title' => ts('Created By Contact ID'),
828 'description' => ts('FK to Contact ID who first created this mailing'),
829 'where' => 'civicrm_mailing.created_id',
830 'table_name' => 'civicrm_mailing',
831 'entity' => 'Mailing',
832 'bao' => 'CRM_Mailing_BAO_Mailing',
834 'FKClassName' => 'CRM_Contact_DAO_Contact',
836 'label' => ts("Creator"),
841 'name' => 'created_date',
842 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
843 'title' => ts('Mailing Created Date'),
844 'description' => ts('Date and time this mailing was created.'),
846 'where' => 'civicrm_mailing.created_date',
847 'default' => 'CURRENT_TIMESTAMP',
848 'table_name' => 'civicrm_mailing',
849 'entity' => 'Mailing',
850 'bao' => 'CRM_Mailing_BAO_Mailing',
853 'type' => 'Select Date',
854 'formatType' => 'activityDateTime',
858 'mailing_modified_date' => [
859 'name' => 'modified_date',
860 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
861 'title' => ts('Modified Date'),
862 'description' => ts('When the mailing (or closely related entity) was created or modified or deleted.'),
864 'where' => 'civicrm_mailing.modified_date',
866 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
867 'table_name' => 'civicrm_mailing',
868 'entity' => 'Mailing',
869 'bao' => 'CRM_Mailing_BAO_Mailing',
872 'label' => ts("Modified Date"),
878 'name' => 'scheduled_id',
879 'type' => CRM_Utils_Type
::T_INT
,
880 'title' => ts('Scheduled By Contact ID'),
881 'description' => ts('FK to Contact ID who scheduled this mailing'),
882 'where' => 'civicrm_mailing.scheduled_id',
883 'table_name' => 'civicrm_mailing',
884 'entity' => 'Mailing',
885 'bao' => 'CRM_Mailing_BAO_Mailing',
887 'FKClassName' => 'CRM_Contact_DAO_Contact',
889 'label' => ts("Scheduled By"),
893 'scheduled_date' => [
894 'name' => 'scheduled_date',
895 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
896 'title' => ts('Mailing Scheduled Date'),
897 'description' => ts('Date and time this mailing was scheduled.'),
899 'where' => 'civicrm_mailing.scheduled_date',
901 'table_name' => 'civicrm_mailing',
902 'entity' => 'Mailing',
903 'bao' => 'CRM_Mailing_BAO_Mailing',
906 'type' => 'Select Date',
907 'formatType' => 'activityDateTime',
912 'name' => 'approver_id',
913 'type' => CRM_Utils_Type
::T_INT
,
914 'title' => ts('Approved By Contact ID'),
915 'description' => ts('FK to Contact ID who approved this mailing'),
916 'where' => 'civicrm_mailing.approver_id',
917 'table_name' => 'civicrm_mailing',
918 'entity' => 'Mailing',
919 'bao' => 'CRM_Mailing_BAO_Mailing',
921 'FKClassName' => 'CRM_Contact_DAO_Contact',
923 'label' => ts("Approved By"),
928 'name' => 'approval_date',
929 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
930 'title' => ts('Mailing Approved Date'),
931 'description' => ts('Date and time this mailing was approved.'),
933 'where' => 'civicrm_mailing.approval_date',
935 'table_name' => 'civicrm_mailing',
936 'entity' => 'Mailing',
937 'bao' => 'CRM_Mailing_BAO_Mailing',
940 'type' => 'Select Date',
941 'formatType' => 'activityDateTime',
945 'approval_status_id' => [
946 'name' => 'approval_status_id',
947 'type' => CRM_Utils_Type
::T_INT
,
948 'title' => ts('Approval Status'),
949 'description' => ts('The status of this mailing. Values: none, approved, rejected'),
950 'where' => 'civicrm_mailing.approval_status_id',
951 'table_name' => 'civicrm_mailing',
952 'entity' => 'Mailing',
953 'bao' => 'CRM_Mailing_BAO_Mailing',
958 'pseudoconstant' => [
959 'optionGroupName' => 'mail_approval_status',
960 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
965 'name' => 'approval_note',
966 'type' => CRM_Utils_Type
::T_LONGTEXT
,
967 'title' => ts('Approval Note'),
968 'description' => ts('Note behind the decision.'),
969 'where' => 'civicrm_mailing.approval_note',
970 'table_name' => 'civicrm_mailing',
971 'entity' => 'Mailing',
972 'bao' => 'CRM_Mailing_BAO_Mailing',
975 'type' => 'TextArea',
980 'name' => 'is_archived',
981 'type' => CRM_Utils_Type
::T_BOOLEAN
,
982 'title' => ts('Is Mailing Archived?'),
983 'description' => ts('Is this mailing archived?'),
984 'where' => 'civicrm_mailing.is_archived',
986 'table_name' => 'civicrm_mailing',
987 'entity' => 'Mailing',
988 'bao' => 'CRM_Mailing_BAO_Mailing',
991 'type' => 'CheckBox',
996 'name' => 'visibility',
997 'type' => CRM_Utils_Type
::T_STRING
,
998 'title' => ts('Mailing Visibility'),
999 'description' => ts('In what context(s) is the mailing contents visible (online viewing)'),
1001 'size' => CRM_Utils_Type
::BIG
,
1002 'where' => 'civicrm_mailing.visibility',
1003 'default' => 'Public Pages',
1004 'table_name' => 'civicrm_mailing',
1005 'entity' => 'Mailing',
1006 'bao' => 'CRM_Mailing_BAO_Mailing',
1011 'pseudoconstant' => [
1012 'callback' => 'CRM_Core_SelectValues::groupVisibility',
1017 'name' => 'campaign_id',
1018 'type' => CRM_Utils_Type
::T_INT
,
1019 'title' => ts('Campaign ID'),
1020 'description' => ts('The campaign for which this mailing has been initiated.'),
1021 'where' => 'civicrm_mailing.campaign_id',
1022 'table_name' => 'civicrm_mailing',
1023 'entity' => 'Mailing',
1024 'bao' => 'CRM_Mailing_BAO_Mailing',
1026 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
1027 'component' => 'CiviCampaign',
1029 'type' => 'EntityRef',
1030 'label' => ts("Campaign"),
1032 'pseudoconstant' => [
1033 'table' => 'civicrm_campaign',
1034 'keyColumn' => 'id',
1035 'labelColumn' => 'title',
1036 'prefetch' => 'FALSE',
1041 'name' => 'dedupe_email',
1042 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1043 'title' => ts('No Duplicate emails?'),
1044 'description' => ts('Remove duplicate emails?'),
1045 'where' => 'civicrm_mailing.dedupe_email',
1047 'table_name' => 'civicrm_mailing',
1048 'entity' => 'Mailing',
1049 'bao' => 'CRM_Mailing_BAO_Mailing',
1052 'type' => 'CheckBox',
1056 'sms_provider_id' => [
1057 'name' => 'sms_provider_id',
1058 'type' => CRM_Utils_Type
::T_INT
,
1059 'title' => ts('SMS Provider ID'),
1060 'where' => 'civicrm_mailing.sms_provider_id',
1061 'table_name' => 'civicrm_mailing',
1062 'entity' => 'Mailing',
1063 'bao' => 'CRM_Mailing_BAO_Mailing',
1065 'FKClassName' => 'CRM_SMS_DAO_Provider',
1068 'label' => ts("SMS Provider"),
1074 'type' => CRM_Utils_Type
::T_STRING
,
1075 'title' => ts('Mailing Hash'),
1076 'description' => ts('Key for validating requests related to this mailing.'),
1078 'size' => CRM_Utils_Type
::TWELVE
,
1079 'where' => 'civicrm_mailing.hash',
1080 'table_name' => 'civicrm_mailing',
1081 'entity' => 'Mailing',
1082 'bao' => 'CRM_Mailing_BAO_Mailing',
1087 'location_type_id' => [
1088 'name' => 'location_type_id',
1089 'type' => CRM_Utils_Type
::T_INT
,
1090 'title' => ts('Location Type ID'),
1091 'description' => ts('With email_selection_method, determines which email address to use'),
1092 'where' => 'civicrm_mailing.location_type_id',
1093 'table_name' => 'civicrm_mailing',
1094 'entity' => 'Mailing',
1095 'bao' => 'CRM_Mailing_BAO_Mailing',
1097 'FKClassName' => 'CRM_Core_DAO_LocationType',
1099 'label' => ts("Location Type"),
1101 'pseudoconstant' => [
1102 'table' => 'civicrm_location_type',
1103 'keyColumn' => 'id',
1104 'labelColumn' => 'display_name',
1108 'email_selection_method' => [
1109 'name' => 'email_selection_method',
1110 'type' => CRM_Utils_Type
::T_STRING
,
1111 'title' => ts('Email Selection Method'),
1112 'description' => ts('With location_type_id, determine how to choose the email address to use.'),
1114 'size' => CRM_Utils_Type
::MEDIUM
,
1115 'where' => 'civicrm_mailing.email_selection_method',
1116 'default' => 'automatic',
1117 'table_name' => 'civicrm_mailing',
1118 'entity' => 'Mailing',
1119 'bao' => 'CRM_Mailing_BAO_Mailing',
1122 'label' => ts("Email Selection Method"),
1124 'pseudoconstant' => [
1125 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
1130 'name' => 'language',
1131 'type' => CRM_Utils_Type
::T_STRING
,
1132 'title' => ts('Mailing Language'),
1133 'description' => ts('Language of the content of the mailing. Useful for tokens.'),
1135 'size' => CRM_Utils_Type
::SIX
,
1136 'where' => 'civicrm_mailing.language',
1137 'table_name' => 'civicrm_mailing',
1138 'entity' => 'Mailing',
1139 'bao' => 'CRM_Mailing_BAO_Mailing',
1144 'pseudoconstant' => [
1145 'optionGroupName' => 'languages',
1146 'keyColumn' => 'name',
1147 'optionEditPath' => 'civicrm/admin/options/languages',
1152 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1154 return Civi
::$statics[__CLASS__
]['fields'];
1158 * Return a mapping from field-name to the corresponding key (as used in fields()).
1161 * Array(string $name => string $uniqueName).
1163 public static function &fieldKeys() {
1164 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1165 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1167 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1171 * Returns the names of this table
1175 public static function getTableName() {
1176 return self
::$_tableName;
1180 * Returns if this table needs to be logged
1184 public function getLog() {
1189 * Returns the list of fields that can be imported
1191 * @param bool $prefix
1195 public static function &import($prefix = FALSE) {
1196 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing', $prefix, []);
1201 * Returns the list of fields that can be exported
1203 * @param bool $prefix
1207 public static function &export($prefix = FALSE) {
1208 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing', $prefix, []);
1213 * Returns the list of indices
1215 * @param bool $localize
1219 public static function indices($localize = TRUE) {
1222 'name' => 'index_hash',
1226 'localizable' => FALSE,
1227 'sig' => 'civicrm_mailing::0::hash',
1230 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;