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:5e3229fc70fd87ddb448fcc672e44c3d)
13 * Database access object for the Mailing entity.
15 class CRM_Mailing_DAO_Mailing
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_mailing';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
37 * Which site is this mailing for
44 * FK to the header component.
51 * FK to the footer component.
58 * FK to the auto-responder component.
65 * FK to the unsubscribe component.
69 public $unsubscribe_id;
74 public $resubscribe_id;
77 * FK to the opt-out component.
91 * differentiate between standalone mailings, A/B tests, and A/B final-winner
98 * From Header of mailing
105 * From Email of mailing
112 * Reply-To Email of mailing
116 public $replyto_email;
119 * The language/processing system used for email templates.
123 public $template_type;
126 * Advanced options used by the email templating system. (JSON encoded)
130 public $template_options;
140 * Body of the mailing in text format.
147 * Body of the mailing in html format.
154 * Should we track URL click-throughs for this mailing?
158 public $url_tracking;
161 * Should we forward replies back to the author?
165 public $forward_replies;
168 * Should we enable the auto-responder?
172 public $auto_responder;
175 * Should we track when recipients open/read this mailing?
179 public $open_tracking;
182 * Has at least one job associated with this mailing finished?
186 public $is_completed;
189 * FK to the message template.
193 public $msg_template_id;
196 * Overwrite the VERP address in Reply-To
200 public $override_verp;
203 * FK to Contact ID who first created this mailing
210 * Date and time this mailing was created.
214 public $created_date;
217 * When the mailing (or closely related entity) was created or modified or deleted.
221 public $modified_date;
224 * FK to Contact ID who scheduled this mailing
228 public $scheduled_id;
231 * Date and time this mailing was scheduled.
235 public $scheduled_date;
238 * FK to Contact ID who approved this mailing
245 * Date and time this mailing was approved.
249 public $approval_date;
252 * The status of this mailing. Values: none, approved, rejected
256 public $approval_status_id;
259 * Note behind the decision.
263 public $approval_note;
266 * Is this mailing archived?
273 * In what context(s) is the mailing contents visible (online viewing)
280 * The campaign for which this mailing has been initiated.
287 * Remove duplicate emails?
291 public $dedupe_email;
296 public $sms_provider_id;
299 * Key for validating requests related to this mailing.
306 * With email_selection_method, determines which email address to use
310 public $location_type_id;
313 * With location_type_id, determine how to choose the email address to use.
317 public $email_selection_method;
320 * Language of the content of the mailing. Useful for tokens.
329 public function __construct() {
330 $this->__table
= 'civicrm_mailing';
331 parent
::__construct();
335 * Returns foreign keys and entity references.
338 * [CRM_Core_Reference_Interface]
340 public static function getReferenceColumns() {
341 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
342 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
343 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
344 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'header_id', 'civicrm_mailing_component', 'id');
345 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'footer_id', 'civicrm_mailing_component', 'id');
346 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'reply_id', 'civicrm_mailing_component', 'id');
347 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'unsubscribe_id', 'civicrm_mailing_component', 'id');
348 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'optout_id', 'civicrm_mailing_component', 'id');
349 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'msg_template_id', 'civicrm_msg_template', 'id');
350 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
351 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'scheduled_id', 'civicrm_contact', 'id');
352 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'approver_id', 'civicrm_contact', 'id');
353 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
354 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'sms_provider_id', 'civicrm_sms_provider', 'id');
355 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
356 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
358 return Civi
::$statics[__CLASS__
]['links'];
362 * Returns all the column names of this table
366 public static function &fields() {
367 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
368 Civi
::$statics[__CLASS__
]['fields'] = [
371 'type' => CRM_Utils_Type
::T_INT
,
372 'title' => ts('Mailing ID'),
374 'where' => 'civicrm_mailing.id',
375 'table_name' => 'civicrm_mailing',
376 'entity' => 'Mailing',
377 'bao' => 'CRM_Mailing_BAO_Mailing',
381 'name' => 'domain_id',
382 'type' => CRM_Utils_Type
::T_INT
,
383 'title' => ts('Mailing Domain'),
384 'description' => ts('Which site is this mailing for'),
385 'where' => 'civicrm_mailing.domain_id',
386 'table_name' => 'civicrm_mailing',
387 'entity' => 'Mailing',
388 'bao' => 'CRM_Mailing_BAO_Mailing',
390 'FKClassName' => 'CRM_Core_DAO_Domain',
391 'pseudoconstant' => [
392 'table' => 'civicrm_domain',
394 'labelColumn' => 'name',
398 'name' => 'header_id',
399 'type' => CRM_Utils_Type
::T_INT
,
400 'title' => ts('Mailing Header'),
401 'description' => ts('FK to the header component.'),
402 'where' => 'civicrm_mailing.header_id',
403 'table_name' => 'civicrm_mailing',
404 'entity' => 'Mailing',
405 'bao' => 'CRM_Mailing_BAO_Mailing',
407 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
408 'pseudoconstant' => [
409 'table' => 'civicrm_mailing_component',
411 'labelColumn' => 'name',
412 'condition' => 'component_type = "Header"',
416 'name' => 'footer_id',
417 'type' => CRM_Utils_Type
::T_INT
,
418 'title' => ts('Mailing Footer'),
419 'description' => ts('FK to the footer component.'),
420 'where' => 'civicrm_mailing.footer_id',
421 'table_name' => 'civicrm_mailing',
422 'entity' => 'Mailing',
423 'bao' => 'CRM_Mailing_BAO_Mailing',
425 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
426 'pseudoconstant' => [
427 'table' => 'civicrm_mailing_component',
429 'labelColumn' => 'name',
430 'condition' => 'component_type = "Footer"',
434 'name' => 'reply_id',
435 'type' => CRM_Utils_Type
::T_INT
,
436 'title' => ts('Mailing Reply'),
437 'description' => ts('FK to the auto-responder component.'),
438 'where' => 'civicrm_mailing.reply_id',
439 'table_name' => 'civicrm_mailing',
440 'entity' => 'Mailing',
441 'bao' => 'CRM_Mailing_BAO_Mailing',
443 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
445 'unsubscribe_id' => [
446 'name' => 'unsubscribe_id',
447 'type' => CRM_Utils_Type
::T_INT
,
448 'title' => ts('Mailing Unsubscribe'),
449 'description' => ts('FK to the unsubscribe component.'),
450 'where' => 'civicrm_mailing.unsubscribe_id',
451 'table_name' => 'civicrm_mailing',
452 'entity' => 'Mailing',
453 'bao' => 'CRM_Mailing_BAO_Mailing',
455 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
457 'resubscribe_id' => [
458 'name' => 'resubscribe_id',
459 'type' => CRM_Utils_Type
::T_INT
,
460 'title' => ts('Mailing Resubscribe'),
461 'where' => 'civicrm_mailing.resubscribe_id',
462 'table_name' => 'civicrm_mailing',
463 'entity' => 'Mailing',
464 'bao' => 'CRM_Mailing_BAO_Mailing',
468 'name' => 'optout_id',
469 'type' => CRM_Utils_Type
::T_INT
,
470 'title' => ts('Mailing Opt Out'),
471 'description' => ts('FK to the opt-out component.'),
472 'where' => 'civicrm_mailing.optout_id',
473 'table_name' => 'civicrm_mailing',
474 'entity' => 'Mailing',
475 'bao' => 'CRM_Mailing_BAO_Mailing',
477 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
481 'type' => CRM_Utils_Type
::T_STRING
,
482 'title' => ts('Mailing Name'),
483 'description' => ts('Mailing Name.'),
485 'size' => CRM_Utils_Type
::HUGE
,
486 'where' => 'civicrm_mailing.name',
487 'table_name' => 'civicrm_mailing',
488 'entity' => 'Mailing',
489 'bao' => 'CRM_Mailing_BAO_Mailing',
496 'name' => 'mailing_type',
497 'type' => CRM_Utils_Type
::T_STRING
,
498 'title' => ts('Mailing Type'),
499 'description' => ts('differentiate between standalone mailings, A/B tests, and A/B final-winner'),
501 'size' => CRM_Utils_Type
::MEDIUM
,
502 'where' => 'civicrm_mailing.mailing_type',
503 'table_name' => 'civicrm_mailing',
504 'entity' => 'Mailing',
505 'bao' => 'CRM_Mailing_BAO_Mailing',
510 'pseudoconstant' => [
511 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
515 'name' => 'from_name',
516 'type' => CRM_Utils_Type
::T_STRING
,
517 'title' => ts('Mailing From Name'),
518 'description' => ts('From Header of mailing'),
520 'size' => CRM_Utils_Type
::HUGE
,
521 'where' => 'civicrm_mailing.from_name',
522 'table_name' => 'civicrm_mailing',
523 'entity' => 'Mailing',
524 'bao' => 'CRM_Mailing_BAO_Mailing',
531 'name' => 'from_email',
532 'type' => CRM_Utils_Type
::T_STRING
,
533 'title' => ts('Mailing From Email'),
534 'description' => ts('From Email of mailing'),
536 'size' => CRM_Utils_Type
::HUGE
,
537 'where' => 'civicrm_mailing.from_email',
538 'table_name' => 'civicrm_mailing',
539 'entity' => 'Mailing',
540 'bao' => 'CRM_Mailing_BAO_Mailing',
547 'name' => 'replyto_email',
548 'type' => CRM_Utils_Type
::T_STRING
,
549 'title' => ts('Replyto Email'),
550 'description' => ts('Reply-To Email of mailing'),
552 'size' => CRM_Utils_Type
::HUGE
,
553 'where' => 'civicrm_mailing.replyto_email',
554 'table_name' => 'civicrm_mailing',
555 'entity' => 'Mailing',
556 'bao' => 'CRM_Mailing_BAO_Mailing',
563 'name' => 'template_type',
564 'type' => CRM_Utils_Type
::T_STRING
,
565 'title' => ts('Template Type'),
566 'description' => ts('The language/processing system used for email templates.'),
569 'size' => CRM_Utils_Type
::BIG
,
570 'where' => 'civicrm_mailing.template_type',
571 'default' => 'traditional',
572 'table_name' => 'civicrm_mailing',
573 'entity' => 'Mailing',
574 'bao' => 'CRM_Mailing_BAO_Mailing',
576 'pseudoconstant' => [
577 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
580 'template_options' => [
581 'name' => 'template_options',
582 'type' => CRM_Utils_Type
::T_LONGTEXT
,
583 'title' => ts('Template Options (JSON)'),
584 'description' => ts('Advanced options used by the email templating system. (JSON encoded)'),
585 'where' => 'civicrm_mailing.template_options',
586 'table_name' => 'civicrm_mailing',
587 'entity' => 'Mailing',
588 'bao' => 'CRM_Mailing_BAO_Mailing',
593 'type' => CRM_Utils_Type
::T_STRING
,
594 'title' => ts('Subject'),
595 'description' => ts('Subject of mailing'),
597 'size' => CRM_Utils_Type
::HUGE
,
598 'where' => 'civicrm_mailing.subject',
599 'table_name' => 'civicrm_mailing',
600 'entity' => 'Mailing',
601 'bao' => 'CRM_Mailing_BAO_Mailing',
608 'name' => 'body_text',
609 'type' => CRM_Utils_Type
::T_LONGTEXT
,
610 'title' => ts('Body Text'),
611 'description' => ts('Body of the mailing in text format.'),
612 'where' => 'civicrm_mailing.body_text',
613 'table_name' => 'civicrm_mailing',
614 'entity' => 'Mailing',
615 'bao' => 'CRM_Mailing_BAO_Mailing',
619 'name' => 'body_html',
620 'type' => CRM_Utils_Type
::T_LONGTEXT
,
621 'title' => ts('Body Html'),
622 'description' => ts('Body of the mailing in html format.'),
623 'where' => 'civicrm_mailing.body_html',
624 'table_name' => 'civicrm_mailing',
625 'entity' => 'Mailing',
626 'bao' => 'CRM_Mailing_BAO_Mailing',
630 'name' => 'url_tracking',
631 'type' => CRM_Utils_Type
::T_BOOLEAN
,
632 'title' => ts('Url Tracking'),
633 'description' => ts('Should we track URL click-throughs for this mailing?'),
634 'where' => 'civicrm_mailing.url_tracking',
635 'table_name' => 'civicrm_mailing',
636 'entity' => 'Mailing',
637 'bao' => 'CRM_Mailing_BAO_Mailing',
640 'type' => 'CheckBox',
643 'forward_replies' => [
644 'name' => 'forward_replies',
645 'type' => CRM_Utils_Type
::T_BOOLEAN
,
646 'title' => ts('Forward Replies'),
647 'description' => ts('Should we forward replies back to the author?'),
648 'where' => 'civicrm_mailing.forward_replies',
649 'table_name' => 'civicrm_mailing',
650 'entity' => 'Mailing',
651 'bao' => 'CRM_Mailing_BAO_Mailing',
654 'type' => 'CheckBox',
657 'auto_responder' => [
658 'name' => 'auto_responder',
659 'type' => CRM_Utils_Type
::T_BOOLEAN
,
660 'title' => ts('Auto Responder'),
661 'description' => ts('Should we enable the auto-responder?'),
662 'where' => 'civicrm_mailing.auto_responder',
663 'table_name' => 'civicrm_mailing',
664 'entity' => 'Mailing',
665 'bao' => 'CRM_Mailing_BAO_Mailing',
668 'type' => 'CheckBox',
672 'name' => 'open_tracking',
673 'type' => CRM_Utils_Type
::T_BOOLEAN
,
674 'title' => ts('Track Mailing?'),
675 'description' => ts('Should we track when recipients open/read this mailing?'),
676 'where' => 'civicrm_mailing.open_tracking',
677 'table_name' => 'civicrm_mailing',
678 'entity' => 'Mailing',
679 'bao' => 'CRM_Mailing_BAO_Mailing',
683 'name' => 'is_completed',
684 'type' => CRM_Utils_Type
::T_BOOLEAN
,
685 'title' => ts('Mailing Completed'),
686 'description' => ts('Has at least one job associated with this mailing finished?'),
687 'where' => 'civicrm_mailing.is_completed',
688 'table_name' => 'civicrm_mailing',
689 'entity' => 'Mailing',
690 'bao' => 'CRM_Mailing_BAO_Mailing',
693 'type' => 'CheckBox',
696 'msg_template_id' => [
697 'name' => 'msg_template_id',
698 'type' => CRM_Utils_Type
::T_INT
,
699 'title' => ts('Mailing Message Template'),
700 'description' => ts('FK to the message template.'),
701 'where' => 'civicrm_mailing.msg_template_id',
702 'table_name' => 'civicrm_mailing',
703 'entity' => 'Mailing',
704 'bao' => 'CRM_Mailing_BAO_Mailing',
706 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
709 'name' => 'override_verp',
710 'type' => CRM_Utils_Type
::T_BOOLEAN
,
711 'title' => ts('Override Verp'),
712 'description' => ts('Overwrite the VERP address in Reply-To'),
713 'where' => 'civicrm_mailing.override_verp',
715 'table_name' => 'civicrm_mailing',
716 'entity' => 'Mailing',
717 'bao' => 'CRM_Mailing_BAO_Mailing',
720 'type' => 'CheckBox',
724 'name' => 'created_id',
725 'type' => CRM_Utils_Type
::T_INT
,
726 'title' => ts('Mailing Creator'),
727 'description' => ts('FK to Contact ID who first created this mailing'),
728 'where' => 'civicrm_mailing.created_id',
729 'table_name' => 'civicrm_mailing',
730 'entity' => 'Mailing',
731 'bao' => 'CRM_Mailing_BAO_Mailing',
733 'FKClassName' => 'CRM_Contact_DAO_Contact',
736 'name' => 'created_date',
737 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
738 'title' => ts('Mailing Created Date'),
739 'description' => ts('Date and time this mailing was created.'),
741 'where' => 'civicrm_mailing.created_date',
743 'table_name' => 'civicrm_mailing',
744 'entity' => 'Mailing',
745 'bao' => 'CRM_Mailing_BAO_Mailing',
748 'type' => 'Select Date',
749 'formatType' => 'activityDateTime',
752 'mailing_modified_date' => [
753 'name' => 'modified_date',
754 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
755 'title' => ts('Modified Date'),
756 'description' => ts('When the mailing (or closely related entity) was created or modified or deleted.'),
758 'where' => 'civicrm_mailing.modified_date',
760 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
761 'table_name' => 'civicrm_mailing',
762 'entity' => 'Mailing',
763 'bao' => 'CRM_Mailing_BAO_Mailing',
767 'name' => 'scheduled_id',
768 'type' => CRM_Utils_Type
::T_INT
,
769 'title' => ts('Scheduled By'),
770 'description' => ts('FK to Contact ID who scheduled this mailing'),
771 'where' => 'civicrm_mailing.scheduled_id',
772 'table_name' => 'civicrm_mailing',
773 'entity' => 'Mailing',
774 'bao' => 'CRM_Mailing_BAO_Mailing',
776 'FKClassName' => 'CRM_Contact_DAO_Contact',
778 'scheduled_date' => [
779 'name' => 'scheduled_date',
780 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
781 'title' => ts('Mailing Scheduled Date'),
782 'description' => ts('Date and time this mailing was scheduled.'),
784 'where' => 'civicrm_mailing.scheduled_date',
786 'table_name' => 'civicrm_mailing',
787 'entity' => 'Mailing',
788 'bao' => 'CRM_Mailing_BAO_Mailing',
791 'type' => 'Select Date',
792 'formatType' => 'activityDateTime',
796 'name' => 'approver_id',
797 'type' => CRM_Utils_Type
::T_INT
,
798 'title' => ts('Approved By'),
799 'description' => ts('FK to Contact ID who approved this mailing'),
800 'where' => 'civicrm_mailing.approver_id',
801 'table_name' => 'civicrm_mailing',
802 'entity' => 'Mailing',
803 'bao' => 'CRM_Mailing_BAO_Mailing',
805 'FKClassName' => 'CRM_Contact_DAO_Contact',
808 'name' => 'approval_date',
809 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
810 'title' => ts('Mailing Approved Date'),
811 'description' => ts('Date and time this mailing was approved.'),
813 'where' => 'civicrm_mailing.approval_date',
815 'table_name' => 'civicrm_mailing',
816 'entity' => 'Mailing',
817 'bao' => 'CRM_Mailing_BAO_Mailing',
820 'type' => 'Select Date',
821 'formatType' => 'activityDateTime',
824 'approval_status_id' => [
825 'name' => 'approval_status_id',
826 'type' => CRM_Utils_Type
::T_INT
,
827 'title' => ts('Approval Status'),
828 'description' => ts('The status of this mailing. Values: none, approved, rejected'),
829 'where' => 'civicrm_mailing.approval_status_id',
830 'table_name' => 'civicrm_mailing',
831 'entity' => 'Mailing',
832 'bao' => 'CRM_Mailing_BAO_Mailing',
837 'pseudoconstant' => [
838 'optionGroupName' => 'mail_approval_status',
839 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
843 'name' => 'approval_note',
844 'type' => CRM_Utils_Type
::T_LONGTEXT
,
845 'title' => ts('Approval Note'),
846 'description' => ts('Note behind the decision.'),
847 'where' => 'civicrm_mailing.approval_note',
848 'table_name' => 'civicrm_mailing',
849 'entity' => 'Mailing',
850 'bao' => 'CRM_Mailing_BAO_Mailing',
853 'type' => 'TextArea',
857 'name' => 'is_archived',
858 'type' => CRM_Utils_Type
::T_BOOLEAN
,
859 'title' => ts('Is Mailing Archived?'),
860 'description' => ts('Is this mailing archived?'),
861 'where' => 'civicrm_mailing.is_archived',
863 'table_name' => 'civicrm_mailing',
864 'entity' => 'Mailing',
865 'bao' => 'CRM_Mailing_BAO_Mailing',
868 'type' => 'CheckBox',
872 'name' => 'visibility',
873 'type' => CRM_Utils_Type
::T_STRING
,
874 'title' => ts('Mailing Visibility'),
875 'description' => ts('In what context(s) is the mailing contents visible (online viewing)'),
877 'size' => CRM_Utils_Type
::BIG
,
878 'where' => 'civicrm_mailing.visibility',
879 'default' => 'Public Pages',
880 'table_name' => 'civicrm_mailing',
881 'entity' => 'Mailing',
882 'bao' => 'CRM_Mailing_BAO_Mailing',
887 'pseudoconstant' => [
888 'callback' => 'CRM_Core_SelectValues::groupVisibility',
892 'name' => 'campaign_id',
893 'type' => CRM_Utils_Type
::T_INT
,
894 'title' => ts('Mailing Campaign'),
895 'description' => ts('The campaign for which this mailing has been initiated.'),
896 'where' => 'civicrm_mailing.campaign_id',
897 'table_name' => 'civicrm_mailing',
898 'entity' => 'Mailing',
899 'bao' => 'CRM_Mailing_BAO_Mailing',
901 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
905 'pseudoconstant' => [
906 'table' => 'civicrm_campaign',
908 'labelColumn' => 'title',
912 'name' => 'dedupe_email',
913 'type' => CRM_Utils_Type
::T_BOOLEAN
,
914 'title' => ts('No Duplicate emails?'),
915 'description' => ts('Remove duplicate emails?'),
916 'where' => 'civicrm_mailing.dedupe_email',
918 'table_name' => 'civicrm_mailing',
919 'entity' => 'Mailing',
920 'bao' => 'CRM_Mailing_BAO_Mailing',
923 'type' => 'CheckBox',
926 'sms_provider_id' => [
927 'name' => 'sms_provider_id',
928 'type' => CRM_Utils_Type
::T_INT
,
929 'title' => ts('Mailing SMS Provider'),
930 'where' => 'civicrm_mailing.sms_provider_id',
931 'table_name' => 'civicrm_mailing',
932 'entity' => 'Mailing',
933 'bao' => 'CRM_Mailing_BAO_Mailing',
935 'FKClassName' => 'CRM_SMS_DAO_Provider',
942 'type' => CRM_Utils_Type
::T_STRING
,
943 'title' => ts('Mailing Hash'),
944 'description' => ts('Key for validating requests related to this mailing.'),
946 'size' => CRM_Utils_Type
::TWELVE
,
947 'where' => 'civicrm_mailing.hash',
948 'table_name' => 'civicrm_mailing',
949 'entity' => 'Mailing',
950 'bao' => 'CRM_Mailing_BAO_Mailing',
953 'location_type_id' => [
954 'name' => 'location_type_id',
955 'type' => CRM_Utils_Type
::T_INT
,
956 'title' => ts('Location Type'),
957 'description' => ts('With email_selection_method, determines which email address to use'),
958 'where' => 'civicrm_mailing.location_type_id',
959 'table_name' => 'civicrm_mailing',
960 'entity' => 'Mailing',
961 'bao' => 'CRM_Mailing_BAO_Mailing',
963 'FKClassName' => 'CRM_Core_DAO_LocationType',
964 'pseudoconstant' => [
965 'table' => 'civicrm_location_type',
967 'labelColumn' => 'display_name',
970 'email_selection_method' => [
971 'name' => 'email_selection_method',
972 'type' => CRM_Utils_Type
::T_STRING
,
973 'title' => ts('Email Selection Method'),
974 'description' => ts('With location_type_id, determine how to choose the email address to use.'),
976 'size' => CRM_Utils_Type
::MEDIUM
,
977 'where' => 'civicrm_mailing.email_selection_method',
978 'default' => 'automatic',
979 'table_name' => 'civicrm_mailing',
980 'entity' => 'Mailing',
981 'bao' => 'CRM_Mailing_BAO_Mailing',
983 'pseudoconstant' => [
984 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
988 'name' => 'language',
989 'type' => CRM_Utils_Type
::T_STRING
,
990 'title' => ts('Mailing Language'),
991 'description' => ts('Language of the content of the mailing. Useful for tokens.'),
993 'size' => CRM_Utils_Type
::SIX
,
994 'where' => 'civicrm_mailing.language',
995 'table_name' => 'civicrm_mailing',
996 'entity' => 'Mailing',
997 'bao' => 'CRM_Mailing_BAO_Mailing',
1002 'pseudoconstant' => [
1003 'optionGroupName' => 'languages',
1004 'keyColumn' => 'name',
1005 'optionEditPath' => 'civicrm/admin/options/languages',
1009 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
1011 return Civi
::$statics[__CLASS__
]['fields'];
1015 * Return a mapping from field-name to the corresponding key (as used in fields()).
1018 * Array(string $name => string $uniqueName).
1020 public static function &fieldKeys() {
1021 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1022 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1024 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1028 * Returns the names of this table
1032 public static function getTableName() {
1033 return self
::$_tableName;
1037 * Returns if this table needs to be logged
1041 public function getLog() {
1046 * Returns the list of fields that can be imported
1048 * @param bool $prefix
1052 public static function &import($prefix = FALSE) {
1053 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing', $prefix, []);
1058 * Returns the list of fields that can be exported
1060 * @param bool $prefix
1064 public static function &export($prefix = FALSE) {
1065 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing', $prefix, []);
1070 * Returns the list of indices
1072 * @param bool $localize
1076 public static function indices($localize = TRUE) {
1079 'name' => 'index_hash',
1083 'localizable' => FALSE,
1084 'sig' => 'civicrm_mailing::0::hash',
1087 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;