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