Merge pull request #18653 from eileenmcnaughton/token
[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
7b66c3b5 9 * (GenCodeChecksum:310f3c60fe656e8ef27a67234d6fa80c)
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
e501603b 138 /**
f41f0342 139 * Class constructor.
e501603b 140 */
c3fc2621 141 public function __construct() {
e501603b
TO
142 $this->__table = 'civicrm_mail_settings';
143 parent::__construct();
144 }
c3fc2621 145
449c4e6b
CW
146 /**
147 * Returns localized title of this entity.
7b66c3b5
AH
148 *
149 * @param bool $plural
150 * Whether to return the plural version of the title.
449c4e6b 151 */
7b66c3b5
AH
152 public static function getEntityTitle($plural = FALSE) {
153 return $plural ? ts('Mail Settingses') : ts('Mail Settings');
449c4e6b
CW
154 }
155
e501603b 156 /**
f41f0342 157 * Returns foreign keys and entity references.
e501603b
TO
158 *
159 * @return array
160 * [CRM_Core_Reference_Interface]
161 */
c3fc2621 162 public static function getReferenceColumns() {
346aaaba 163 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 164 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 165 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
346aaaba 166 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 167 }
346aaaba 168 return Civi::$statics[__CLASS__]['links'];
e501603b 169 }
c3fc2621 170
e501603b
TO
171 /**
172 * Returns all the column names of this table
173 *
174 * @return array
175 */
c3fc2621 176 public static function &fields() {
346aaaba 177 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
178 Civi::$statics[__CLASS__]['fields'] = [
179 'id' => [
e501603b
TO
180 'name' => 'id',
181 'type' => CRM_Utils_Type::T_INT,
c3fc2621 182 'title' => ts('Mail Settings ID'),
215b423e 183 'description' => ts('primary key'),
c3fc2621 184 'required' => TRUE,
a36434b9 185 'where' => 'civicrm_mail_settings.id',
522a26c9 186 'table_name' => 'civicrm_mail_settings',
187 'entity' => 'MailSettings',
188 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 189 'localizable' => 0,
a9d0587b 190 'add' => '2.2',
c3fc2621
CW
191 ],
192 'domain_id' => [
e501603b
TO
193 'name' => 'domain_id',
194 'type' => CRM_Utils_Type::T_INT,
c3fc2621 195 'title' => ts('Mail Settings Domain'),
215b423e 196 'description' => ts('Which Domain is this match entry for'),
c3fc2621 197 'required' => TRUE,
a36434b9 198 'where' => 'civicrm_mail_settings.domain_id',
522a26c9 199 'table_name' => 'civicrm_mail_settings',
200 'entity' => 'MailSettings',
201 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 202 'localizable' => 0,
e501603b 203 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 204 'pseudoconstant' => [
e501603b
TO
205 'table' => 'civicrm_domain',
206 'keyColumn' => 'id',
207 'labelColumn' => 'name',
e6ca0a57 208 ],
a9d0587b 209 'add' => '3.1',
c3fc2621
CW
210 ],
211 'name' => [
e501603b
TO
212 'name' => 'name',
213 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 214 'title' => ts('Mail Settings Name'),
215b423e 215 'description' => ts('name of this group of settings'),
e501603b
TO
216 'maxlength' => 255,
217 'size' => CRM_Utils_Type::HUGE,
a36434b9 218 'where' => 'civicrm_mail_settings.name',
522a26c9 219 'table_name' => 'civicrm_mail_settings',
220 'entity' => 'MailSettings',
221 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 222 'localizable' => 0,
a9d0587b 223 'add' => '2.2',
c3fc2621
CW
224 ],
225 'is_default' => [
e501603b
TO
226 'name' => 'is_default',
227 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 228 'title' => ts('Is Default Mail Settings?'),
215b423e 229 'description' => ts('whether this is the default set of settings for this domain'),
a36434b9 230 'where' => 'civicrm_mail_settings.is_default',
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 'domain' => [
e501603b
TO
238 'name' => 'domain',
239 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 240 'title' => ts('email Domain'),
215b423e 241 'description' => ts('email address domain (the part after @)'),
e501603b
TO
242 'maxlength' => 255,
243 'size' => CRM_Utils_Type::HUGE,
a36434b9 244 'where' => 'civicrm_mail_settings.domain',
522a26c9 245 'table_name' => 'civicrm_mail_settings',
246 'entity' => 'MailSettings',
247 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 248 'localizable' => 0,
a9d0587b 249 'add' => '2.2',
c3fc2621
CW
250 ],
251 'localpart' => [
e501603b
TO
252 'name' => 'localpart',
253 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 254 'title' => ts('email Local Part'),
215b423e 255 'description' => ts('optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)'),
e501603b
TO
256 'maxlength' => 255,
257 'size' => CRM_Utils_Type::HUGE,
a36434b9 258 'where' => 'civicrm_mail_settings.localpart',
522a26c9 259 'table_name' => 'civicrm_mail_settings',
260 'entity' => 'MailSettings',
261 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 262 'localizable' => 0,
a9d0587b 263 'add' => '2.2',
c3fc2621
CW
264 ],
265 'return_path' => [
e501603b
TO
266 'name' => 'return_path',
267 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 268 'title' => ts('Return Path'),
215b423e 269 'description' => ts('contents of the Return-Path header'),
e501603b
TO
270 'maxlength' => 255,
271 'size' => CRM_Utils_Type::HUGE,
a36434b9 272 'where' => 'civicrm_mail_settings.return_path',
522a26c9 273 'table_name' => 'civicrm_mail_settings',
274 'entity' => 'MailSettings',
275 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 276 'localizable' => 0,
a9d0587b 277 'add' => '2.2',
c3fc2621
CW
278 ],
279 'protocol' => [
e501603b
TO
280 'name' => 'protocol',
281 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 282 'title' => ts('Protocol'),
215b423e 283 'description' => ts('name of the protocol to use for polling (like IMAP, POP3 or Maildir)'),
e501603b
TO
284 'maxlength' => 255,
285 'size' => CRM_Utils_Type::HUGE,
a36434b9 286 'where' => 'civicrm_mail_settings.protocol',
522a26c9 287 'table_name' => 'civicrm_mail_settings',
288 'entity' => 'MailSettings',
289 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 290 'localizable' => 0,
c3fc2621 291 'html' => [
e501603b 292 'type' => 'Select',
c3fc2621
CW
293 ],
294 'pseudoconstant' => [
e501603b
TO
295 'optionGroupName' => 'mail_protocol',
296 'optionEditPath' => 'civicrm/admin/options/mail_protocol',
e6ca0a57 297 ],
a9d0587b 298 'add' => '2.2',
c3fc2621
CW
299 ],
300 'server' => [
e501603b
TO
301 'name' => 'server',
302 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 303 'title' => ts('Mail Server'),
215b423e 304 'description' => ts('server to use when polling'),
e501603b
TO
305 'maxlength' => 255,
306 'size' => CRM_Utils_Type::HUGE,
a36434b9 307 'where' => 'civicrm_mail_settings.server',
522a26c9 308 'table_name' => 'civicrm_mail_settings',
309 'entity' => 'MailSettings',
310 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 311 'localizable' => 0,
a9d0587b 312 'add' => '2.2',
c3fc2621
CW
313 ],
314 'port' => [
e501603b
TO
315 'name' => 'port',
316 'type' => CRM_Utils_Type::T_INT,
c3fc2621 317 'title' => ts('Mail Port'),
215b423e 318 'description' => ts('port to use when polling'),
a36434b9 319 'where' => 'civicrm_mail_settings.port',
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 'username' => [
e501603b
TO
327 'name' => 'username',
328 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 329 'title' => ts('Mail Account Username'),
215b423e 330 'description' => ts('username to use when polling'),
e501603b
TO
331 'maxlength' => 255,
332 'size' => CRM_Utils_Type::HUGE,
a36434b9 333 'where' => 'civicrm_mail_settings.username',
522a26c9 334 'table_name' => 'civicrm_mail_settings',
335 'entity' => 'MailSettings',
336 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 337 'localizable' => 0,
a9d0587b 338 'add' => '2.2',
c3fc2621
CW
339 ],
340 'password' => [
e501603b
TO
341 'name' => 'password',
342 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 343 'title' => ts('Mail Account Password'),
215b423e 344 'description' => ts('password to use when polling'),
e501603b
TO
345 'maxlength' => 255,
346 'size' => CRM_Utils_Type::HUGE,
a36434b9 347 'where' => 'civicrm_mail_settings.password',
522a26c9 348 'table_name' => 'civicrm_mail_settings',
349 'entity' => 'MailSettings',
350 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 351 'localizable' => 0,
a9d0587b 352 'add' => '2.2',
c3fc2621
CW
353 ],
354 'is_ssl' => [
e501603b
TO
355 'name' => 'is_ssl',
356 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 357 'title' => ts('Mail Account Uses SSL'),
215b423e 358 'description' => ts('whether to use SSL or not'),
a36434b9 359 'where' => 'civicrm_mail_settings.is_ssl',
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 'source' => [
e501603b
TO
367 'name' => 'source',
368 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 369 'title' => ts('Mail Folder'),
215b423e 370 'description' => ts('folder to poll from when using IMAP, path to poll from when using Maildir, etc.'),
e501603b
TO
371 'maxlength' => 255,
372 'size' => CRM_Utils_Type::HUGE,
a36434b9 373 'where' => 'civicrm_mail_settings.source',
522a26c9 374 'table_name' => 'civicrm_mail_settings',
375 'entity' => 'MailSettings',
376 'bao' => 'CRM_Core_BAO_MailSettings',
6a7e5e5d 377 'localizable' => 0,
a9d0587b 378 'add' => '2.2',
c3fc2621
CW
379 ],
380 'activity_status' => [
040073c9
CW
381 'name' => 'activity_status',
382 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 383 'title' => ts('Activity Status'),
215b423e 384 'description' => ts('Name of status to use when creating email to activity.'),
040073c9
CW
385 'maxlength' => 255,
386 'size' => CRM_Utils_Type::HUGE,
a36434b9 387 'where' => 'civicrm_mail_settings.activity_status',
040073c9
CW
388 'table_name' => 'civicrm_mail_settings',
389 'entity' => 'MailSettings',
390 'bao' => 'CRM_Core_BAO_MailSettings',
391 'localizable' => 0,
c3fc2621 392 'html' => [
040073c9 393 'type' => 'Select',
c3fc2621
CW
394 ],
395 'pseudoconstant' => [
040073c9
CW
396 'optionGroupName' => 'activity_status',
397 'keyColumn' => 'name',
398 'optionEditPath' => 'civicrm/admin/options/activity_status',
e6ca0a57 399 ],
a9d0587b 400 'add' => '4.7',
c3fc2621
CW
401 ],
402 ];
346aaaba 403 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 404 }
346aaaba 405 return Civi::$statics[__CLASS__]['fields'];
e501603b 406 }
c3fc2621 407
e501603b 408 /**
bd8e0b14 409 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
410 *
411 * @return array
bd8e0b14 412 * Array(string $name => string $uniqueName).
e501603b 413 */
c3fc2621 414 public static function &fieldKeys() {
bd8e0b14
TO
415 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
416 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 417 }
bd8e0b14 418 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 419 }
c3fc2621 420
e501603b
TO
421 /**
422 * Returns the names of this table
423 *
424 * @return string
425 */
c3fc2621 426 public static function getTableName() {
e501603b
TO
427 return self::$_tableName;
428 }
c3fc2621 429
e501603b
TO
430 /**
431 * Returns if this table needs to be logged
432 *
c3fc2621 433 * @return bool
e501603b 434 */
c3fc2621 435 public function getLog() {
e501603b
TO
436 return self::$_log;
437 }
c3fc2621 438
e501603b
TO
439 /**
440 * Returns the list of fields that can be imported
441 *
442 * @param bool $prefix
443 *
444 * @return array
445 */
c3fc2621
CW
446 public static function &import($prefix = FALSE) {
447 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mail_settings', $prefix, []);
60808919 448 return $r;
e501603b 449 }
c3fc2621 450
e501603b
TO
451 /**
452 * Returns the list of fields that can be exported
453 *
454 * @param bool $prefix
455 *
456 * @return array
457 */
c3fc2621
CW
458 public static function &export($prefix = FALSE) {
459 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mail_settings', $prefix, []);
60808919 460 return $r;
e501603b 461 }
c3fc2621 462
e7a6b91a
AS
463 /**
464 * Returns the list of indices
c3fc2621
CW
465 *
466 * @param bool $localize
467 *
468 * @return array
e7a6b91a
AS
469 */
470 public static function indices($localize = TRUE) {
c3fc2621 471 $indices = [];
e7a6b91a
AS
472 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
473 }
c3fc2621 474
e501603b 475}