5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Mailing/Mailing.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:9e3f016db0a2ac72e2c25c9c5e3821a5)
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 * Should we overrite 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',
410 'name' => 'footer_id',
411 'type' => CRM_Utils_Type
::T_INT
,
412 'title' => ts('Mailing Footer'),
413 'description' => ts('FK to the footer component.'),
414 'where' => 'civicrm_mailing.footer_id',
415 'table_name' => 'civicrm_mailing',
416 'entity' => 'Mailing',
417 'bao' => 'CRM_Mailing_BAO_Mailing',
419 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
422 'name' => 'reply_id',
423 'type' => CRM_Utils_Type
::T_INT
,
424 'title' => ts('Mailing Reply'),
425 'description' => ts('FK to the auto-responder component.'),
426 'where' => 'civicrm_mailing.reply_id',
427 'table_name' => 'civicrm_mailing',
428 'entity' => 'Mailing',
429 'bao' => 'CRM_Mailing_BAO_Mailing',
431 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
433 'unsubscribe_id' => [
434 'name' => 'unsubscribe_id',
435 'type' => CRM_Utils_Type
::T_INT
,
436 'title' => ts('Mailing Unsubscribe'),
437 'description' => ts('FK to the unsubscribe component.'),
438 'where' => 'civicrm_mailing.unsubscribe_id',
439 'table_name' => 'civicrm_mailing',
440 'entity' => 'Mailing',
441 'bao' => 'CRM_Mailing_BAO_Mailing',
443 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
445 'resubscribe_id' => [
446 'name' => 'resubscribe_id',
447 'type' => CRM_Utils_Type
::T_INT
,
448 'title' => ts('Mailing Resubscribe'),
449 'where' => 'civicrm_mailing.resubscribe_id',
450 'table_name' => 'civicrm_mailing',
451 'entity' => 'Mailing',
452 'bao' => 'CRM_Mailing_BAO_Mailing',
456 'name' => 'optout_id',
457 'type' => CRM_Utils_Type
::T_INT
,
458 'title' => ts('Mailing Opt Out'),
459 'description' => ts('FK to the opt-out component.'),
460 'where' => 'civicrm_mailing.optout_id',
461 'table_name' => 'civicrm_mailing',
462 'entity' => 'Mailing',
463 'bao' => 'CRM_Mailing_BAO_Mailing',
465 'FKClassName' => 'CRM_Mailing_DAO_MailingComponent',
469 'type' => CRM_Utils_Type
::T_STRING
,
470 'title' => ts('Mailing Name'),
471 'description' => ts('Mailing Name.'),
473 'size' => CRM_Utils_Type
::HUGE
,
474 'where' => 'civicrm_mailing.name',
475 'table_name' => 'civicrm_mailing',
476 'entity' => 'Mailing',
477 'bao' => 'CRM_Mailing_BAO_Mailing',
484 'name' => 'mailing_type',
485 'type' => CRM_Utils_Type
::T_STRING
,
486 'title' => ts('Mailing Type'),
487 'description' => ts('differentiate between standalone mailings, A/B tests, and A/B final-winner'),
489 'size' => CRM_Utils_Type
::MEDIUM
,
490 'where' => 'civicrm_mailing.mailing_type',
491 'table_name' => 'civicrm_mailing',
492 'entity' => 'Mailing',
493 'bao' => 'CRM_Mailing_BAO_Mailing',
498 'pseudoconstant' => [
499 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
503 'name' => 'from_name',
504 'type' => CRM_Utils_Type
::T_STRING
,
505 'title' => ts('Mailing From Name'),
506 'description' => ts('From Header of mailing'),
508 'size' => CRM_Utils_Type
::HUGE
,
509 'where' => 'civicrm_mailing.from_name',
510 'table_name' => 'civicrm_mailing',
511 'entity' => 'Mailing',
512 'bao' => 'CRM_Mailing_BAO_Mailing',
519 'name' => 'from_email',
520 'type' => CRM_Utils_Type
::T_STRING
,
521 'title' => ts('Mailing From Email'),
522 'description' => ts('From Email of mailing'),
524 'size' => CRM_Utils_Type
::HUGE
,
525 'where' => 'civicrm_mailing.from_email',
526 'table_name' => 'civicrm_mailing',
527 'entity' => 'Mailing',
528 'bao' => 'CRM_Mailing_BAO_Mailing',
535 'name' => 'replyto_email',
536 'type' => CRM_Utils_Type
::T_STRING
,
537 'title' => ts('Replyto Email'),
538 'description' => ts('Reply-To Email of mailing'),
540 'size' => CRM_Utils_Type
::HUGE
,
541 'where' => 'civicrm_mailing.replyto_email',
542 'table_name' => 'civicrm_mailing',
543 'entity' => 'Mailing',
544 'bao' => 'CRM_Mailing_BAO_Mailing',
551 'name' => 'template_type',
552 'type' => CRM_Utils_Type
::T_STRING
,
553 'title' => ts('Template Type'),
554 'description' => ts('The language/processing system used for email templates.'),
557 'size' => CRM_Utils_Type
::BIG
,
558 'where' => 'civicrm_mailing.template_type',
559 'default' => 'traditional',
560 'table_name' => 'civicrm_mailing',
561 'entity' => 'Mailing',
562 'bao' => 'CRM_Mailing_BAO_Mailing',
564 'pseudoconstant' => [
565 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
568 'template_options' => [
569 'name' => 'template_options',
570 'type' => CRM_Utils_Type
::T_LONGTEXT
,
571 'title' => ts('Template Options (JSON)'),
572 'description' => ts('Advanced options used by the email templating system. (JSON encoded)'),
573 'where' => 'civicrm_mailing.template_options',
574 'table_name' => 'civicrm_mailing',
575 'entity' => 'Mailing',
576 'bao' => 'CRM_Mailing_BAO_Mailing',
581 'type' => CRM_Utils_Type
::T_STRING
,
582 'title' => ts('Subject'),
583 'description' => ts('Subject of mailing'),
585 'size' => CRM_Utils_Type
::HUGE
,
586 'where' => 'civicrm_mailing.subject',
587 'table_name' => 'civicrm_mailing',
588 'entity' => 'Mailing',
589 'bao' => 'CRM_Mailing_BAO_Mailing',
596 'name' => 'body_text',
597 'type' => CRM_Utils_Type
::T_LONGTEXT
,
598 'title' => ts('Body Text'),
599 'description' => ts('Body of the mailing in text format.'),
600 'where' => 'civicrm_mailing.body_text',
601 'table_name' => 'civicrm_mailing',
602 'entity' => 'Mailing',
603 'bao' => 'CRM_Mailing_BAO_Mailing',
607 'name' => 'body_html',
608 'type' => CRM_Utils_Type
::T_LONGTEXT
,
609 'title' => ts('Body Html'),
610 'description' => ts('Body of the mailing in html format.'),
611 'where' => 'civicrm_mailing.body_html',
612 'table_name' => 'civicrm_mailing',
613 'entity' => 'Mailing',
614 'bao' => 'CRM_Mailing_BAO_Mailing',
618 'name' => 'url_tracking',
619 'type' => CRM_Utils_Type
::T_BOOLEAN
,
620 'title' => ts('Url Tracking'),
621 'description' => ts('Should we track URL click-throughs for this mailing?'),
622 'where' => 'civicrm_mailing.url_tracking',
623 'table_name' => 'civicrm_mailing',
624 'entity' => 'Mailing',
625 'bao' => 'CRM_Mailing_BAO_Mailing',
628 'type' => 'CheckBox',
631 'forward_replies' => [
632 'name' => 'forward_replies',
633 'type' => CRM_Utils_Type
::T_BOOLEAN
,
634 'title' => ts('Forward Replies'),
635 'description' => ts('Should we forward replies back to the author?'),
636 'where' => 'civicrm_mailing.forward_replies',
637 'table_name' => 'civicrm_mailing',
638 'entity' => 'Mailing',
639 'bao' => 'CRM_Mailing_BAO_Mailing',
642 'type' => 'CheckBox',
645 'auto_responder' => [
646 'name' => 'auto_responder',
647 'type' => CRM_Utils_Type
::T_BOOLEAN
,
648 'title' => ts('Auto Responder'),
649 'description' => ts('Should we enable the auto-responder?'),
650 'where' => 'civicrm_mailing.auto_responder',
651 'table_name' => 'civicrm_mailing',
652 'entity' => 'Mailing',
653 'bao' => 'CRM_Mailing_BAO_Mailing',
656 'type' => 'CheckBox',
660 'name' => 'open_tracking',
661 'type' => CRM_Utils_Type
::T_BOOLEAN
,
662 'title' => ts('Track Mailing?'),
663 'description' => ts('Should we track when recipients open/read this mailing?'),
664 'where' => 'civicrm_mailing.open_tracking',
665 'table_name' => 'civicrm_mailing',
666 'entity' => 'Mailing',
667 'bao' => 'CRM_Mailing_BAO_Mailing',
671 'name' => 'is_completed',
672 'type' => CRM_Utils_Type
::T_BOOLEAN
,
673 'title' => ts('Mailing Completed'),
674 'description' => ts('Has at least one job associated with this mailing finished?'),
675 'where' => 'civicrm_mailing.is_completed',
676 'table_name' => 'civicrm_mailing',
677 'entity' => 'Mailing',
678 'bao' => 'CRM_Mailing_BAO_Mailing',
681 'type' => 'CheckBox',
684 'msg_template_id' => [
685 'name' => 'msg_template_id',
686 'type' => CRM_Utils_Type
::T_INT
,
687 'title' => ts('Mailing Message Template'),
688 'description' => ts('FK to the message template.'),
689 'where' => 'civicrm_mailing.msg_template_id',
690 'table_name' => 'civicrm_mailing',
691 'entity' => 'Mailing',
692 'bao' => 'CRM_Mailing_BAO_Mailing',
694 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
697 'name' => 'override_verp',
698 'type' => CRM_Utils_Type
::T_BOOLEAN
,
699 'title' => ts('Override Verp'),
700 'description' => ts('Should we overrite VERP address in Reply-To'),
701 'where' => 'civicrm_mailing.override_verp',
703 'table_name' => 'civicrm_mailing',
704 'entity' => 'Mailing',
705 'bao' => 'CRM_Mailing_BAO_Mailing',
708 'type' => 'CheckBox',
712 'name' => 'created_id',
713 'type' => CRM_Utils_Type
::T_INT
,
714 'title' => ts('Mailing Creator'),
715 'description' => ts('FK to Contact ID who first created this mailing'),
716 'where' => 'civicrm_mailing.created_id',
717 'table_name' => 'civicrm_mailing',
718 'entity' => 'Mailing',
719 'bao' => 'CRM_Mailing_BAO_Mailing',
721 'FKClassName' => 'CRM_Contact_DAO_Contact',
724 'name' => 'created_date',
725 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
726 'title' => ts('Mailing Created Date'),
727 'description' => ts('Date and time this mailing was created.'),
729 'where' => 'civicrm_mailing.created_date',
731 'table_name' => 'civicrm_mailing',
732 'entity' => 'Mailing',
733 'bao' => 'CRM_Mailing_BAO_Mailing',
736 'type' => 'Select Date',
737 'formatType' => 'activityDateTime',
740 'mailing_modified_date' => [
741 'name' => 'modified_date',
742 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
743 'title' => ts('Modified Date'),
744 'description' => ts('When the mailing (or closely related entity) was created or modified or deleted.'),
746 'where' => 'civicrm_mailing.modified_date',
748 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
749 'table_name' => 'civicrm_mailing',
750 'entity' => 'Mailing',
751 'bao' => 'CRM_Mailing_BAO_Mailing',
755 'name' => 'scheduled_id',
756 'type' => CRM_Utils_Type
::T_INT
,
757 'title' => ts('Scheduled By'),
758 'description' => ts('FK to Contact ID who scheduled this mailing'),
759 'where' => 'civicrm_mailing.scheduled_id',
760 'table_name' => 'civicrm_mailing',
761 'entity' => 'Mailing',
762 'bao' => 'CRM_Mailing_BAO_Mailing',
764 'FKClassName' => 'CRM_Contact_DAO_Contact',
766 'scheduled_date' => [
767 'name' => 'scheduled_date',
768 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
769 'title' => ts('Mailing Scheduled Date'),
770 'description' => ts('Date and time this mailing was scheduled.'),
772 'where' => 'civicrm_mailing.scheduled_date',
774 'table_name' => 'civicrm_mailing',
775 'entity' => 'Mailing',
776 'bao' => 'CRM_Mailing_BAO_Mailing',
779 'type' => 'Select Date',
780 'formatType' => 'activityDateTime',
784 'name' => 'approver_id',
785 'type' => CRM_Utils_Type
::T_INT
,
786 'title' => ts('Approved By'),
787 'description' => ts('FK to Contact ID who approved this mailing'),
788 'where' => 'civicrm_mailing.approver_id',
789 'table_name' => 'civicrm_mailing',
790 'entity' => 'Mailing',
791 'bao' => 'CRM_Mailing_BAO_Mailing',
793 'FKClassName' => 'CRM_Contact_DAO_Contact',
796 'name' => 'approval_date',
797 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
798 'title' => ts('Mailing Approved Date'),
799 'description' => ts('Date and time this mailing was approved.'),
801 'where' => 'civicrm_mailing.approval_date',
803 'table_name' => 'civicrm_mailing',
804 'entity' => 'Mailing',
805 'bao' => 'CRM_Mailing_BAO_Mailing',
808 'type' => 'Select Date',
809 'formatType' => 'activityDateTime',
812 'approval_status_id' => [
813 'name' => 'approval_status_id',
814 'type' => CRM_Utils_Type
::T_INT
,
815 'title' => ts('Approval Status'),
816 'description' => ts('The status of this mailing. Values: none, approved, rejected'),
817 'where' => 'civicrm_mailing.approval_status_id',
818 'table_name' => 'civicrm_mailing',
819 'entity' => 'Mailing',
820 'bao' => 'CRM_Mailing_BAO_Mailing',
825 'pseudoconstant' => [
826 'optionGroupName' => 'mail_approval_status',
827 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
831 'name' => 'approval_note',
832 'type' => CRM_Utils_Type
::T_LONGTEXT
,
833 'title' => ts('Approval Note'),
834 'description' => ts('Note behind the decision.'),
835 'where' => 'civicrm_mailing.approval_note',
836 'table_name' => 'civicrm_mailing',
837 'entity' => 'Mailing',
838 'bao' => 'CRM_Mailing_BAO_Mailing',
841 'type' => 'TextArea',
845 'name' => 'is_archived',
846 'type' => CRM_Utils_Type
::T_BOOLEAN
,
847 'title' => ts('Is Mailing Archived?'),
848 'description' => ts('Is this mailing archived?'),
849 'where' => 'civicrm_mailing.is_archived',
851 'table_name' => 'civicrm_mailing',
852 'entity' => 'Mailing',
853 'bao' => 'CRM_Mailing_BAO_Mailing',
856 'type' => 'CheckBox',
860 'name' => 'visibility',
861 'type' => CRM_Utils_Type
::T_STRING
,
862 'title' => ts('Mailing Visibility'),
863 'description' => ts('In what context(s) is the mailing contents visible (online viewing)'),
865 'size' => CRM_Utils_Type
::BIG
,
866 'where' => 'civicrm_mailing.visibility',
867 'default' => 'Public Pages',
868 'table_name' => 'civicrm_mailing',
869 'entity' => 'Mailing',
870 'bao' => 'CRM_Mailing_BAO_Mailing',
875 'pseudoconstant' => [
876 'callback' => 'CRM_Core_SelectValues::groupVisibility',
880 'name' => 'campaign_id',
881 'type' => CRM_Utils_Type
::T_INT
,
882 'title' => ts('Mailing Campaign'),
883 'description' => ts('The campaign for which this mailing has been initiated.'),
884 'where' => 'civicrm_mailing.campaign_id',
885 'table_name' => 'civicrm_mailing',
886 'entity' => 'Mailing',
887 'bao' => 'CRM_Mailing_BAO_Mailing',
889 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
893 'pseudoconstant' => [
894 'table' => 'civicrm_campaign',
896 'labelColumn' => 'title',
900 'name' => 'dedupe_email',
901 'type' => CRM_Utils_Type
::T_BOOLEAN
,
902 'title' => ts('No Duplicate emails?'),
903 'description' => ts('Remove duplicate emails?'),
904 'where' => 'civicrm_mailing.dedupe_email',
906 'table_name' => 'civicrm_mailing',
907 'entity' => 'Mailing',
908 'bao' => 'CRM_Mailing_BAO_Mailing',
911 'type' => 'CheckBox',
914 'sms_provider_id' => [
915 'name' => 'sms_provider_id',
916 'type' => CRM_Utils_Type
::T_INT
,
917 'title' => ts('Mailing SMS Provider'),
918 'where' => 'civicrm_mailing.sms_provider_id',
919 'table_name' => 'civicrm_mailing',
920 'entity' => 'Mailing',
921 'bao' => 'CRM_Mailing_BAO_Mailing',
923 'FKClassName' => 'CRM_SMS_DAO_Provider',
930 'type' => CRM_Utils_Type
::T_STRING
,
931 'title' => ts('Mailing Hash'),
932 'description' => ts('Key for validating requests related to this mailing.'),
934 'size' => CRM_Utils_Type
::TWELVE
,
935 'where' => 'civicrm_mailing.hash',
936 'table_name' => 'civicrm_mailing',
937 'entity' => 'Mailing',
938 'bao' => 'CRM_Mailing_BAO_Mailing',
941 'location_type_id' => [
942 'name' => 'location_type_id',
943 'type' => CRM_Utils_Type
::T_INT
,
944 'title' => ts('Location Type'),
945 'description' => ts('With email_selection_method, determines which email address to use'),
946 'where' => 'civicrm_mailing.location_type_id',
947 'table_name' => 'civicrm_mailing',
948 'entity' => 'Mailing',
949 'bao' => 'CRM_Mailing_BAO_Mailing',
951 'FKClassName' => 'CRM_Core_DAO_LocationType',
952 'pseudoconstant' => [
953 'table' => 'civicrm_location_type',
955 'labelColumn' => 'display_name',
958 'email_selection_method' => [
959 'name' => 'email_selection_method',
960 'type' => CRM_Utils_Type
::T_STRING
,
961 'title' => ts('Email Selection Method'),
962 'description' => ts('With location_type_id, determine how to choose the email address to use.'),
964 'size' => CRM_Utils_Type
::MEDIUM
,
965 'where' => 'civicrm_mailing.email_selection_method',
966 'default' => 'automatic',
967 'table_name' => 'civicrm_mailing',
968 'entity' => 'Mailing',
969 'bao' => 'CRM_Mailing_BAO_Mailing',
971 'pseudoconstant' => [
972 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
976 'name' => 'language',
977 'type' => CRM_Utils_Type
::T_STRING
,
978 'title' => ts('Mailing Language'),
979 'description' => ts('Language of the content of the mailing. Useful for tokens.'),
981 'size' => CRM_Utils_Type
::SIX
,
982 'where' => 'civicrm_mailing.language',
983 'table_name' => 'civicrm_mailing',
984 'entity' => 'Mailing',
985 'bao' => 'CRM_Mailing_BAO_Mailing',
990 'pseudoconstant' => [
991 'optionGroupName' => 'languages',
992 'keyColumn' => 'name',
993 'optionEditPath' => 'civicrm/admin/options/languages',
997 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
999 return Civi
::$statics[__CLASS__
]['fields'];
1003 * Return a mapping from field-name to the corresponding key (as used in fields()).
1006 * Array(string $name => string $uniqueName).
1008 public static function &fieldKeys() {
1009 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
1010 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
1012 return Civi
::$statics[__CLASS__
]['fieldKeys'];
1016 * Returns the names of this table
1020 public static function getTableName() {
1021 return self
::$_tableName;
1025 * Returns if this table needs to be logged
1029 public function getLog() {
1034 * Returns the list of fields that can be imported
1036 * @param bool $prefix
1040 public static function &import($prefix = FALSE) {
1041 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing', $prefix, []);
1046 * Returns the list of fields that can be exported
1048 * @param bool $prefix
1052 public static function &export($prefix = FALSE) {
1053 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing', $prefix, []);
1058 * Returns the list of indices
1060 * @param bool $localize
1064 public static function indices($localize = TRUE) {
1067 'name' => 'index_hash',
1071 'localizable' => FALSE,
1072 'sig' => 'civicrm_mailing::0::hash',
1075 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;