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:f1ac9d0a02ed59171d4efdc4209a376c)
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
= '';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_mailing';
27 * Icon associated with this entity.
31 public static $_icon = 'fa-envelope-o';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = FALSE;
41 * Paths for accessing this entity in the UI.
45 protected static $_paths = [
46 'add' => 'civicrm/a/#/mailing/new',
47 'update' => 'civicrm/a/#/mailing/[id]',
56 * Which site is this mailing for
63 * FK to the header component.
70 * FK to the footer component.
77 * FK to the auto-responder component.
84 * FK to the unsubscribe component.
88 public $unsubscribe_id;
93 public $resubscribe_id;
96 * FK to the opt-out component.
110 * differentiate between standalone mailings, A/B tests, and A/B final-winner
114 public $mailing_type;
117 * From Header of mailing
124 * From Email of mailing
131 * Reply-To Email of mailing
135 public $replyto_email;
138 * The language/processing system used for email templates.
142 public $template_type;
145 * Advanced options used by the email templating system. (JSON encoded)
149 public $template_options;
159 * Body of the mailing in text format.
166 * Body of the mailing in html format.
173 * Should we track URL click-throughs for this mailing?
177 public $url_tracking;
180 * Should we forward replies back to the author?
184 public $forward_replies;
187 * Should we enable the auto-responder?
191 public $auto_responder;
194 * Should we track when recipients open/read this mailing?
198 public $open_tracking;
201 * Has at least one job associated with this mailing finished?
205 public $is_completed;
208 * FK to the message template.
212 public $msg_template_id;
215 * Overwrite the VERP address in Reply-To
219 public $override_verp;
222 * FK to Contact ID who first created this mailing
229 * Date and time this mailing was created.
233 public $created_date;
236 * When the mailing (or closely related entity) was created or modified or deleted.
240 public $modified_date;
243 * FK to Contact ID who scheduled this mailing
247 public $scheduled_id;
250 * Date and time this mailing was scheduled.
254 public $scheduled_date;
257 * FK to Contact ID who approved this mailing
264 * Date and time this mailing was approved.
268 public $approval_date;
271 * The status of this mailing. Values: none, approved, rejected
275 public $approval_status_id;
278 * Note behind the decision.
282 public $approval_note;
285 * Is this mailing archived?
292 * In what context(s) is the mailing contents visible (online viewing)
299 * The campaign for which this mailing has been initiated.
306 * Remove duplicate emails?
310 public $dedupe_email;
315 public $sms_provider_id;
318 * Key for validating requests related to this mailing.
325 * With email_selection_method, determines which email address to use
329 public $location_type_id;
332 * With location_type_id, determine how to choose the email address to use.
336 public $email_selection_method;
339 * Language of the content of the mailing. Useful for tokens.
348 public function __construct() {
349 $this->__table
= 'civicrm_mailing';
350 parent
::__construct();
354 * Returns localized title of this entity.
356 * @param bool $plural
357 * Whether to return the plural version of the title.
359 public static function getEntityTitle($plural = FALSE) {
360 return $plural ?
ts('Mailings') : ts('Mailing');
364 * Returns foreign keys and entity references.
367 * [CRM_Core_Reference_Interface]
369 public static function getReferenceColumns() {
370 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
371 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
372 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
373 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'header_id', 'civicrm_mailing_component', 'id');
374 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'footer_id', 'civicrm_mailing_component', 'id');
375 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'reply_id', 'civicrm_mailing_component', 'id');
376 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'unsubscribe_id', 'civicrm_mailing_component', 'id');
377 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'optout_id', 'civicrm_mailing_component', 'id');
378 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'msg_template_id', 'civicrm_msg_template', 'id');
379 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
380 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'scheduled_id', 'civicrm_contact', 'id');
381 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'approver_id', 'civicrm_contact', 'id');
382 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
383 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'sms_provider_id', 'civicrm_sms_provider', 'id');
384 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
385 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
387 return Civi
::$statics[__CLASS__
]['links'];
391 * Returns all the column names of this table
395 public static function &fields() {
396 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
397 Civi
::$statics[__CLASS__
]['fields'] = [
400 'type' => CRM_Utils_Type
::T_INT
,
401 'title' => ts('Mailing ID'),
403 'where' => 'civicrm_mailing.id',
404 'table_name' => 'civicrm_mailing',
405 'entity' => 'Mailing',
406 'bao' => 'CRM_Mailing_BAO_Mailing',
411 'name' => 'domain_id',
412 'type' => CRM_Utils_Type
::T_INT
,
413 'title' => ts('Mailing Domain'),
414 'description' => ts('Which site is this mailing for'),
415 'where' => 'civicrm_mailing.domain_id',
416 'table_name' => 'civicrm_mailing',
417 'entity' => 'Mailing',
418 'bao' => 'CRM_Mailing_BAO_Mailing',
420 'FKClassName' => 'CRM_Core_DAO_Domain',
421 'pseudoconstant' => [
422 'table' => 'civicrm_domain',
424 'labelColumn' => 'name',
429 'name' => 'header_id',
430 'type' => CRM_Utils_Type
::T_INT
,
431 'title' => ts('Mailing Header'),
432 'description' => ts('FK to the header component.'),
433 'where' => 'civicrm_mailing.header_id',
434 'table_name' => 'civicrm_mailing',
435 'entity' => 'Mailing',
436 'bao' => 'CRM_Mailing_BAO_Mailing',
438 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
439 'pseudoconstant' => [
440 'table' => 'civicrm_mailing_component',
442 'labelColumn' => 'name',
443 'condition' => 'component_type = "Header"',
448 'name' => 'footer_id',
449 'type' => CRM_Utils_Type
::T_INT
,
450 'title' => ts('Mailing Footer'),
451 'description' => ts('FK to the footer component.'),
452 'where' => 'civicrm_mailing.footer_id',
453 'table_name' => 'civicrm_mailing',
454 'entity' => 'Mailing',
455 'bao' => 'CRM_Mailing_BAO_Mailing',
457 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
458 'pseudoconstant' => [
459 'table' => 'civicrm_mailing_component',
461 'labelColumn' => 'name',
462 'condition' => 'component_type = "Footer"',
467 'name' => 'reply_id',
468 'type' => CRM_Utils_Type
::T_INT
,
469 'title' => ts('Mailing Reply'),
470 'description' => ts('FK to the auto-responder component.'),
471 'where' => 'civicrm_mailing.reply_id',
472 'table_name' => 'civicrm_mailing',
473 'entity' => 'Mailing',
474 'bao' => 'CRM_Mailing_BAO_Mailing',
476 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
479 'unsubscribe_id' => [
480 'name' => 'unsubscribe_id',
481 'type' => CRM_Utils_Type
::T_INT
,
482 'title' => ts('Mailing Unsubscribe'),
483 'description' => ts('FK to the unsubscribe component.'),
484 'where' => 'civicrm_mailing.unsubscribe_id',
485 'table_name' => 'civicrm_mailing',
486 'entity' => 'Mailing',
487 'bao' => 'CRM_Mailing_BAO_Mailing',
489 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
492 'resubscribe_id' => [
493 'name' => 'resubscribe_id',
494 'type' => CRM_Utils_Type
::T_INT
,
495 'title' => ts('Mailing Resubscribe'),
496 'where' => 'civicrm_mailing.resubscribe_id',
497 'table_name' => 'civicrm_mailing',
498 'entity' => 'Mailing',
499 'bao' => 'CRM_Mailing_BAO_Mailing',
504 'name' => 'optout_id',
505 'type' => CRM_Utils_Type
::T_INT
,
506 'title' => ts('Mailing Opt Out'),
507 'description' => ts('FK to the opt-out component.'),
508 'where' => 'civicrm_mailing.optout_id',
509 'table_name' => 'civicrm_mailing',
510 'entity' => 'Mailing',
511 'bao' => 'CRM_Mailing_BAO_Mailing',
513 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
518 'type' => CRM_Utils_Type
::T_STRING
,
519 'title' => ts('Mailing Name'),
520 'description' => ts('Mailing Name.'),
522 'size' => CRM_Utils_Type
::HUGE
,
523 'where' => 'civicrm_mailing.name',
524 'table_name' => 'civicrm_mailing',
525 'entity' => 'Mailing',
526 'bao' => 'CRM_Mailing_BAO_Mailing',
534 'name' => 'mailing_type',
535 'type' => CRM_Utils_Type
::T_STRING
,
536 'title' => ts('Mailing Type'),
537 'description' => ts('differentiate between standalone mailings, A/B tests, and A/B final-winner'),
539 'size' => CRM_Utils_Type
::MEDIUM
,
540 'where' => 'civicrm_mailing.mailing_type',
541 'table_name' => 'civicrm_mailing',
542 'entity' => 'Mailing',
543 'bao' => 'CRM_Mailing_BAO_Mailing',
548 'pseudoconstant' => [
549 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
554 'name' => 'from_name',
555 'type' => CRM_Utils_Type
::T_STRING
,
556 'title' => ts('Mailing From Name'),
557 'description' => ts('From Header of mailing'),
559 'size' => CRM_Utils_Type
::HUGE
,
560 'where' => 'civicrm_mailing.from_name',
561 'table_name' => 'civicrm_mailing',
562 'entity' => 'Mailing',
563 'bao' => 'CRM_Mailing_BAO_Mailing',
571 'name' => 'from_email',
572 'type' => CRM_Utils_Type
::T_STRING
,
573 'title' => ts('Mailing From Email'),
574 'description' => ts('From Email of mailing'),
576 'size' => CRM_Utils_Type
::HUGE
,
577 'where' => 'civicrm_mailing.from_email',
578 'table_name' => 'civicrm_mailing',
579 'entity' => 'Mailing',
580 'bao' => 'CRM_Mailing_BAO_Mailing',
588 'name' => 'replyto_email',
589 'type' => CRM_Utils_Type
::T_STRING
,
590 'title' => ts('Replyto Email'),
591 'description' => ts('Reply-To Email of mailing'),
593 'size' => CRM_Utils_Type
::HUGE
,
594 'where' => 'civicrm_mailing.replyto_email',
595 'table_name' => 'civicrm_mailing',
596 'entity' => 'Mailing',
597 'bao' => 'CRM_Mailing_BAO_Mailing',
605 'name' => 'template_type',
606 'type' => CRM_Utils_Type
::T_STRING
,
607 'title' => ts('Template Type'),
608 'description' => ts('The language/processing system used for email templates.'),
611 'size' => CRM_Utils_Type
::BIG
,
612 'where' => 'civicrm_mailing.template_type',
613 'default' => 'traditional',
614 'table_name' => 'civicrm_mailing',
615 'entity' => 'Mailing',
616 'bao' => 'CRM_Mailing_BAO_Mailing',
618 'pseudoconstant' => [
619 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
623 'template_options' => [
624 'name' => 'template_options',
625 'type' => CRM_Utils_Type
::T_LONGTEXT
,
626 'title' => ts('Template Options (JSON)'),
627 'description' => ts('Advanced options used by the email templating system. (JSON encoded)'),
628 'where' => 'civicrm_mailing.template_options',
629 'table_name' => 'civicrm_mailing',
630 'entity' => 'Mailing',
631 'bao' => 'CRM_Mailing_BAO_Mailing',
637 'type' => CRM_Utils_Type
::T_STRING
,
638 'title' => ts('Subject'),
639 'description' => ts('Subject of mailing'),
641 'size' => CRM_Utils_Type
::HUGE
,
642 'where' => 'civicrm_mailing.subject',
643 'table_name' => 'civicrm_mailing',
644 'entity' => 'Mailing',
645 'bao' => 'CRM_Mailing_BAO_Mailing',
653 'name' => 'body_text',
654 'type' => CRM_Utils_Type
::T_LONGTEXT
,
655 'title' => ts('Body Text'),
656 'description' => ts('Body of the mailing in text format.'),
657 'where' => 'civicrm_mailing.body_text',
658 'table_name' => 'civicrm_mailing',
659 'entity' => 'Mailing',
660 'bao' => 'CRM_Mailing_BAO_Mailing',
665 'name' => 'body_html',
666 'type' => CRM_Utils_Type
::T_LONGTEXT
,
667 'title' => ts('Body Html'),
668 'description' => ts('Body of the mailing in html format.'),
669 'where' => 'civicrm_mailing.body_html',
670 'table_name' => 'civicrm_mailing',
671 'entity' => 'Mailing',
672 'bao' => 'CRM_Mailing_BAO_Mailing',
677 'name' => 'url_tracking',
678 'type' => CRM_Utils_Type
::T_BOOLEAN
,
679 'title' => ts('Url Tracking'),
680 'description' => ts('Should we track URL click-throughs for this mailing?'),
681 'where' => 'civicrm_mailing.url_tracking',
682 'table_name' => 'civicrm_mailing',
683 'entity' => 'Mailing',
684 'bao' => 'CRM_Mailing_BAO_Mailing',
687 'type' => 'CheckBox',
691 'forward_replies' => [
692 'name' => 'forward_replies',
693 'type' => CRM_Utils_Type
::T_BOOLEAN
,
694 'title' => ts('Forward Replies'),
695 'description' => ts('Should we forward replies back to the author?'),
696 'where' => 'civicrm_mailing.forward_replies',
697 'table_name' => 'civicrm_mailing',
698 'entity' => 'Mailing',
699 'bao' => 'CRM_Mailing_BAO_Mailing',
702 'type' => 'CheckBox',
706 'auto_responder' => [
707 'name' => 'auto_responder',
708 'type' => CRM_Utils_Type
::T_BOOLEAN
,
709 'title' => ts('Auto Responder'),
710 'description' => ts('Should we enable the auto-responder?'),
711 'where' => 'civicrm_mailing.auto_responder',
712 'table_name' => 'civicrm_mailing',
713 'entity' => 'Mailing',
714 'bao' => 'CRM_Mailing_BAO_Mailing',
717 'type' => 'CheckBox',
722 'name' => 'open_tracking',
723 'type' => CRM_Utils_Type
::T_BOOLEAN
,
724 'title' => ts('Track Mailing?'),
725 'description' => ts('Should we track when recipients open/read this mailing?'),
726 'where' => 'civicrm_mailing.open_tracking',
727 'table_name' => 'civicrm_mailing',
728 'entity' => 'Mailing',
729 'bao' => 'CRM_Mailing_BAO_Mailing',
734 'name' => 'is_completed',
735 'type' => CRM_Utils_Type
::T_BOOLEAN
,
736 'title' => ts('Mailing Completed'),
737 'description' => ts('Has at least one job associated with this mailing finished?'),
738 'where' => 'civicrm_mailing.is_completed',
739 'table_name' => 'civicrm_mailing',
740 'entity' => 'Mailing',
741 'bao' => 'CRM_Mailing_BAO_Mailing',
744 'type' => 'CheckBox',
748 'msg_template_id' => [
749 'name' => 'msg_template_id',
750 'type' => CRM_Utils_Type
::T_INT
,
751 'title' => ts('Mailing Message Template'),
752 'description' => ts('FK to the message template.'),
753 'where' => 'civicrm_mailing.msg_template_id',
754 'table_name' => 'civicrm_mailing',
755 'entity' => 'Mailing',
756 'bao' => 'CRM_Mailing_BAO_Mailing',
758 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
762 'name' => 'override_verp',
763 'type' => CRM_Utils_Type
::T_BOOLEAN
,
764 'title' => ts('Override Verp'),
765 'description' => ts('Overwrite the VERP address in Reply-To'),
766 'where' => 'civicrm_mailing.override_verp',
768 'table_name' => 'civicrm_mailing',
769 'entity' => 'Mailing',
770 'bao' => 'CRM_Mailing_BAO_Mailing',
773 'type' => 'CheckBox',
778 'name' => 'created_id',
779 'type' => CRM_Utils_Type
::T_INT
,
780 'title' => ts('Mailing Creator'),
781 'description' => ts('FK to Contact ID who first created this mailing'),
782 'where' => 'civicrm_mailing.created_id',
783 'table_name' => 'civicrm_mailing',
784 'entity' => 'Mailing',
785 'bao' => 'CRM_Mailing_BAO_Mailing',
787 'FKClassName' => 'CRM_Contact_DAO_Contact',
791 'name' => 'created_date',
792 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
793 'title' => ts('Mailing Created Date'),
794 'description' => ts('Date and time this mailing was created.'),
796 'where' => 'civicrm_mailing.created_date',
798 'table_name' => 'civicrm_mailing',
799 'entity' => 'Mailing',
800 'bao' => 'CRM_Mailing_BAO_Mailing',
803 'type' => 'Select Date',
804 'formatType' => 'activityDateTime',
808 'mailing_modified_date' => [
809 'name' => 'modified_date',
810 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
811 'title' => ts('Modified Date'),
812 'description' => ts('When the mailing (or closely related entity) was created or modified or deleted.'),
814 'where' => 'civicrm_mailing.modified_date',
816 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
817 'table_name' => 'civicrm_mailing',
818 'entity' => 'Mailing',
819 'bao' => 'CRM_Mailing_BAO_Mailing',
824 'name' => 'scheduled_id',
825 'type' => CRM_Utils_Type
::T_INT
,
826 'title' => ts('Scheduled By'),
827 'description' => ts('FK to Contact ID who scheduled this mailing'),
828 'where' => 'civicrm_mailing.scheduled_id',
829 'table_name' => 'civicrm_mailing',
830 'entity' => 'Mailing',
831 'bao' => 'CRM_Mailing_BAO_Mailing',
833 'FKClassName' => 'CRM_Contact_DAO_Contact',
836 'scheduled_date' => [
837 'name' => 'scheduled_date',
838 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
839 'title' => ts('Mailing Scheduled Date'),
840 'description' => ts('Date and time this mailing was scheduled.'),
842 'where' => 'civicrm_mailing.scheduled_date',
844 'table_name' => 'civicrm_mailing',
845 'entity' => 'Mailing',
846 'bao' => 'CRM_Mailing_BAO_Mailing',
849 'type' => 'Select Date',
850 'formatType' => 'activityDateTime',
855 'name' => 'approver_id',
856 'type' => CRM_Utils_Type
::T_INT
,
857 'title' => ts('Approved By'),
858 'description' => ts('FK to Contact ID who approved this mailing'),
859 'where' => 'civicrm_mailing.approver_id',
860 'table_name' => 'civicrm_mailing',
861 'entity' => 'Mailing',
862 'bao' => 'CRM_Mailing_BAO_Mailing',
864 'FKClassName' => 'CRM_Contact_DAO_Contact',
868 'name' => 'approval_date',
869 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
870 'title' => ts('Mailing Approved Date'),
871 'description' => ts('Date and time this mailing was approved.'),
873 'where' => 'civicrm_mailing.approval_date',
875 'table_name' => 'civicrm_mailing',
876 'entity' => 'Mailing',
877 'bao' => 'CRM_Mailing_BAO_Mailing',
880 'type' => 'Select Date',
881 'formatType' => 'activityDateTime',
885 'approval_status_id' => [
886 'name' => 'approval_status_id',
887 'type' => CRM_Utils_Type
::T_INT
,
888 'title' => ts('Approval Status'),
889 'description' => ts('The status of this mailing. Values: none, approved, rejected'),
890 'where' => 'civicrm_mailing.approval_status_id',
891 'table_name' => 'civicrm_mailing',
892 'entity' => 'Mailing',
893 'bao' => 'CRM_Mailing_BAO_Mailing',
898 'pseudoconstant' => [
899 'optionGroupName' => 'mail_approval_status',
900 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
905 'name' => 'approval_note',
906 'type' => CRM_Utils_Type
::T_LONGTEXT
,
907 'title' => ts('Approval Note'),
908 'description' => ts('Note behind the decision.'),
909 'where' => 'civicrm_mailing.approval_note',
910 'table_name' => 'civicrm_mailing',
911 'entity' => 'Mailing',
912 'bao' => 'CRM_Mailing_BAO_Mailing',
915 'type' => 'TextArea',
920 'name' => 'is_archived',
921 'type' => CRM_Utils_Type
::T_BOOLEAN
,
922 'title' => ts('Is Mailing Archived?'),
923 'description' => ts('Is this mailing archived?'),
924 'where' => 'civicrm_mailing.is_archived',
926 'table_name' => 'civicrm_mailing',
927 'entity' => 'Mailing',
928 'bao' => 'CRM_Mailing_BAO_Mailing',
931 'type' => 'CheckBox',
936 'name' => 'visibility',
937 'type' => CRM_Utils_Type
::T_STRING
,
938 'title' => ts('Mailing Visibility'),
939 'description' => ts('In what context(s) is the mailing contents visible (online viewing)'),
941 'size' => CRM_Utils_Type
::BIG
,
942 'where' => 'civicrm_mailing.visibility',
943 'default' => 'Public Pages',
944 'table_name' => 'civicrm_mailing',
945 'entity' => 'Mailing',
946 'bao' => 'CRM_Mailing_BAO_Mailing',
951 'pseudoconstant' => [
952 'callback' => 'CRM_Core_SelectValues::groupVisibility',
957 'name' => 'campaign_id',
958 'type' => CRM_Utils_Type
::T_INT
,
959 'title' => ts('Mailing Campaign'),
960 'description' => ts('The campaign for which this mailing has been initiated.'),
961 'where' => 'civicrm_mailing.campaign_id',
962 'table_name' => 'civicrm_mailing',
963 'entity' => 'Mailing',
964 'bao' => 'CRM_Mailing_BAO_Mailing',
966 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
970 'pseudoconstant' => [
971 'table' => 'civicrm_campaign',
973 'labelColumn' => 'title',
978 'name' => 'dedupe_email',
979 'type' => CRM_Utils_Type
::T_BOOLEAN
,
980 'title' => ts('No Duplicate emails?'),
981 'description' => ts('Remove duplicate emails?'),
982 'where' => 'civicrm_mailing.dedupe_email',
984 'table_name' => 'civicrm_mailing',
985 'entity' => 'Mailing',
986 'bao' => 'CRM_Mailing_BAO_Mailing',
989 'type' => 'CheckBox',
993 'sms_provider_id' => [
994 'name' => 'sms_provider_id',
995 'type' => CRM_Utils_Type
::T_INT
,
996 'title' => ts('Mailing SMS Provider'),
997 'where' => 'civicrm_mailing.sms_provider_id',
998 'table_name' => 'civicrm_mailing',
999 'entity' => 'Mailing',
1000 'bao' => 'CRM_Mailing_BAO_Mailing',
1002 'FKClassName' => 'CRM_SMS_DAO_Provider',
1010 'type' => CRM_Utils_Type
::T_STRING
,
1011 'title' => ts('Mailing Hash'),
1012 'description' => ts('Key for validating requests related to this mailing.'),
1014 'size' => CRM_Utils_Type
::TWELVE
,
1015 'where' => 'civicrm_mailing.hash',
1016 'table_name' => 'civicrm_mailing',
1017 'entity' => 'Mailing',
1018 'bao' => 'CRM_Mailing_BAO_Mailing',
1022 'location_type_id' => [
1023 'name' => 'location_type_id',
1024 'type' => CRM_Utils_Type
::T_INT
,
1025 'title' => ts('Location Type'),
1026 'description' => ts('With email_selection_method, determines which email address to use'),
1027 'where' => 'civicrm_mailing.location_type_id',
1028 'table_name' => 'civicrm_mailing',
1029 'entity' => 'Mailing',
1030 'bao' => 'CRM_Mailing_BAO_Mailing',
1032 'FKClassName' => 'CRM_Core_DAO_LocationType',
1033 'pseudoconstant' => [
1034 'table' => 'civicrm_location_type',
1035 'keyColumn' => 'id',
1036 'labelColumn' => 'display_name',
1040 'email_selection_method' => [
1041 'name' => 'email_selection_method',
1042 'type' => CRM_Utils_Type
::T_STRING
,
1043 'title' => ts('Email Selection Method'),
1044 'description' => ts('With location_type_id, determine how to choose the email address to use.'),
1046 'size' => CRM_Utils_Type
::MEDIUM
,
1047 'where' => 'civicrm_mailing.email_selection_method',
1048 'default' => 'automatic',
1049 'table_name' => 'civicrm_mailing',
1050 'entity' => 'Mailing',
1051 'bao' => 'CRM_Mailing_BAO_Mailing',
1053 'pseudoconstant' => [
1054 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
1059 'name' => 'language',
1060 'type' => CRM_Utils_Type
::T_STRING
,
1061 'title' => ts('Mailing Language'),
1062 'description' => ts('Language of the content of the mailing. Useful for tokens.'),
1064 'size' => CRM_Utils_Type
::SIX
,
1065 'where' => 'civicrm_mailing.language',
1066 'table_name' => 'civicrm_mailing',
1067 'entity' => 'Mailing',
1068 'bao' => 'CRM_Mailing_BAO_Mailing',
1073 'pseudoconstant' => [
1074 'optionGroupName' => 'languages',
1075 'keyColumn' => 'name',
1076 'optionEditPath' => 'civicrm/admin/options/languages',
1081 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1083 return Civi
::$statics[__CLASS__
]['fields'];
1087 * Return a mapping from field-name to the corresponding key (as used in fields()).
1090 * Array(string $name => string $uniqueName).
1092 public static function &fieldKeys() {
1093 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1094 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1096 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1100 * Returns the names of this table
1104 public static function getTableName() {
1105 return self
::$_tableName;
1109 * Returns if this table needs to be logged
1113 public function getLog() {
1118 * Returns the list of fields that can be imported
1120 * @param bool $prefix
1124 public static function &import($prefix = FALSE) {
1125 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing', $prefix, []);
1130 * Returns the list of fields that can be exported
1132 * @param bool $prefix
1136 public static function &export($prefix = FALSE) {
1137 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing', $prefix, []);
1142 * Returns the list of indices
1144 * @param bool $localize
1148 public static function indices($localize = TRUE) {
1151 'name' => 'index_hash',
1155 'localizable' => FALSE,
1156 'sig' => 'civicrm_mailing::0::hash',
1159 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;