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:cea36c1d0da157e6d5b42b505eb44a53)
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',
415 'name' => 'domain_id',
416 'type' => CRM_Utils_Type
::T_INT
,
417 'title' => ts('Domain ID'),
418 'description' => ts('Which site is this mailing for'),
419 'where' => 'civicrm_mailing.domain_id',
420 'table_name' => 'civicrm_mailing',
421 'entity' => 'Mailing',
422 'bao' => 'CRM_Mailing_BAO_Mailing',
424 'FKClassName' => 'CRM_Core_DAO_Domain',
426 'label' => ts("Domain"),
428 'pseudoconstant' => [
429 'table' => 'civicrm_domain',
431 'labelColumn' => 'name',
436 'name' => 'header_id',
437 'type' => CRM_Utils_Type
::T_INT
,
438 'title' => ts('Header ID'),
439 'description' => ts('FK to the header component.'),
440 'where' => 'civicrm_mailing.header_id',
441 'table_name' => 'civicrm_mailing',
442 'entity' => 'Mailing',
443 'bao' => 'CRM_Mailing_BAO_Mailing',
445 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
447 'label' => ts("Header"),
449 'pseudoconstant' => [
450 'table' => 'civicrm_mailing_component',
452 'labelColumn' => 'name',
453 'condition' => 'component_type = "Header"',
458 'name' => 'footer_id',
459 'type' => CRM_Utils_Type
::T_INT
,
460 'title' => ts('Footer ID'),
461 'description' => ts('FK to the footer component.'),
462 'where' => 'civicrm_mailing.footer_id',
463 'table_name' => 'civicrm_mailing',
464 'entity' => 'Mailing',
465 'bao' => 'CRM_Mailing_BAO_Mailing',
467 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
469 'label' => ts("Footer"),
471 'pseudoconstant' => [
472 'table' => 'civicrm_mailing_component',
474 'labelColumn' => 'name',
475 'condition' => 'component_type = "Footer"',
480 'name' => 'reply_id',
481 'type' => CRM_Utils_Type
::T_INT
,
482 'title' => ts('Reply ID'),
483 'description' => ts('FK to the auto-responder component.'),
484 'where' => 'civicrm_mailing.reply_id',
485 'table_name' => 'civicrm_mailing',
486 'entity' => 'Mailing',
487 'bao' => 'CRM_Mailing_BAO_Mailing',
489 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
491 'label' => ts("Reply"),
495 'unsubscribe_id' => [
496 'name' => 'unsubscribe_id',
497 'type' => CRM_Utils_Type
::T_INT
,
498 'title' => ts('Unsubscribe ID'),
499 'description' => ts('FK to the unsubscribe component.'),
500 'where' => 'civicrm_mailing.unsubscribe_id',
501 'table_name' => 'civicrm_mailing',
502 'entity' => 'Mailing',
503 'bao' => 'CRM_Mailing_BAO_Mailing',
505 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
507 'label' => ts("Unsubscribe"),
511 'resubscribe_id' => [
512 'name' => 'resubscribe_id',
513 'type' => CRM_Utils_Type
::T_INT
,
514 'title' => ts('Mailing Resubscribe'),
515 'where' => 'civicrm_mailing.resubscribe_id',
516 'table_name' => 'civicrm_mailing',
517 'entity' => 'Mailing',
518 'bao' => 'CRM_Mailing_BAO_Mailing',
523 'name' => 'optout_id',
524 'type' => CRM_Utils_Type
::T_INT
,
525 'title' => ts('Opt Out ID'),
526 'description' => ts('FK to the opt-out component.'),
527 'where' => 'civicrm_mailing.optout_id',
528 'table_name' => 'civicrm_mailing',
529 'entity' => 'Mailing',
530 'bao' => 'CRM_Mailing_BAO_Mailing',
532 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
534 'label' => ts("Opt Out"),
540 'type' => CRM_Utils_Type
::T_STRING
,
541 'title' => ts('Mailing Name'),
542 'description' => ts('Mailing Name.'),
544 'size' => CRM_Utils_Type
::HUGE
,
545 'where' => 'civicrm_mailing.name',
546 'table_name' => 'civicrm_mailing',
547 'entity' => 'Mailing',
548 'bao' => 'CRM_Mailing_BAO_Mailing',
556 'name' => 'mailing_type',
557 'type' => CRM_Utils_Type
::T_STRING
,
558 'title' => ts('Mailing Type'),
559 'description' => ts('differentiate between standalone mailings, A/B tests, and A/B final-winner'),
561 'size' => CRM_Utils_Type
::MEDIUM
,
562 'where' => 'civicrm_mailing.mailing_type',
563 'table_name' => 'civicrm_mailing',
564 'entity' => 'Mailing',
565 'bao' => 'CRM_Mailing_BAO_Mailing',
570 'pseudoconstant' => [
571 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
576 'name' => 'from_name',
577 'type' => CRM_Utils_Type
::T_STRING
,
578 'title' => ts('Mailing From Name'),
579 'description' => ts('From Header of mailing'),
581 'size' => CRM_Utils_Type
::HUGE
,
582 'where' => 'civicrm_mailing.from_name',
583 'table_name' => 'civicrm_mailing',
584 'entity' => 'Mailing',
585 'bao' => 'CRM_Mailing_BAO_Mailing',
593 'name' => 'from_email',
594 'type' => CRM_Utils_Type
::T_STRING
,
595 'title' => ts('Mailing From Email'),
596 'description' => ts('From Email of mailing'),
598 'size' => CRM_Utils_Type
::HUGE
,
599 'where' => 'civicrm_mailing.from_email',
600 'table_name' => 'civicrm_mailing',
601 'entity' => 'Mailing',
602 'bao' => 'CRM_Mailing_BAO_Mailing',
610 'name' => 'replyto_email',
611 'type' => CRM_Utils_Type
::T_STRING
,
612 'title' => ts('Replyto Email'),
613 'description' => ts('Reply-To Email of mailing'),
615 'size' => CRM_Utils_Type
::HUGE
,
616 'where' => 'civicrm_mailing.replyto_email',
617 'table_name' => 'civicrm_mailing',
618 'entity' => 'Mailing',
619 'bao' => 'CRM_Mailing_BAO_Mailing',
627 'name' => 'template_type',
628 'type' => CRM_Utils_Type
::T_STRING
,
629 'title' => ts('Template Type'),
630 'description' => ts('The language/processing system used for email templates.'),
633 'size' => CRM_Utils_Type
::BIG
,
634 'where' => 'civicrm_mailing.template_type',
635 'default' => 'traditional',
636 'table_name' => 'civicrm_mailing',
637 'entity' => 'Mailing',
638 'bao' => 'CRM_Mailing_BAO_Mailing',
640 'pseudoconstant' => [
641 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
645 'template_options' => [
646 'name' => 'template_options',
647 'type' => CRM_Utils_Type
::T_LONGTEXT
,
648 'title' => ts('Template Options (JSON)'),
649 'description' => ts('Advanced options used by the email templating system. (JSON encoded)'),
650 'where' => 'civicrm_mailing.template_options',
651 'table_name' => 'civicrm_mailing',
652 'entity' => 'Mailing',
653 'bao' => 'CRM_Mailing_BAO_Mailing',
659 'type' => CRM_Utils_Type
::T_STRING
,
660 'title' => ts('Subject'),
661 'description' => ts('Subject of mailing'),
663 'size' => CRM_Utils_Type
::HUGE
,
664 'where' => 'civicrm_mailing.subject',
665 'table_name' => 'civicrm_mailing',
666 'entity' => 'Mailing',
667 'bao' => 'CRM_Mailing_BAO_Mailing',
675 'name' => 'body_text',
676 'type' => CRM_Utils_Type
::T_LONGTEXT
,
677 'title' => ts('Body Text'),
678 'description' => ts('Body of the mailing in text format.'),
679 'where' => 'civicrm_mailing.body_text',
680 'table_name' => 'civicrm_mailing',
681 'entity' => 'Mailing',
682 'bao' => 'CRM_Mailing_BAO_Mailing',
687 'name' => 'body_html',
688 'type' => CRM_Utils_Type
::T_LONGTEXT
,
689 'title' => ts('Body Html'),
690 'description' => ts('Body of the mailing in html format.'),
691 'where' => 'civicrm_mailing.body_html',
692 'table_name' => 'civicrm_mailing',
693 'entity' => 'Mailing',
694 'bao' => 'CRM_Mailing_BAO_Mailing',
699 'name' => 'url_tracking',
700 'type' => CRM_Utils_Type
::T_BOOLEAN
,
701 'title' => ts('Url Tracking'),
702 'description' => ts('Should we track URL click-throughs for this mailing?'),
703 'where' => 'civicrm_mailing.url_tracking',
704 'table_name' => 'civicrm_mailing',
705 'entity' => 'Mailing',
706 'bao' => 'CRM_Mailing_BAO_Mailing',
709 'type' => 'CheckBox',
713 'forward_replies' => [
714 'name' => 'forward_replies',
715 'type' => CRM_Utils_Type
::T_BOOLEAN
,
716 'title' => ts('Forward Replies'),
717 'description' => ts('Should we forward replies back to the author?'),
718 'where' => 'civicrm_mailing.forward_replies',
719 'table_name' => 'civicrm_mailing',
720 'entity' => 'Mailing',
721 'bao' => 'CRM_Mailing_BAO_Mailing',
724 'type' => 'CheckBox',
728 'auto_responder' => [
729 'name' => 'auto_responder',
730 'type' => CRM_Utils_Type
::T_BOOLEAN
,
731 'title' => ts('Auto Responder'),
732 'description' => ts('Should we enable the auto-responder?'),
733 'where' => 'civicrm_mailing.auto_responder',
734 'table_name' => 'civicrm_mailing',
735 'entity' => 'Mailing',
736 'bao' => 'CRM_Mailing_BAO_Mailing',
739 'type' => 'CheckBox',
744 'name' => 'open_tracking',
745 'type' => CRM_Utils_Type
::T_BOOLEAN
,
746 'title' => ts('Track Mailing?'),
747 'description' => ts('Should we track when recipients open/read this mailing?'),
748 'where' => 'civicrm_mailing.open_tracking',
749 'table_name' => 'civicrm_mailing',
750 'entity' => 'Mailing',
751 'bao' => 'CRM_Mailing_BAO_Mailing',
756 'name' => 'is_completed',
757 'type' => CRM_Utils_Type
::T_BOOLEAN
,
758 'title' => ts('Mailing Completed'),
759 'description' => ts('Has at least one job associated with this mailing finished?'),
760 'where' => 'civicrm_mailing.is_completed',
761 'table_name' => 'civicrm_mailing',
762 'entity' => 'Mailing',
763 'bao' => 'CRM_Mailing_BAO_Mailing',
766 'type' => 'CheckBox',
770 'msg_template_id' => [
771 'name' => 'msg_template_id',
772 'type' => CRM_Utils_Type
::T_INT
,
773 'title' => ts('Message Template ID'),
774 'description' => ts('FK to the message template.'),
775 'where' => 'civicrm_mailing.msg_template_id',
776 'table_name' => 'civicrm_mailing',
777 'entity' => 'Mailing',
778 'bao' => 'CRM_Mailing_BAO_Mailing',
780 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
782 'label' => ts("Message Template"),
787 'name' => 'override_verp',
788 'type' => CRM_Utils_Type
::T_BOOLEAN
,
789 'title' => ts('Override Verp'),
790 'description' => ts('Overwrite the VERP address in Reply-To'),
791 'where' => 'civicrm_mailing.override_verp',
793 'table_name' => 'civicrm_mailing',
794 'entity' => 'Mailing',
795 'bao' => 'CRM_Mailing_BAO_Mailing',
798 'type' => 'CheckBox',
803 'name' => 'created_id',
804 'type' => CRM_Utils_Type
::T_INT
,
805 'title' => ts('Created By Contact ID'),
806 'description' => ts('FK to Contact ID who first created this mailing'),
807 'where' => 'civicrm_mailing.created_id',
808 'table_name' => 'civicrm_mailing',
809 'entity' => 'Mailing',
810 'bao' => 'CRM_Mailing_BAO_Mailing',
812 'FKClassName' => 'CRM_Contact_DAO_Contact',
814 'label' => ts("Creator"),
819 'name' => 'created_date',
820 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
821 'title' => ts('Mailing Created Date'),
822 'description' => ts('Date and time this mailing was created.'),
824 'where' => 'civicrm_mailing.created_date',
826 'table_name' => 'civicrm_mailing',
827 'entity' => 'Mailing',
828 'bao' => 'CRM_Mailing_BAO_Mailing',
831 'type' => 'Select Date',
832 'formatType' => 'activityDateTime',
836 'mailing_modified_date' => [
837 'name' => 'modified_date',
838 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
839 'title' => ts('Modified Date'),
840 'description' => ts('When the mailing (or closely related entity) was created or modified or deleted.'),
842 'where' => 'civicrm_mailing.modified_date',
844 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
845 'table_name' => 'civicrm_mailing',
846 'entity' => 'Mailing',
847 'bao' => 'CRM_Mailing_BAO_Mailing',
852 'name' => 'scheduled_id',
853 'type' => CRM_Utils_Type
::T_INT
,
854 'title' => ts('Scheduled By Contact ID'),
855 'description' => ts('FK to Contact ID who scheduled this mailing'),
856 'where' => 'civicrm_mailing.scheduled_id',
857 'table_name' => 'civicrm_mailing',
858 'entity' => 'Mailing',
859 'bao' => 'CRM_Mailing_BAO_Mailing',
861 'FKClassName' => 'CRM_Contact_DAO_Contact',
863 'label' => ts("Scheduled By"),
867 'scheduled_date' => [
868 'name' => 'scheduled_date',
869 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
870 'title' => ts('Mailing Scheduled Date'),
871 'description' => ts('Date and time this mailing was scheduled.'),
873 'where' => 'civicrm_mailing.scheduled_date',
875 'table_name' => 'civicrm_mailing',
876 'entity' => 'Mailing',
877 'bao' => 'CRM_Mailing_BAO_Mailing',
880 'type' => 'Select Date',
881 'formatType' => 'activityDateTime',
886 'name' => 'approver_id',
887 'type' => CRM_Utils_Type
::T_INT
,
888 'title' => ts('Approved By Contact ID'),
889 'description' => ts('FK to Contact ID who approved this mailing'),
890 'where' => 'civicrm_mailing.approver_id',
891 'table_name' => 'civicrm_mailing',
892 'entity' => 'Mailing',
893 'bao' => 'CRM_Mailing_BAO_Mailing',
895 'FKClassName' => 'CRM_Contact_DAO_Contact',
897 'label' => ts("Approved By"),
902 'name' => 'approval_date',
903 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
904 'title' => ts('Mailing Approved Date'),
905 'description' => ts('Date and time this mailing was approved.'),
907 'where' => 'civicrm_mailing.approval_date',
909 'table_name' => 'civicrm_mailing',
910 'entity' => 'Mailing',
911 'bao' => 'CRM_Mailing_BAO_Mailing',
914 'type' => 'Select Date',
915 'formatType' => 'activityDateTime',
919 'approval_status_id' => [
920 'name' => 'approval_status_id',
921 'type' => CRM_Utils_Type
::T_INT
,
922 'title' => ts('Approval Status'),
923 'description' => ts('The status of this mailing. Values: none, approved, rejected'),
924 'where' => 'civicrm_mailing.approval_status_id',
925 'table_name' => 'civicrm_mailing',
926 'entity' => 'Mailing',
927 'bao' => 'CRM_Mailing_BAO_Mailing',
932 'pseudoconstant' => [
933 'optionGroupName' => 'mail_approval_status',
934 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
939 'name' => 'approval_note',
940 'type' => CRM_Utils_Type
::T_LONGTEXT
,
941 'title' => ts('Approval Note'),
942 'description' => ts('Note behind the decision.'),
943 'where' => 'civicrm_mailing.approval_note',
944 'table_name' => 'civicrm_mailing',
945 'entity' => 'Mailing',
946 'bao' => 'CRM_Mailing_BAO_Mailing',
949 'type' => 'TextArea',
954 'name' => 'is_archived',
955 'type' => CRM_Utils_Type
::T_BOOLEAN
,
956 'title' => ts('Is Mailing Archived?'),
957 'description' => ts('Is this mailing archived?'),
958 'where' => 'civicrm_mailing.is_archived',
960 'table_name' => 'civicrm_mailing',
961 'entity' => 'Mailing',
962 'bao' => 'CRM_Mailing_BAO_Mailing',
965 'type' => 'CheckBox',
970 'name' => 'visibility',
971 'type' => CRM_Utils_Type
::T_STRING
,
972 'title' => ts('Mailing Visibility'),
973 'description' => ts('In what context(s) is the mailing contents visible (online viewing)'),
975 'size' => CRM_Utils_Type
::BIG
,
976 'where' => 'civicrm_mailing.visibility',
977 'default' => 'Public Pages',
978 'table_name' => 'civicrm_mailing',
979 'entity' => 'Mailing',
980 'bao' => 'CRM_Mailing_BAO_Mailing',
985 'pseudoconstant' => [
986 'callback' => 'CRM_Core_SelectValues::groupVisibility',
991 'name' => 'campaign_id',
992 'type' => CRM_Utils_Type
::T_INT
,
993 'title' => ts('Campaign ID'),
994 'description' => ts('The campaign for which this mailing has been initiated.'),
995 'where' => 'civicrm_mailing.campaign_id',
996 'table_name' => 'civicrm_mailing',
997 'entity' => 'Mailing',
998 'bao' => 'CRM_Mailing_BAO_Mailing',
1000 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
1003 'label' => ts("Campaign"),
1008 'name' => 'dedupe_email',
1009 'type' => CRM_Utils_Type
::T_BOOLEAN
,
1010 'title' => ts('No Duplicate emails?'),
1011 'description' => ts('Remove duplicate emails?'),
1012 'where' => 'civicrm_mailing.dedupe_email',
1014 'table_name' => 'civicrm_mailing',
1015 'entity' => 'Mailing',
1016 'bao' => 'CRM_Mailing_BAO_Mailing',
1019 'type' => 'CheckBox',
1023 'sms_provider_id' => [
1024 'name' => 'sms_provider_id',
1025 'type' => CRM_Utils_Type
::T_INT
,
1026 'title' => ts('SMS Provider ID'),
1027 'where' => 'civicrm_mailing.sms_provider_id',
1028 'table_name' => 'civicrm_mailing',
1029 'entity' => 'Mailing',
1030 'bao' => 'CRM_Mailing_BAO_Mailing',
1032 'FKClassName' => 'CRM_SMS_DAO_Provider',
1035 'label' => ts("SMS Provider"),
1041 'type' => CRM_Utils_Type
::T_STRING
,
1042 'title' => ts('Mailing Hash'),
1043 'description' => ts('Key for validating requests related to this mailing.'),
1045 'size' => CRM_Utils_Type
::TWELVE
,
1046 'where' => 'civicrm_mailing.hash',
1047 'table_name' => 'civicrm_mailing',
1048 'entity' => 'Mailing',
1049 'bao' => 'CRM_Mailing_BAO_Mailing',
1053 'location_type_id' => [
1054 'name' => 'location_type_id',
1055 'type' => CRM_Utils_Type
::T_INT
,
1056 'title' => ts('Location Type ID'),
1057 'description' => ts('With email_selection_method, determines which email address to use'),
1058 'where' => 'civicrm_mailing.location_type_id',
1059 'table_name' => 'civicrm_mailing',
1060 'entity' => 'Mailing',
1061 'bao' => 'CRM_Mailing_BAO_Mailing',
1063 'FKClassName' => 'CRM_Core_DAO_LocationType',
1065 'label' => ts("Location Type"),
1067 'pseudoconstant' => [
1068 'table' => 'civicrm_location_type',
1069 'keyColumn' => 'id',
1070 'labelColumn' => 'display_name',
1074 'email_selection_method' => [
1075 'name' => 'email_selection_method',
1076 'type' => CRM_Utils_Type
::T_STRING
,
1077 'title' => ts('Email Selection Method'),
1078 'description' => ts('With location_type_id, determine how to choose the email address to use.'),
1080 'size' => CRM_Utils_Type
::MEDIUM
,
1081 'where' => 'civicrm_mailing.email_selection_method',
1082 'default' => 'automatic',
1083 'table_name' => 'civicrm_mailing',
1084 'entity' => 'Mailing',
1085 'bao' => 'CRM_Mailing_BAO_Mailing',
1087 'pseudoconstant' => [
1088 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
1093 'name' => 'language',
1094 'type' => CRM_Utils_Type
::T_STRING
,
1095 'title' => ts('Mailing Language'),
1096 'description' => ts('Language of the content of the mailing. Useful for tokens.'),
1098 'size' => CRM_Utils_Type
::SIX
,
1099 'where' => 'civicrm_mailing.language',
1100 'table_name' => 'civicrm_mailing',
1101 'entity' => 'Mailing',
1102 'bao' => 'CRM_Mailing_BAO_Mailing',
1107 'pseudoconstant' => [
1108 'optionGroupName' => 'languages',
1109 'keyColumn' => 'name',
1110 'optionEditPath' => 'civicrm/admin/options/languages',
1115 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1117 return Civi
::$statics[__CLASS__
]['fields'];
1121 * Return a mapping from field-name to the corresponding key (as used in fields()).
1124 * Array(string $name => string $uniqueName).
1126 public static function &fieldKeys() {
1127 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1128 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1130 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1134 * Returns the names of this table
1138 public static function getTableName() {
1139 return self
::$_tableName;
1143 * Returns if this table needs to be logged
1147 public function getLog() {
1152 * Returns the list of fields that can be imported
1154 * @param bool $prefix
1158 public static function &import($prefix = FALSE) {
1159 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing', $prefix, []);
1164 * Returns the list of fields that can be exported
1166 * @param bool $prefix
1170 public static function &export($prefix = FALSE) {
1171 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing', $prefix, []);
1176 * Returns the list of indices
1178 * @param bool $localize
1182 public static function indices($localize = TRUE) {
1185 'name' => 'index_hash',
1189 'localizable' => FALSE,
1190 'sig' => 'civicrm_mailing::0::hash',
1193 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;