3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2016
31 * Generated from xml/schema/CRM/Mailing/Mailing.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:5a9a6f1b3a07e96bd988ce1259736a3a)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Mailing_DAO_Mailing
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_mailing';
45 * static instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the FK relationships
55 static $_links = null;
57 * static value to see if we should log any modifications to
58 * this table in the civicrm_log table
69 * Which site is this mailing for
75 * FK to the header component.
81 * FK to the footer component.
87 * FK to the auto-responder component.
93 * FK to the unsubscribe component.
97 public $unsubscribe_id;
102 public $resubscribe_id;
104 * FK to the opt-out component.
116 * differentiate between standalone mailings, A/B tests, and A/B final-winner
120 public $mailing_type;
122 * From Header of mailing
128 * From Email of mailing
134 * Reply-To Email of mailing
138 public $replyto_email;
146 * Body of the mailing in text format.
152 * Body of the mailing in html format.
158 * Should we track URL click-throughs for this mailing?
162 public $url_tracking;
164 * Should we forward replies back to the author?
168 public $forward_replies;
170 * Should we enable the auto-responder?
174 public $auto_responder;
176 * Should we track when recipients open/read this mailing?
180 public $open_tracking;
182 * Has at least one job associated with this mailing finished?
186 public $is_completed;
188 * FK to the message template.
192 public $msg_template_id;
194 * Should we overrite VERP address in Reply-To
198 public $override_verp;
200 * FK to Contact ID who first created this mailing
206 * Date and time this mailing was created.
210 public $created_date;
212 * FK to Contact ID who scheduled this mailing
216 public $scheduled_id;
218 * Date and time this mailing was scheduled.
222 public $scheduled_date;
224 * FK to Contact ID who approved this mailing
230 * Date and time this mailing was approved.
234 public $approval_date;
236 * The status of this mailing. Values: none, approved, rejected
240 public $approval_status_id;
242 * Note behind the decision.
246 public $approval_note;
248 * Is this mailing archived?
254 * In what context(s) is the mailing contents visible (online viewing)
260 * The campaign for which this mailing has been initiated.
266 * Remove duplicate emails?
270 public $dedupe_email;
275 public $sms_provider_id;
277 * Key for validating requests related to this mailing.
283 * With email_selection_method, determines which email address to use
287 public $location_type_id;
289 * With location_type_id, determine how to choose the email address to use.
293 public $email_selection_method;
297 * @return civicrm_mailing
299 function __construct() {
300 $this->__table
= 'civicrm_mailing';
301 parent
::__construct();
304 * Returns foreign keys and entity references
307 * [CRM_Core_Reference_Interface]
309 static function getReferenceColumns() {
310 if (!self
::$_links) {
311 self
::$_links = static ::createReferenceColumns(__CLASS__
);
312 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'domain_id', 'civicrm_domain', 'id');
313 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'header_id', 'civicrm_mailing_component', 'id');
314 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'footer_id', 'civicrm_mailing_component', 'id');
315 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'reply_id', 'civicrm_mailing_component', 'id');
316 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'unsubscribe_id', 'civicrm_mailing_component', 'id');
317 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'optout_id', 'civicrm_mailing_component', 'id');
318 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'msg_template_id', 'civicrm_msg_template', 'id');
319 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'created_id', 'civicrm_contact', 'id');
320 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'scheduled_id', 'civicrm_contact', 'id');
321 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'approver_id', 'civicrm_contact', 'id');
322 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
323 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'sms_provider_id', 'civicrm_sms_provider', 'id');
324 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'location_type_id', 'civicrm_location_type', 'id');
326 return self
::$_links;
329 * Returns all the column names of this table
333 static function &fields() {
334 if (!(self
::$_fields)) {
335 self
::$_fields = array(
338 'type' => CRM_Utils_Type
::T_INT
,
339 'title' => ts('Mailing ID') ,
342 'domain_id' => array(
343 'name' => 'domain_id',
344 'type' => CRM_Utils_Type
::T_INT
,
345 'title' => ts('Mailing Domain') ,
346 'description' => 'Which site is this mailing for',
347 'FKClassName' => 'CRM_Core_DAO_Domain',
348 'pseudoconstant' => array(
349 'table' => 'civicrm_domain',
351 'labelColumn' => 'name',
354 'header_id' => array(
355 'name' => 'header_id',
356 'type' => CRM_Utils_Type
::T_INT
,
357 'title' => ts('Mailing Header') ,
358 'description' => 'FK to the header component.',
359 'FKClassName' => 'CRM_Mailing_DAO_Component',
361 'footer_id' => array(
362 'name' => 'footer_id',
363 'type' => CRM_Utils_Type
::T_INT
,
364 'title' => ts('Mailing Footer') ,
365 'description' => 'FK to the footer component.',
366 'FKClassName' => 'CRM_Mailing_DAO_Component',
369 'name' => 'reply_id',
370 'type' => CRM_Utils_Type
::T_INT
,
371 'title' => ts('Mailing Reply') ,
372 'description' => 'FK to the auto-responder component.',
373 'FKClassName' => 'CRM_Mailing_DAO_Component',
375 'unsubscribe_id' => array(
376 'name' => 'unsubscribe_id',
377 'type' => CRM_Utils_Type
::T_INT
,
378 'title' => ts('Mailing Unsubscribe') ,
379 'description' => 'FK to the unsubscribe component.',
380 'FKClassName' => 'CRM_Mailing_DAO_Component',
382 'resubscribe_id' => array(
383 'name' => 'resubscribe_id',
384 'type' => CRM_Utils_Type
::T_INT
,
385 'title' => ts('Mailing Resubscribe') ,
387 'optout_id' => array(
388 'name' => 'optout_id',
389 'type' => CRM_Utils_Type
::T_INT
,
390 'title' => ts('Mailing Opt Out') ,
391 'description' => 'FK to the opt-out component.',
392 'FKClassName' => 'CRM_Mailing_DAO_Component',
396 'type' => CRM_Utils_Type
::T_STRING
,
397 'title' => ts('Mailing Name') ,
398 'description' => 'Mailing Name.',
400 'size' => CRM_Utils_Type
::HUGE
,
405 'mailing_type' => array(
406 'name' => 'mailing_type',
407 'type' => CRM_Utils_Type
::T_STRING
,
408 'title' => ts('Mailing Type') ,
409 'description' => 'differentiate between standalone mailings, A/B tests, and A/B final-winner',
411 'size' => CRM_Utils_Type
::MEDIUM
,
415 'pseudoconstant' => array(
416 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
419 'from_name' => array(
420 'name' => 'from_name',
421 'type' => CRM_Utils_Type
::T_STRING
,
422 'title' => ts('Mailing From Name') ,
423 'description' => 'From Header of mailing',
425 'size' => CRM_Utils_Type
::HUGE
,
430 'from_email' => array(
431 'name' => 'from_email',
432 'type' => CRM_Utils_Type
::T_STRING
,
433 'title' => ts('Mailing From Email') ,
434 'description' => 'From Email of mailing',
436 'size' => CRM_Utils_Type
::HUGE
,
441 'replyto_email' => array(
442 'name' => 'replyto_email',
443 'type' => CRM_Utils_Type
::T_STRING
,
444 'title' => ts('Replyto Email') ,
445 'description' => 'Reply-To Email of mailing',
447 'size' => CRM_Utils_Type
::HUGE
,
454 'type' => CRM_Utils_Type
::T_STRING
,
455 'title' => ts('Subject') ,
456 'description' => 'Subject of mailing',
458 'size' => CRM_Utils_Type
::HUGE
,
463 'body_text' => array(
464 'name' => 'body_text',
465 'type' => CRM_Utils_Type
::T_LONGTEXT
,
466 'title' => ts('Body Text') ,
467 'description' => 'Body of the mailing in text format.',
469 'body_html' => array(
470 'name' => 'body_html',
471 'type' => CRM_Utils_Type
::T_LONGTEXT
,
472 'title' => ts('Body Html') ,
473 'description' => 'Body of the mailing in html format.',
475 'url_tracking' => array(
476 'name' => 'url_tracking',
477 'type' => CRM_Utils_Type
::T_BOOLEAN
,
478 'title' => ts('Url Tracking') ,
479 'description' => 'Should we track URL click-throughs for this mailing?',
481 'type' => 'CheckBox',
484 'forward_replies' => array(
485 'name' => 'forward_replies',
486 'type' => CRM_Utils_Type
::T_BOOLEAN
,
487 'title' => ts('Forward Replies') ,
488 'description' => 'Should we forward replies back to the author?',
490 'type' => 'CheckBox',
493 'auto_responder' => array(
494 'name' => 'auto_responder',
495 'type' => CRM_Utils_Type
::T_BOOLEAN
,
496 'title' => ts('Auto Responder') ,
497 'description' => 'Should we enable the auto-responder?',
499 'type' => 'CheckBox',
502 'open_tracking' => array(
503 'name' => 'open_tracking',
504 'type' => CRM_Utils_Type
::T_BOOLEAN
,
505 'title' => ts('Track Mailing?') ,
506 'description' => 'Should we track when recipients open/read this mailing?',
508 'is_completed' => array(
509 'name' => 'is_completed',
510 'type' => CRM_Utils_Type
::T_BOOLEAN
,
511 'title' => ts('Mailing Completed') ,
512 'description' => 'Has at least one job associated with this mailing finished?',
514 'type' => 'CheckBox',
517 'msg_template_id' => array(
518 'name' => 'msg_template_id',
519 'type' => CRM_Utils_Type
::T_INT
,
520 'title' => ts('Mailing Message Template') ,
521 'description' => 'FK to the message template.',
522 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
524 'override_verp' => array(
525 'name' => 'override_verp',
526 'type' => CRM_Utils_Type
::T_BOOLEAN
,
527 'title' => ts('Override Verp') ,
528 'description' => 'Should we overrite VERP address in Reply-To',
530 'type' => 'CheckBox',
533 'created_id' => array(
534 'name' => 'created_id',
535 'type' => CRM_Utils_Type
::T_INT
,
536 'title' => ts('Mailing Creator') ,
537 'description' => 'FK to Contact ID who first created this mailing',
538 'FKClassName' => 'CRM_Contact_DAO_Contact',
540 'created_date' => array(
541 'name' => 'created_date',
542 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
543 'title' => ts('Mailing Created Date') ,
544 'description' => 'Date and time this mailing was created.',
546 'type' => 'Select Date',
549 'scheduled_id' => array(
550 'name' => 'scheduled_id',
551 'type' => CRM_Utils_Type
::T_INT
,
552 'title' => ts('Scheduled By') ,
553 'description' => 'FK to Contact ID who scheduled this mailing',
554 'FKClassName' => 'CRM_Contact_DAO_Contact',
556 'scheduled_date' => array(
557 'name' => 'scheduled_date',
558 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
559 'title' => ts('Mailing Scheduled Date') ,
560 'description' => 'Date and time this mailing was scheduled.',
562 'approver_id' => array(
563 'name' => 'approver_id',
564 'type' => CRM_Utils_Type
::T_INT
,
565 'title' => ts('Approved By') ,
566 'description' => 'FK to Contact ID who approved this mailing',
567 'FKClassName' => 'CRM_Contact_DAO_Contact',
569 'approval_date' => array(
570 'name' => 'approval_date',
571 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
572 'title' => ts('Mailing Approved Date') ,
573 'description' => 'Date and time this mailing was approved.',
575 'approval_status_id' => array(
576 'name' => 'approval_status_id',
577 'type' => CRM_Utils_Type
::T_INT
,
578 'title' => ts('Approval Status') ,
579 'description' => 'The status of this mailing. Values: none, approved, rejected',
583 'pseudoconstant' => array(
584 'optionGroupName' => 'mail_approval_status',
585 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
588 'approval_note' => array(
589 'name' => 'approval_note',
590 'type' => CRM_Utils_Type
::T_LONGTEXT
,
591 'title' => ts('Approval Note') ,
592 'description' => 'Note behind the decision.',
594 'type' => 'TextArea',
597 'is_archived' => array(
598 'name' => 'is_archived',
599 'type' => CRM_Utils_Type
::T_BOOLEAN
,
600 'title' => ts('Is Mailing Archived?') ,
601 'description' => 'Is this mailing archived?',
603 'type' => 'CheckBox',
606 'visibility' => array(
607 'name' => 'visibility',
608 'type' => CRM_Utils_Type
::T_STRING
,
609 'title' => ts('Mailing Visibility') ,
610 'description' => 'In what context(s) is the mailing contents visible (online viewing)',
612 'size' => CRM_Utils_Type
::BIG
,
613 'default' => 'Public Pages',
617 'pseudoconstant' => array(
618 'callback' => 'CRM_Core_SelectValues::groupVisibility',
621 'campaign_id' => array(
622 'name' => 'campaign_id',
623 'type' => CRM_Utils_Type
::T_INT
,
624 'title' => ts('Mailing Campaign') ,
625 'description' => 'The campaign for which this mailing has been initiated.',
626 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
630 'pseudoconstant' => array(
631 'table' => 'civicrm_campaign',
633 'labelColumn' => 'title',
636 'dedupe_email' => array(
637 'name' => 'dedupe_email',
638 'type' => CRM_Utils_Type
::T_BOOLEAN
,
639 'title' => ts('No Duplicate emails?') ,
640 'description' => 'Remove duplicate emails?',
642 'type' => 'CheckBox',
645 'sms_provider_id' => array(
646 'name' => 'sms_provider_id',
647 'type' => CRM_Utils_Type
::T_INT
,
648 'title' => ts('Mailing SMS Provider') ,
649 'FKClassName' => 'CRM_SMS_DAO_Provider',
656 'type' => CRM_Utils_Type
::T_STRING
,
657 'title' => ts('Mailing Hash') ,
658 'description' => 'Key for validating requests related to this mailing.',
660 'size' => CRM_Utils_Type
::TWELVE
,
662 'location_type_id' => array(
663 'name' => 'location_type_id',
664 'type' => CRM_Utils_Type
::T_INT
,
665 'title' => ts('Location Type') ,
666 'description' => 'With email_selection_method, determines which email address to use',
667 'FKClassName' => 'CRM_Core_DAO_LocationType',
668 'pseudoconstant' => array(
669 'table' => 'civicrm_location_type',
671 'labelColumn' => 'display_name',
674 'email_selection_method' => array(
675 'name' => 'email_selection_method',
676 'type' => CRM_Utils_Type
::T_STRING
,
677 'title' => ts('Email Selection Method') ,
678 'description' => 'With location_type_id, determine how to choose the email address to use.',
680 'size' => CRM_Utils_Type
::MEDIUM
,
681 'default' => 'automatic',
682 'pseudoconstant' => array(
683 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
688 return self
::$_fields;
691 * Return a mapping from field-name to the corresponding key (as used in fields()).
694 * Array(string $name => string $uniqueName).
696 static function &fieldKeys() {
697 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
698 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
700 return Civi
::$statics[__CLASS__
]['fieldKeys'];
703 * Returns the names of this table
707 static function getTableName() {
708 return self
::$_tableName;
711 * Returns if this table needs to be logged
719 * Returns the list of fields that can be imported
721 * @param bool $prefix
725 static function &import($prefix = false) {
726 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing', $prefix, array());
730 * Returns the list of fields that can be exported
732 * @param bool $prefix
736 static function &export($prefix = false) {
737 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing', $prefix, array());