Merge pull request #19075 from colemanw/searchable
[civicrm-core.git] / CRM / Core / DAO / MailSettings.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/MailSettings.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
d31fb4e3 9 * (GenCodeChecksum:a362c7cd24732b55a96cd4e526d29102)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MailSettings entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.2';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_mail_settings';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b
TO
33 /**
34 * primary key
35 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * Which Domain is this match entry for
42 *
e6ca0a57 43 * @var int
e501603b
TO
44 */
45 public $domain_id;
c3fc2621 46
e501603b
TO
47 /**
48 * name of this group of settings
49 *
50 * @var string
51 */
52 public $name;
c3fc2621 53
e501603b
TO
54 /**
55 * whether this is the default set of settings for this domain
56 *
e6ca0a57 57 * @var bool
e501603b
TO
58 */
59 public $is_default;
c3fc2621 60
e501603b
TO
61 /**
62 * email address domain (the part after @)
63 *
64 * @var string
65 */
66 public $domain;
c3fc2621 67
e501603b
TO
68 /**
69 * optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)
70 *
71 * @var string
72 */
73 public $localpart;
c3fc2621 74
e501603b
TO
75 /**
76 * contents of the Return-Path header
77 *
78 * @var string
79 */
80 public $return_path;
c3fc2621 81
e501603b
TO
82 /**
83 * name of the protocol to use for polling (like IMAP, POP3 or Maildir)
84 *
85 * @var string
86 */
87 public $protocol;
c3fc2621 88
e501603b
TO
89 /**
90 * server to use when polling
91 *
92 * @var string
93 */
94 public $server;
c3fc2621 95
e501603b
TO
96 /**
97 * port to use when polling
98 *
e6ca0a57 99 * @var int
e501603b
TO
100 */
101 public $port;
c3fc2621 102
e501603b
TO
103 /**
104 * username to use when polling
105 *
106 * @var string
107 */
108 public $username;
c3fc2621 109
e501603b
TO
110 /**
111 * password to use when polling
112 *
113 * @var string
114 */
115 public $password;
c3fc2621 116
e501603b
TO
117 /**
118 * whether to use SSL or not
119 *
e6ca0a57 120 * @var bool
e501603b
TO
121 */
122 public $is_ssl;
c3fc2621 123
e501603b
TO
124 /**
125 * folder to poll from when using IMAP, path to poll from when using Maildir, etc.
126 *
127 * @var string
128 */
129 public $source;
c3fc2621 130
040073c9
CW
131 /**
132 * Name of status to use when creating email to activity.
133 *
134 * @var string
135 */
136 public $activity_status;
c3fc2621 137
2f0fd07c
SL
138 /**
139 * Enabling this option will have CiviCRM skip any emails that do not have the Case ID or Case Hash so that the system will only process emails that can be placed on case records. Any emails that are not processed will be moved to the ignored folder.
140 *
141 * @var bool
142 */
143 public $is_non_case_email_skipped;
144
145 /**
146 * @var bool
147 */
148 public $is_contact_creation_disabled_if_no_match;
149
e501603b 150 /**
f41f0342 151 * Class constructor.
e501603b 152 */
c3fc2621 153 public function __construct() {
e501603b
TO
154 $this->__table = 'civicrm_mail_settings';
155 parent::__construct();
156 }
c3fc2621 157
449c4e6b
CW
158 /**
159 * Returns localized title of this entity.
7b66c3b5
AH
160 *
161 * @param bool $plural
162 * Whether to return the plural version of the title.
449c4e6b 163 */
7b66c3b5
AH
164 public static function getEntityTitle($plural = FALSE) {
165 return $plural ? ts('Mail Settingses') : ts('Mail Settings');
449c4e6b
CW
166 }
167
e501603b 168 /**
f41f0342 169 * Returns foreign keys and entity references.
e501603b
TO
170 *
171 * @return array
172 * [CRM_Core_Reference_Interface]
173 */
c3fc2621 174 public static function getReferenceColumns() {
346aaaba 175 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 176 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 177 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
346aaaba 178 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 179 }
346aaaba 180 return Civi::$statics[__CLASS__]['links'];
e501603b 181 }
c3fc2621 182
e501603b
TO
183 /**
184 * Returns all the column names of this table
185 *
186 * @return array
187 */
c3fc2621 188 public static function &fields() {
346aaaba 189 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
190 Civi::$statics[__CLASS__]['fields'] = [
191 'id' => [
e501603b
TO
192 'name' => 'id',
193 'type' => CRM_Utils_Type::T_INT,
c3fc2621 194 'title' => ts('Mail Settings ID'),
215b423e 195 'description' => ts('primary key'),
c3fc2621 196 'required' => TRUE,
a36434b9 197 'where' => 'civicrm_mail_settings.id',
522a26c9 198 'table_name' => 'civicrm_mail_settings',
199 'entity' => 'MailSettings',
200 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 201 'localizable' => 0,
a9d0587b 202 'add' => '2.2',
c3fc2621
CW
203 ],
204 'domain_id' => [
e501603b
TO
205 'name' => 'domain_id',
206 'type' => CRM_Utils_Type::T_INT,
c3fc2621 207 'title' => ts('Mail Settings Domain'),
215b423e 208 'description' => ts('Which Domain is this match entry for'),
c3fc2621 209 'required' => TRUE,
a36434b9 210 'where' => 'civicrm_mail_settings.domain_id',
522a26c9 211 'table_name' => 'civicrm_mail_settings',
212 'entity' => 'MailSettings',
213 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 214 'localizable' => 0,
e501603b 215 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 216 'pseudoconstant' => [
e501603b
TO
217 'table' => 'civicrm_domain',
218 'keyColumn' => 'id',
219 'labelColumn' => 'name',
e6ca0a57 220 ],
a9d0587b 221 'add' => '3.1',
c3fc2621
CW
222 ],
223 'name' => [
e501603b
TO
224 'name' => 'name',
225 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 226 'title' => ts('Mail Settings Name'),
215b423e 227 'description' => ts('name of this group of settings'),
e501603b
TO
228 'maxlength' => 255,
229 'size' => CRM_Utils_Type::HUGE,
a36434b9 230 'where' => 'civicrm_mail_settings.name',
522a26c9 231 'table_name' => 'civicrm_mail_settings',
232 'entity' => 'MailSettings',
233 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 234 'localizable' => 0,
a9d0587b 235 'add' => '2.2',
c3fc2621
CW
236 ],
237 'is_default' => [
e501603b
TO
238 'name' => 'is_default',
239 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 240 'title' => ts('Is Default Mail Settings?'),
215b423e 241 'description' => ts('whether this is the default set of settings for this domain'),
a36434b9 242 'where' => 'civicrm_mail_settings.is_default',
522a26c9 243 'table_name' => 'civicrm_mail_settings',
244 'entity' => 'MailSettings',
245 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 246 'localizable' => 0,
a9d0587b 247 'add' => '2.2',
c3fc2621
CW
248 ],
249 'domain' => [
e501603b
TO
250 'name' => 'domain',
251 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 252 'title' => ts('email Domain'),
215b423e 253 'description' => ts('email address domain (the part after @)'),
e501603b
TO
254 'maxlength' => 255,
255 'size' => CRM_Utils_Type::HUGE,
a36434b9 256 'where' => 'civicrm_mail_settings.domain',
522a26c9 257 'table_name' => 'civicrm_mail_settings',
258 'entity' => 'MailSettings',
259 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 260 'localizable' => 0,
a9d0587b 261 'add' => '2.2',
c3fc2621
CW
262 ],
263 'localpart' => [
e501603b
TO
264 'name' => 'localpart',
265 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 266 'title' => ts('email Local Part'),
215b423e 267 'description' => ts('optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)'),
e501603b
TO
268 'maxlength' => 255,
269 'size' => CRM_Utils_Type::HUGE,
a36434b9 270 'where' => 'civicrm_mail_settings.localpart',
522a26c9 271 'table_name' => 'civicrm_mail_settings',
272 'entity' => 'MailSettings',
273 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 274 'localizable' => 0,
a9d0587b 275 'add' => '2.2',
c3fc2621
CW
276 ],
277 'return_path' => [
e501603b
TO
278 'name' => 'return_path',
279 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 280 'title' => ts('Return Path'),
215b423e 281 'description' => ts('contents of the Return-Path header'),
e501603b
TO
282 'maxlength' => 255,
283 'size' => CRM_Utils_Type::HUGE,
a36434b9 284 'where' => 'civicrm_mail_settings.return_path',
522a26c9 285 'table_name' => 'civicrm_mail_settings',
286 'entity' => 'MailSettings',
287 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 288 'localizable' => 0,
a9d0587b 289 'add' => '2.2',
c3fc2621
CW
290 ],
291 'protocol' => [
e501603b
TO
292 'name' => 'protocol',
293 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 294 'title' => ts('Protocol'),
215b423e 295 'description' => ts('name of the protocol to use for polling (like IMAP, POP3 or Maildir)'),
e501603b
TO
296 'maxlength' => 255,
297 'size' => CRM_Utils_Type::HUGE,
a36434b9 298 'where' => 'civicrm_mail_settings.protocol',
522a26c9 299 'table_name' => 'civicrm_mail_settings',
300 'entity' => 'MailSettings',
301 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 302 'localizable' => 0,
c3fc2621 303 'html' => [
e501603b 304 'type' => 'Select',
c3fc2621
CW
305 ],
306 'pseudoconstant' => [
e501603b
TO
307 'optionGroupName' => 'mail_protocol',
308 'optionEditPath' => 'civicrm/admin/options/mail_protocol',
e6ca0a57 309 ],
a9d0587b 310 'add' => '2.2',
c3fc2621
CW
311 ],
312 'server' => [
e501603b
TO
313 'name' => 'server',
314 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 315 'title' => ts('Mail Server'),
215b423e 316 'description' => ts('server to use when polling'),
e501603b
TO
317 'maxlength' => 255,
318 'size' => CRM_Utils_Type::HUGE,
a36434b9 319 'where' => 'civicrm_mail_settings.server',
522a26c9 320 'table_name' => 'civicrm_mail_settings',
321 'entity' => 'MailSettings',
322 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 323 'localizable' => 0,
a9d0587b 324 'add' => '2.2',
c3fc2621
CW
325 ],
326 'port' => [
e501603b
TO
327 'name' => 'port',
328 'type' => CRM_Utils_Type::T_INT,
c3fc2621 329 'title' => ts('Mail Port'),
215b423e 330 'description' => ts('port to use when polling'),
a36434b9 331 'where' => 'civicrm_mail_settings.port',
522a26c9 332 'table_name' => 'civicrm_mail_settings',
333 'entity' => 'MailSettings',
334 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 335 'localizable' => 0,
a9d0587b 336 'add' => '2.2',
c3fc2621
CW
337 ],
338 'username' => [
e501603b
TO
339 'name' => 'username',
340 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 341 'title' => ts('Mail Account Username'),
215b423e 342 'description' => ts('username to use when polling'),
e501603b
TO
343 'maxlength' => 255,
344 'size' => CRM_Utils_Type::HUGE,
a36434b9 345 'where' => 'civicrm_mail_settings.username',
522a26c9 346 'table_name' => 'civicrm_mail_settings',
347 'entity' => 'MailSettings',
348 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 349 'localizable' => 0,
a9d0587b 350 'add' => '2.2',
c3fc2621
CW
351 ],
352 'password' => [
e501603b
TO
353 'name' => 'password',
354 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 355 'title' => ts('Mail Account Password'),
215b423e 356 'description' => ts('password to use when polling'),
e501603b
TO
357 'maxlength' => 255,
358 'size' => CRM_Utils_Type::HUGE,
a36434b9 359 'where' => 'civicrm_mail_settings.password',
522a26c9 360 'table_name' => 'civicrm_mail_settings',
361 'entity' => 'MailSettings',
362 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 363 'localizable' => 0,
a9d0587b 364 'add' => '2.2',
c3fc2621
CW
365 ],
366 'is_ssl' => [
e501603b
TO
367 'name' => 'is_ssl',
368 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 369 'title' => ts('Mail Account Uses SSL'),
215b423e 370 'description' => ts('whether to use SSL or not'),
a36434b9 371 'where' => 'civicrm_mail_settings.is_ssl',
522a26c9 372 'table_name' => 'civicrm_mail_settings',
373 'entity' => 'MailSettings',
374 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 375 'localizable' => 0,
a9d0587b 376 'add' => '2.2',
c3fc2621
CW
377 ],
378 'source' => [
e501603b
TO
379 'name' => 'source',
380 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 381 'title' => ts('Mail Folder'),
215b423e 382 'description' => ts('folder to poll from when using IMAP, path to poll from when using Maildir, etc.'),
e501603b
TO
383 'maxlength' => 255,
384 'size' => CRM_Utils_Type::HUGE,
a36434b9 385 'where' => 'civicrm_mail_settings.source',
522a26c9 386 'table_name' => 'civicrm_mail_settings',
387 'entity' => 'MailSettings',
388 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 389 'localizable' => 0,
a9d0587b 390 'add' => '2.2',
c3fc2621
CW
391 ],
392 'activity_status' => [
040073c9
CW
393 'name' => 'activity_status',
394 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 395 'title' => ts('Activity Status'),
215b423e 396 'description' => ts('Name of status to use when creating email to activity.'),
040073c9
CW
397 'maxlength' => 255,
398 'size' => CRM_Utils_Type::HUGE,
a36434b9 399 'where' => 'civicrm_mail_settings.activity_status',
040073c9
CW
400 'table_name' => 'civicrm_mail_settings',
401 'entity' => 'MailSettings',
402 'bao' => 'CRM_Core_BAO_MailSettings',
403 'localizable' => 0,
c3fc2621 404 'html' => [
040073c9 405 'type' => 'Select',
c3fc2621
CW
406 ],
407 'pseudoconstant' => [
040073c9
CW
408 'optionGroupName' => 'activity_status',
409 'keyColumn' => 'name',
410 'optionEditPath' => 'civicrm/admin/options/activity_status',
e6ca0a57 411 ],
a9d0587b 412 'add' => '4.7',
c3fc2621 413 ],
2f0fd07c
SL
414 'is_non_case_email_skipped' => [
415 'name' => 'is_non_case_email_skipped',
416 'type' => CRM_Utils_Type::T_BOOLEAN,
417 'title' => ts('Skip emails which do not have a Case ID or Case hash'),
418 'description' => ts('Enabling this option will have CiviCRM skip any emails that do not have the Case ID or Case Hash so that the system will only process emails that can be placed on case records. Any emails that are not processed will be moved to the ignored folder.'),
419 'where' => 'civicrm_mail_settings.is_non_case_email_skipped',
420 'default' => '0',
421 'table_name' => 'civicrm_mail_settings',
422 'entity' => 'MailSettings',
423 'bao' => 'CRM_Core_BAO_MailSettings',
424 'localizable' => 0,
425 'html' => [
426 'type' => 'CheckBox',
427 ],
428 'add' => '5.31',
429 ],
430 'is_contact_creation_disabled_if_no_match' => [
431 'name' => 'is_contact_creation_disabled_if_no_match',
432 'type' => CRM_Utils_Type::T_BOOLEAN,
433 'title' => ts('Do not create new contacts when filing emails'),
434 'where' => 'civicrm_mail_settings.is_contact_creation_disabled_if_no_match',
435 'default' => '0',
436 'table_name' => 'civicrm_mail_settings',
437 'entity' => 'MailSettings',
438 'bao' => 'CRM_Core_BAO_MailSettings',
439 'localizable' => 0,
440 'html' => [
441 'type' => 'CheckBox',
442 ],
443 'add' => '5.31',
444 ],
c3fc2621 445 ];
346aaaba 446 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 447 }
346aaaba 448 return Civi::$statics[__CLASS__]['fields'];
e501603b 449 }
c3fc2621 450
e501603b 451 /**
bd8e0b14 452 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
453 *
454 * @return array
bd8e0b14 455 * Array(string $name => string $uniqueName).
e501603b 456 */
c3fc2621 457 public static function &fieldKeys() {
bd8e0b14
TO
458 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
459 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 460 }
bd8e0b14 461 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 462 }
c3fc2621 463
e501603b
TO
464 /**
465 * Returns the names of this table
466 *
467 * @return string
468 */
c3fc2621 469 public static function getTableName() {
e501603b
TO
470 return self::$_tableName;
471 }
c3fc2621 472
e501603b
TO
473 /**
474 * Returns if this table needs to be logged
475 *
c3fc2621 476 * @return bool
e501603b 477 */
c3fc2621 478 public function getLog() {
e501603b
TO
479 return self::$_log;
480 }
c3fc2621 481
e501603b
TO
482 /**
483 * Returns the list of fields that can be imported
484 *
485 * @param bool $prefix
486 *
487 * @return array
488 */
c3fc2621
CW
489 public static function &import($prefix = FALSE) {
490 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mail_settings', $prefix, []);
60808919 491 return $r;
e501603b 492 }
c3fc2621 493
e501603b
TO
494 /**
495 * Returns the list of fields that can be exported
496 *
497 * @param bool $prefix
498 *
499 * @return array
500 */
c3fc2621
CW
501 public static function &export($prefix = FALSE) {
502 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mail_settings', $prefix, []);
60808919 503 return $r;
e501603b 504 }
c3fc2621 505
e7a6b91a
AS
506 /**
507 * Returns the list of indices
c3fc2621
CW
508 *
509 * @param bool $localize
510 *
511 * @return array
e7a6b91a
AS
512 */
513 public static function indices($localize = TRUE) {
c3fc2621 514 $indices = [];
e7a6b91a
AS
515 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
516 }
c3fc2621 517
e501603b 518}