Merge pull request #9616 from ErichBSchulz/feature/drupal_boot_no_exit
[civicrm-core.git] / CRM / Mailing / DAO / Mailing.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
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. |
13| |
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. |
18| |
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+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Mailing/Mailing.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:3711bcf18e92336fdc0a4c81af169de6)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Mailing_DAO_Mailing constructor.
39 */
e501603b
TO
40class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_mailing';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * Which site is this mailing for
60 *
61 * @var int unsigned
62 */
63 public $domain_id;
64 /**
65 * FK to the header component.
66 *
67 * @var int unsigned
68 */
69 public $header_id;
70 /**
71 * FK to the footer component.
72 *
73 * @var int unsigned
74 */
75 public $footer_id;
76 /**
77 * FK to the auto-responder component.
78 *
79 * @var int unsigned
80 */
81 public $reply_id;
82 /**
83 * FK to the unsubscribe component.
84 *
85 * @var int unsigned
86 */
87 public $unsubscribe_id;
88 /**
89 *
90 * @var int unsigned
91 */
92 public $resubscribe_id;
93 /**
94 * FK to the opt-out component.
95 *
96 * @var int unsigned
97 */
98 public $optout_id;
99 /**
100 * Mailing Name.
101 *
102 * @var string
103 */
104 public $name;
105 /**
106 * differentiate between standalone mailings, A/B tests, and A/B final-winner
107 *
108 * @var string
109 */
110 public $mailing_type;
111 /**
112 * From Header of mailing
113 *
114 * @var string
115 */
116 public $from_name;
117 /**
118 * From Email of mailing
119 *
120 * @var string
121 */
122 public $from_email;
123 /**
124 * Reply-To Email of mailing
125 *
126 * @var string
127 */
128 public $replyto_email;
703875d8
TO
129 /**
130 * The language/processing system used for email templates.
131 *
132 * @var string
133 */
134 public $template_type;
135 /**
136 * Advanced options used by the email templating system. (JSON encoded)
137 *
138 * @var longtext
139 */
140 public $template_options;
e501603b
TO
141 /**
142 * Subject of mailing
143 *
144 * @var string
145 */
146 public $subject;
147 /**
148 * Body of the mailing in text format.
149 *
150 * @var longtext
151 */
152 public $body_text;
153 /**
154 * Body of the mailing in html format.
155 *
156 * @var longtext
157 */
158 public $body_html;
159 /**
160 * Should we track URL click-throughs for this mailing?
161 *
162 * @var boolean
163 */
164 public $url_tracking;
165 /**
166 * Should we forward replies back to the author?
167 *
168 * @var boolean
169 */
170 public $forward_replies;
171 /**
172 * Should we enable the auto-responder?
173 *
174 * @var boolean
175 */
176 public $auto_responder;
177 /**
178 * Should we track when recipients open/read this mailing?
179 *
180 * @var boolean
181 */
182 public $open_tracking;
183 /**
184 * Has at least one job associated with this mailing finished?
185 *
186 * @var boolean
187 */
188 public $is_completed;
189 /**
190 * FK to the message template.
191 *
192 * @var int unsigned
193 */
194 public $msg_template_id;
195 /**
196 * Should we overrite VERP address in Reply-To
197 *
198 * @var boolean
199 */
200 public $override_verp;
201 /**
202 * FK to Contact ID who first created this mailing
203 *
204 * @var int unsigned
205 */
206 public $created_id;
207 /**
208 * Date and time this mailing was created.
209 *
210 * @var datetime
211 */
212 public $created_date;
213 /**
214 * FK to Contact ID who scheduled this mailing
215 *
216 * @var int unsigned
217 */
218 public $scheduled_id;
219 /**
220 * Date and time this mailing was scheduled.
221 *
222 * @var datetime
223 */
224 public $scheduled_date;
225 /**
226 * FK to Contact ID who approved this mailing
227 *
228 * @var int unsigned
229 */
230 public $approver_id;
231 /**
232 * Date and time this mailing was approved.
233 *
234 * @var datetime
235 */
236 public $approval_date;
237 /**
238 * The status of this mailing. Values: none, approved, rejected
239 *
240 * @var int unsigned
241 */
242 public $approval_status_id;
243 /**
244 * Note behind the decision.
245 *
246 * @var longtext
247 */
248 public $approval_note;
249 /**
250 * Is this mailing archived?
251 *
252 * @var boolean
253 */
254 public $is_archived;
255 /**
256 * In what context(s) is the mailing contents visible (online viewing)
257 *
258 * @var string
259 */
260 public $visibility;
261 /**
262 * The campaign for which this mailing has been initiated.
263 *
264 * @var int unsigned
265 */
266 public $campaign_id;
267 /**
268 * Remove duplicate emails?
269 *
270 * @var boolean
271 */
272 public $dedupe_email;
273 /**
274 *
275 * @var int unsigned
276 */
277 public $sms_provider_id;
278 /**
279 * Key for validating requests related to this mailing.
280 *
281 * @var string
282 */
283 public $hash;
284 /**
285 * With email_selection_method, determines which email address to use
286 *
287 * @var int unsigned
288 */
289 public $location_type_id;
290 /**
291 * With location_type_id, determine how to choose the email address to use.
292 *
293 * @var string
294 */
295 public $email_selection_method;
10d3f7d3
SV
296 /**
297 * Language of the content of the mailing. Useful for tokens.
298 *
299 * @var string
300 */
301 public $language;
e501603b 302 /**
f41f0342 303 * Class constructor.
e501603b
TO
304 */
305 function __construct() {
306 $this->__table = 'civicrm_mailing';
307 parent::__construct();
308 }
309 /**
f41f0342 310 * Returns foreign keys and entity references.
e501603b
TO
311 *
312 * @return array
313 * [CRM_Core_Reference_Interface]
314 */
315 static function getReferenceColumns() {
346aaaba
TO
316 if (!isset(Civi::$statics[__CLASS__]['links'])) {
317 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
318 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
319 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'header_id', 'civicrm_mailing_component', 'id');
320 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'footer_id', 'civicrm_mailing_component', 'id');
321 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'reply_id', 'civicrm_mailing_component', 'id');
322 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'unsubscribe_id', 'civicrm_mailing_component', 'id');
323 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'optout_id', 'civicrm_mailing_component', 'id');
324 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'msg_template_id', 'civicrm_msg_template', 'id');
325 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
326 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'scheduled_id', 'civicrm_contact', 'id');
327 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'approver_id', 'civicrm_contact', 'id');
328 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
329 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'sms_provider_id', 'civicrm_sms_provider', 'id');
330 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id');
331 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 332 }
346aaaba 333 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
334 }
335 /**
336 * Returns all the column names of this table
337 *
338 * @return array
339 */
340 static function &fields() {
346aaaba
TO
341 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
342 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
343 'id' => array(
344 'name' => 'id',
345 'type' => CRM_Utils_Type::T_INT,
346 'title' => ts('Mailing ID') ,
347 'required' => true,
522a26c9 348 'table_name' => 'civicrm_mailing',
349 'entity' => 'Mailing',
350 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
351 ) ,
352 'domain_id' => array(
353 'name' => 'domain_id',
354 'type' => CRM_Utils_Type::T_INT,
355 'title' => ts('Mailing Domain') ,
356 'description' => 'Which site is this mailing for',
522a26c9 357 'table_name' => 'civicrm_mailing',
358 'entity' => 'Mailing',
359 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
360 'FKClassName' => 'CRM_Core_DAO_Domain',
361 'pseudoconstant' => array(
362 'table' => 'civicrm_domain',
363 'keyColumn' => 'id',
364 'labelColumn' => 'name',
365 )
366 ) ,
367 'header_id' => array(
368 'name' => 'header_id',
369 'type' => CRM_Utils_Type::T_INT,
370 'title' => ts('Mailing Header') ,
371 'description' => 'FK to the header component.',
522a26c9 372 'table_name' => 'civicrm_mailing',
373 'entity' => 'Mailing',
374 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
375 'FKClassName' => 'CRM_Mailing_DAO_Component',
376 ) ,
377 'footer_id' => array(
378 'name' => 'footer_id',
379 'type' => CRM_Utils_Type::T_INT,
380 'title' => ts('Mailing Footer') ,
381 'description' => 'FK to the footer component.',
522a26c9 382 'table_name' => 'civicrm_mailing',
383 'entity' => 'Mailing',
384 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
385 'FKClassName' => 'CRM_Mailing_DAO_Component',
386 ) ,
387 'reply_id' => array(
388 'name' => 'reply_id',
389 'type' => CRM_Utils_Type::T_INT,
390 'title' => ts('Mailing Reply') ,
391 'description' => 'FK to the auto-responder component.',
522a26c9 392 'table_name' => 'civicrm_mailing',
393 'entity' => 'Mailing',
394 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
395 'FKClassName' => 'CRM_Mailing_DAO_Component',
396 ) ,
397 'unsubscribe_id' => array(
398 'name' => 'unsubscribe_id',
399 'type' => CRM_Utils_Type::T_INT,
400 'title' => ts('Mailing Unsubscribe') ,
401 'description' => 'FK to the unsubscribe component.',
522a26c9 402 'table_name' => 'civicrm_mailing',
403 'entity' => 'Mailing',
404 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
405 'FKClassName' => 'CRM_Mailing_DAO_Component',
406 ) ,
407 'resubscribe_id' => array(
408 'name' => 'resubscribe_id',
409 'type' => CRM_Utils_Type::T_INT,
410 'title' => ts('Mailing Resubscribe') ,
522a26c9 411 'table_name' => 'civicrm_mailing',
412 'entity' => 'Mailing',
413 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
414 ) ,
415 'optout_id' => array(
416 'name' => 'optout_id',
417 'type' => CRM_Utils_Type::T_INT,
418 'title' => ts('Mailing Opt Out') ,
419 'description' => 'FK to the opt-out component.',
522a26c9 420 'table_name' => 'civicrm_mailing',
421 'entity' => 'Mailing',
422 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
423 'FKClassName' => 'CRM_Mailing_DAO_Component',
424 ) ,
425 'name' => array(
426 'name' => 'name',
427 'type' => CRM_Utils_Type::T_STRING,
428 'title' => ts('Mailing Name') ,
429 'description' => 'Mailing Name.',
430 'maxlength' => 128,
431 'size' => CRM_Utils_Type::HUGE,
522a26c9 432 'table_name' => 'civicrm_mailing',
433 'entity' => 'Mailing',
434 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
435 'html' => array(
436 'type' => 'Text',
437 ) ,
438 ) ,
439 'mailing_type' => array(
440 'name' => 'mailing_type',
441 'type' => CRM_Utils_Type::T_STRING,
442 'title' => ts('Mailing Type') ,
443 'description' => 'differentiate between standalone mailings, A/B tests, and A/B final-winner',
444 'maxlength' => 32,
445 'size' => CRM_Utils_Type::MEDIUM,
522a26c9 446 'table_name' => 'civicrm_mailing',
447 'entity' => 'Mailing',
448 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
449 'html' => array(
450 'type' => 'Select',
451 ) ,
452 'pseudoconstant' => array(
453 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
454 )
455 ) ,
456 'from_name' => array(
457 'name' => 'from_name',
458 'type' => CRM_Utils_Type::T_STRING,
459 'title' => ts('Mailing From Name') ,
460 'description' => 'From Header of mailing',
461 'maxlength' => 128,
462 'size' => CRM_Utils_Type::HUGE,
522a26c9 463 'table_name' => 'civicrm_mailing',
464 'entity' => 'Mailing',
465 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
466 'html' => array(
467 'type' => 'Text',
468 ) ,
469 ) ,
470 'from_email' => array(
471 'name' => 'from_email',
472 'type' => CRM_Utils_Type::T_STRING,
473 'title' => ts('Mailing From Email') ,
474 'description' => 'From Email of mailing',
475 'maxlength' => 128,
476 'size' => CRM_Utils_Type::HUGE,
522a26c9 477 'table_name' => 'civicrm_mailing',
478 'entity' => 'Mailing',
479 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
480 'html' => array(
481 'type' => 'Text',
482 ) ,
483 ) ,
484 'replyto_email' => array(
485 'name' => 'replyto_email',
486 'type' => CRM_Utils_Type::T_STRING,
487 'title' => ts('Replyto Email') ,
488 'description' => 'Reply-To Email of mailing',
489 'maxlength' => 128,
490 'size' => CRM_Utils_Type::HUGE,
522a26c9 491 'table_name' => 'civicrm_mailing',
492 'entity' => 'Mailing',
493 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
494 'html' => array(
495 'type' => 'Text',
496 ) ,
497 ) ,
703875d8
TO
498 'template_type' => array(
499 'name' => 'template_type',
500 'type' => CRM_Utils_Type::T_STRING,
501 'title' => ts('Template Type') ,
502 'description' => 'The language/processing system used for email templates.',
503 'required' => true,
504 'maxlength' => 64,
505 'size' => CRM_Utils_Type::BIG,
506 'default' => 'traditional',
522a26c9 507 'table_name' => 'civicrm_mailing',
508 'entity' => 'Mailing',
509 'bao' => 'CRM_Mailing_BAO_Mailing',
703875d8
TO
510 'pseudoconstant' => array(
511 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
512 )
513 ) ,
514 'template_options' => array(
515 'name' => 'template_options',
516 'type' => CRM_Utils_Type::T_LONGTEXT,
517 'title' => ts('Template Options (JSON)') ,
518 'description' => 'Advanced options used by the email templating system. (JSON encoded)',
522a26c9 519 'table_name' => 'civicrm_mailing',
520 'entity' => 'Mailing',
521 'bao' => 'CRM_Mailing_BAO_Mailing',
703875d8 522 ) ,
e501603b
TO
523 'subject' => array(
524 'name' => 'subject',
525 'type' => CRM_Utils_Type::T_STRING,
526 'title' => ts('Subject') ,
527 'description' => 'Subject of mailing',
528 'maxlength' => 128,
529 'size' => CRM_Utils_Type::HUGE,
522a26c9 530 'table_name' => 'civicrm_mailing',
531 'entity' => 'Mailing',
532 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
533 'html' => array(
534 'type' => 'Text',
535 ) ,
536 ) ,
537 'body_text' => array(
538 'name' => 'body_text',
539 'type' => CRM_Utils_Type::T_LONGTEXT,
540 'title' => ts('Body Text') ,
541 'description' => 'Body of the mailing in text format.',
522a26c9 542 'table_name' => 'civicrm_mailing',
543 'entity' => 'Mailing',
544 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
545 ) ,
546 'body_html' => array(
547 'name' => 'body_html',
548 'type' => CRM_Utils_Type::T_LONGTEXT,
549 'title' => ts('Body Html') ,
550 'description' => 'Body of the mailing in html format.',
522a26c9 551 'table_name' => 'civicrm_mailing',
552 'entity' => 'Mailing',
553 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
554 ) ,
555 'url_tracking' => array(
556 'name' => 'url_tracking',
557 'type' => CRM_Utils_Type::T_BOOLEAN,
558 'title' => ts('Url Tracking') ,
559 'description' => 'Should we track URL click-throughs for this mailing?',
522a26c9 560 'table_name' => 'civicrm_mailing',
561 'entity' => 'Mailing',
562 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
563 'html' => array(
564 'type' => 'CheckBox',
565 ) ,
566 ) ,
567 'forward_replies' => array(
568 'name' => 'forward_replies',
569 'type' => CRM_Utils_Type::T_BOOLEAN,
570 'title' => ts('Forward Replies') ,
571 'description' => 'Should we forward replies back to the author?',
522a26c9 572 'table_name' => 'civicrm_mailing',
573 'entity' => 'Mailing',
574 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
575 'html' => array(
576 'type' => 'CheckBox',
577 ) ,
578 ) ,
579 'auto_responder' => array(
580 'name' => 'auto_responder',
581 'type' => CRM_Utils_Type::T_BOOLEAN,
582 'title' => ts('Auto Responder') ,
583 'description' => 'Should we enable the auto-responder?',
522a26c9 584 'table_name' => 'civicrm_mailing',
585 'entity' => 'Mailing',
586 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
587 'html' => array(
588 'type' => 'CheckBox',
589 ) ,
590 ) ,
591 'open_tracking' => array(
592 'name' => 'open_tracking',
593 'type' => CRM_Utils_Type::T_BOOLEAN,
594 'title' => ts('Track Mailing?') ,
595 'description' => 'Should we track when recipients open/read this mailing?',
522a26c9 596 'table_name' => 'civicrm_mailing',
597 'entity' => 'Mailing',
598 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
599 ) ,
600 'is_completed' => array(
601 'name' => 'is_completed',
602 'type' => CRM_Utils_Type::T_BOOLEAN,
603 'title' => ts('Mailing Completed') ,
604 'description' => 'Has at least one job associated with this mailing finished?',
522a26c9 605 'table_name' => 'civicrm_mailing',
606 'entity' => 'Mailing',
607 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
608 'html' => array(
609 'type' => 'CheckBox',
610 ) ,
611 ) ,
612 'msg_template_id' => array(
613 'name' => 'msg_template_id',
614 'type' => CRM_Utils_Type::T_INT,
615 'title' => ts('Mailing Message Template') ,
616 'description' => 'FK to the message template.',
522a26c9 617 'table_name' => 'civicrm_mailing',
618 'entity' => 'Mailing',
619 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
620 'FKClassName' => 'CRM_Core_DAO_MessageTemplate',
621 ) ,
622 'override_verp' => array(
623 'name' => 'override_verp',
624 'type' => CRM_Utils_Type::T_BOOLEAN,
625 'title' => ts('Override Verp') ,
626 'description' => 'Should we overrite VERP address in Reply-To',
522a26c9 627 'table_name' => 'civicrm_mailing',
628 'entity' => 'Mailing',
629 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
630 'html' => array(
631 'type' => 'CheckBox',
632 ) ,
633 ) ,
634 'created_id' => array(
635 'name' => 'created_id',
636 'type' => CRM_Utils_Type::T_INT,
637 'title' => ts('Mailing Creator') ,
638 'description' => 'FK to Contact ID who first created this mailing',
522a26c9 639 'table_name' => 'civicrm_mailing',
640 'entity' => 'Mailing',
641 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
642 'FKClassName' => 'CRM_Contact_DAO_Contact',
643 ) ,
644 'created_date' => array(
645 'name' => 'created_date',
646 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
647 'title' => ts('Mailing Created Date') ,
648 'description' => 'Date and time this mailing was created.',
522a26c9 649 'table_name' => 'civicrm_mailing',
650 'entity' => 'Mailing',
651 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
652 'html' => array(
653 'type' => 'Select Date',
654 ) ,
655 ) ,
656 'scheduled_id' => array(
657 'name' => 'scheduled_id',
658 'type' => CRM_Utils_Type::T_INT,
659 'title' => ts('Scheduled By') ,
660 'description' => 'FK to Contact ID who scheduled this mailing',
522a26c9 661 'table_name' => 'civicrm_mailing',
662 'entity' => 'Mailing',
663 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
664 'FKClassName' => 'CRM_Contact_DAO_Contact',
665 ) ,
666 'scheduled_date' => array(
667 'name' => 'scheduled_date',
668 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
669 'title' => ts('Mailing Scheduled Date') ,
670 'description' => 'Date and time this mailing was scheduled.',
522a26c9 671 'table_name' => 'civicrm_mailing',
672 'entity' => 'Mailing',
673 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
674 ) ,
675 'approver_id' => array(
676 'name' => 'approver_id',
677 'type' => CRM_Utils_Type::T_INT,
678 'title' => ts('Approved By') ,
679 'description' => 'FK to Contact ID who approved this mailing',
522a26c9 680 'table_name' => 'civicrm_mailing',
681 'entity' => 'Mailing',
682 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
683 'FKClassName' => 'CRM_Contact_DAO_Contact',
684 ) ,
685 'approval_date' => array(
686 'name' => 'approval_date',
687 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
688 'title' => ts('Mailing Approved Date') ,
689 'description' => 'Date and time this mailing was approved.',
522a26c9 690 'table_name' => 'civicrm_mailing',
691 'entity' => 'Mailing',
692 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
693 ) ,
694 'approval_status_id' => array(
695 'name' => 'approval_status_id',
696 'type' => CRM_Utils_Type::T_INT,
697 'title' => ts('Approval Status') ,
698 'description' => 'The status of this mailing. Values: none, approved, rejected',
522a26c9 699 'table_name' => 'civicrm_mailing',
700 'entity' => 'Mailing',
701 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
702 'html' => array(
703 'type' => 'Select',
704 ) ,
705 'pseudoconstant' => array(
706 'optionGroupName' => 'mail_approval_status',
707 'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
708 )
709 ) ,
710 'approval_note' => array(
711 'name' => 'approval_note',
712 'type' => CRM_Utils_Type::T_LONGTEXT,
713 'title' => ts('Approval Note') ,
714 'description' => 'Note behind the decision.',
522a26c9 715 'table_name' => 'civicrm_mailing',
716 'entity' => 'Mailing',
717 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
718 'html' => array(
719 'type' => 'TextArea',
720 ) ,
721 ) ,
722 'is_archived' => array(
723 'name' => 'is_archived',
724 'type' => CRM_Utils_Type::T_BOOLEAN,
725 'title' => ts('Is Mailing Archived?') ,
726 'description' => 'Is this mailing archived?',
522a26c9 727 'table_name' => 'civicrm_mailing',
728 'entity' => 'Mailing',
729 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
730 'html' => array(
731 'type' => 'CheckBox',
732 ) ,
733 ) ,
734 'visibility' => array(
735 'name' => 'visibility',
736 'type' => CRM_Utils_Type::T_STRING,
737 'title' => ts('Mailing Visibility') ,
738 'description' => 'In what context(s) is the mailing contents visible (online viewing)',
739 'maxlength' => 40,
740 'size' => CRM_Utils_Type::BIG,
741 'default' => 'Public Pages',
522a26c9 742 'table_name' => 'civicrm_mailing',
743 'entity' => 'Mailing',
744 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
745 'html' => array(
746 'type' => 'Select',
747 ) ,
748 'pseudoconstant' => array(
749 'callback' => 'CRM_Core_SelectValues::groupVisibility',
750 )
751 ) ,
752 'campaign_id' => array(
753 'name' => 'campaign_id',
754 'type' => CRM_Utils_Type::T_INT,
755 'title' => ts('Mailing Campaign') ,
756 'description' => 'The campaign for which this mailing has been initiated.',
522a26c9 757 'table_name' => 'civicrm_mailing',
758 'entity' => 'Mailing',
759 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
760 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
761 'html' => array(
762 'type' => 'Select',
763 ) ,
764 'pseudoconstant' => array(
765 'table' => 'civicrm_campaign',
766 'keyColumn' => 'id',
767 'labelColumn' => 'title',
768 )
769 ) ,
770 'dedupe_email' => array(
771 'name' => 'dedupe_email',
772 'type' => CRM_Utils_Type::T_BOOLEAN,
773 'title' => ts('No Duplicate emails?') ,
774 'description' => 'Remove duplicate emails?',
522a26c9 775 'table_name' => 'civicrm_mailing',
776 'entity' => 'Mailing',
777 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
778 'html' => array(
779 'type' => 'CheckBox',
780 ) ,
781 ) ,
782 'sms_provider_id' => array(
783 'name' => 'sms_provider_id',
784 'type' => CRM_Utils_Type::T_INT,
785 'title' => ts('Mailing SMS Provider') ,
522a26c9 786 'table_name' => 'civicrm_mailing',
787 'entity' => 'Mailing',
788 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
789 'FKClassName' => 'CRM_SMS_DAO_Provider',
790 'html' => array(
791 'type' => 'Select',
792 ) ,
793 ) ,
794 'hash' => array(
795 'name' => 'hash',
796 'type' => CRM_Utils_Type::T_STRING,
797 'title' => ts('Mailing Hash') ,
798 'description' => 'Key for validating requests related to this mailing.',
799 'maxlength' => 16,
800 'size' => CRM_Utils_Type::TWELVE,
522a26c9 801 'table_name' => 'civicrm_mailing',
802 'entity' => 'Mailing',
803 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
804 ) ,
805 'location_type_id' => array(
806 'name' => 'location_type_id',
807 'type' => CRM_Utils_Type::T_INT,
808 'title' => ts('Location Type') ,
809 'description' => 'With email_selection_method, determines which email address to use',
522a26c9 810 'table_name' => 'civicrm_mailing',
811 'entity' => 'Mailing',
812 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
813 'FKClassName' => 'CRM_Core_DAO_LocationType',
814 'pseudoconstant' => array(
815 'table' => 'civicrm_location_type',
816 'keyColumn' => 'id',
817 'labelColumn' => 'display_name',
818 )
819 ) ,
820 'email_selection_method' => array(
821 'name' => 'email_selection_method',
822 'type' => CRM_Utils_Type::T_STRING,
823 'title' => ts('Email Selection Method') ,
824 'description' => 'With location_type_id, determine how to choose the email address to use.',
825 'maxlength' => 20,
826 'size' => CRM_Utils_Type::MEDIUM,
827 'default' => 'automatic',
522a26c9 828 'table_name' => 'civicrm_mailing',
829 'entity' => 'Mailing',
830 'bao' => 'CRM_Mailing_BAO_Mailing',
e501603b
TO
831 'pseudoconstant' => array(
832 'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
833 )
834 ) ,
10d3f7d3
SV
835 'language' => array(
836 'name' => 'language',
837 'type' => CRM_Utils_Type::T_STRING,
838 'title' => ts('Mailing Language') ,
839 'description' => 'Language of the content of the mailing. Useful for tokens.',
840 'maxlength' => 5,
841 'size' => CRM_Utils_Type::SIX,
522a26c9 842 'table_name' => 'civicrm_mailing',
843 'entity' => 'Mailing',
844 'bao' => 'CRM_Mailing_BAO_Mailing',
10d3f7d3
SV
845 'html' => array(
846 'type' => 'Select',
847 ) ,
848 'pseudoconstant' => array(
849 'optionGroupName' => 'languages',
850 'keyColumn' => 'name',
851 'optionEditPath' => 'civicrm/admin/options/languages',
852 )
853 ) ,
e501603b 854 );
346aaaba 855 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 856 }
346aaaba 857 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
858 }
859 /**
bd8e0b14 860 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
861 *
862 * @return array
bd8e0b14 863 * Array(string $name => string $uniqueName).
e501603b
TO
864 */
865 static function &fieldKeys() {
bd8e0b14
TO
866 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
867 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 868 }
bd8e0b14 869 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
870 }
871 /**
872 * Returns the names of this table
873 *
874 * @return string
875 */
876 static function getTableName() {
877 return self::$_tableName;
878 }
879 /**
880 * Returns if this table needs to be logged
881 *
882 * @return boolean
883 */
884 function getLog() {
885 return self::$_log;
886 }
887 /**
888 * Returns the list of fields that can be imported
889 *
890 * @param bool $prefix
891 *
892 * @return array
893 */
894 static function &import($prefix = false) {
60808919
TO
895 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing', $prefix, array());
896 return $r;
e501603b
TO
897 }
898 /**
899 * Returns the list of fields that can be exported
900 *
901 * @param bool $prefix
902 *
903 * @return array
904 */
905 static function &export($prefix = false) {
60808919
TO
906 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing', $prefix, array());
907 return $r;
e501603b
TO
908 }
909}