Commit | Line | Data |
---|---|---|
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/Core/Email.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 33 | * (GenCodeChecksum:08f53d44527d7d174b4aa1bd545b028c) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_Email constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Core_DAO_Email 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_email'; | |
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 = true; | |
53 | /** | |
54 | * Unique Email ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * FK to Contact ID | |
61 | * | |
62 | * @var int unsigned | |
63 | */ | |
64 | public $contact_id; | |
65 | /** | |
66 | * Which Location does this email belong to. | |
67 | * | |
68 | * @var int unsigned | |
69 | */ | |
70 | public $location_type_id; | |
71 | /** | |
72 | * Email address | |
73 | * | |
74 | * @var string | |
75 | */ | |
76 | public $email; | |
77 | /** | |
78 | * Is this the primary? | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | public $is_primary; | |
83 | /** | |
84 | * Is this the billing? | |
85 | * | |
86 | * @var boolean | |
87 | */ | |
88 | public $is_billing; | |
89 | /** | |
90 | * Is this address on bounce hold? | |
91 | * | |
92 | * @var boolean | |
93 | */ | |
94 | public $on_hold; | |
95 | /** | |
96 | * Is this address for bulk mail ? | |
97 | * | |
98 | * @var boolean | |
99 | */ | |
100 | public $is_bulkmail; | |
101 | /** | |
102 | * When the address went on bounce hold | |
103 | * | |
104 | * @var datetime | |
105 | */ | |
106 | public $hold_date; | |
107 | /** | |
108 | * When the address bounce status was last reset | |
109 | * | |
110 | * @var datetime | |
111 | */ | |
112 | public $reset_date; | |
113 | /** | |
114 | * Text formatted signature for the email. | |
115 | * | |
116 | * @var text | |
117 | */ | |
118 | public $signature_text; | |
119 | /** | |
120 | * HTML formatted signature for the email. | |
121 | * | |
122 | * @var text | |
123 | */ | |
124 | public $signature_html; | |
125 | /** | |
f41f0342 | 126 | * Class constructor. |
e501603b TO |
127 | */ |
128 | function __construct() { | |
129 | $this->__table = 'civicrm_email'; | |
130 | parent::__construct(); | |
131 | } | |
132 | /** | |
f41f0342 | 133 | * Returns foreign keys and entity references. |
e501603b TO |
134 | * |
135 | * @return array | |
136 | * [CRM_Core_Reference_Interface] | |
137 | */ | |
138 | static function getReferenceColumns() { | |
346aaaba TO |
139 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
140 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
141 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
142 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 143 | } |
346aaaba | 144 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
145 | } |
146 | /** | |
147 | * Returns all the column names of this table | |
148 | * | |
149 | * @return array | |
150 | */ | |
151 | static function &fields() { | |
346aaaba TO |
152 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
153 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
154 | 'id' => array( |
155 | 'name' => 'id', | |
156 | 'type' => CRM_Utils_Type::T_INT, | |
157 | 'title' => ts('Email ID') , | |
158 | 'description' => 'Unique Email ID', | |
159 | 'required' => true, | |
522a26c9 | 160 | 'table_name' => 'civicrm_email', |
161 | 'entity' => 'Email', | |
162 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 163 | 'localizable' => 0, |
e501603b TO |
164 | ) , |
165 | 'contact_id' => array( | |
166 | 'name' => 'contact_id', | |
167 | 'type' => CRM_Utils_Type::T_INT, | |
168 | 'title' => ts('Email Contact') , | |
169 | 'description' => 'FK to Contact ID', | |
522a26c9 | 170 | 'table_name' => 'civicrm_email', |
171 | 'entity' => 'Email', | |
172 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 173 | 'localizable' => 0, |
e501603b TO |
174 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
175 | ) , | |
176 | 'location_type_id' => array( | |
177 | 'name' => 'location_type_id', | |
178 | 'type' => CRM_Utils_Type::T_INT, | |
179 | 'title' => ts('Email Location Type') , | |
180 | 'description' => 'Which Location does this email belong to.', | |
522a26c9 | 181 | 'table_name' => 'civicrm_email', |
182 | 'entity' => 'Email', | |
183 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 184 | 'localizable' => 0, |
e501603b TO |
185 | 'html' => array( |
186 | 'type' => 'Select', | |
187 | ) , | |
188 | 'pseudoconstant' => array( | |
189 | 'table' => 'civicrm_location_type', | |
190 | 'keyColumn' => 'id', | |
191 | 'labelColumn' => 'display_name', | |
192 | ) | |
193 | ) , | |
194 | 'email' => array( | |
195 | 'name' => 'email', | |
196 | 'type' => CRM_Utils_Type::T_STRING, | |
197 | 'title' => ts('Email') , | |
198 | 'description' => 'Email address', | |
199 | 'maxlength' => 254, | |
200 | 'size' => 30, | |
201 | 'import' => true, | |
202 | 'where' => 'civicrm_email.email', | |
203 | 'headerPattern' => '/e.?mail/i', | |
204 | 'dataPattern' => '/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/', | |
205 | 'export' => true, | |
206 | 'rule' => 'email', | |
522a26c9 | 207 | 'table_name' => 'civicrm_email', |
208 | 'entity' => 'Email', | |
209 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 210 | 'localizable' => 0, |
e501603b TO |
211 | 'html' => array( |
212 | 'type' => 'Text', | |
213 | ) , | |
214 | ) , | |
215 | 'is_primary' => array( | |
216 | 'name' => 'is_primary', | |
217 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
218 | 'title' => ts('Is Primary email') , | |
219 | 'description' => 'Is this the primary?', | |
522a26c9 | 220 | 'table_name' => 'civicrm_email', |
221 | 'entity' => 'Email', | |
222 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 223 | 'localizable' => 0, |
e501603b TO |
224 | ) , |
225 | 'is_billing' => array( | |
226 | 'name' => 'is_billing', | |
227 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
228 | 'title' => ts('Is Billing Email?') , | |
229 | 'description' => 'Is this the billing?', | |
522a26c9 | 230 | 'table_name' => 'civicrm_email', |
231 | 'entity' => 'Email', | |
232 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 233 | 'localizable' => 0, |
e501603b TO |
234 | ) , |
235 | 'on_hold' => array( | |
236 | 'name' => 'on_hold', | |
237 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
238 | 'title' => ts('On Hold') , | |
239 | 'description' => 'Is this address on bounce hold?', | |
240 | 'required' => true, | |
241 | 'export' => true, | |
242 | 'where' => 'civicrm_email.on_hold', | |
243 | 'headerPattern' => '', | |
244 | 'dataPattern' => '', | |
522a26c9 | 245 | 'table_name' => 'civicrm_email', |
246 | 'entity' => 'Email', | |
247 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 248 | 'localizable' => 0, |
e501603b TO |
249 | 'html' => array( |
250 | 'type' => 'CheckBox', | |
251 | ) , | |
252 | ) , | |
253 | 'is_bulkmail' => array( | |
254 | 'name' => 'is_bulkmail', | |
255 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
256 | 'title' => ts('Use for Bulk Mail') , | |
257 | 'description' => 'Is this address for bulk mail ?', | |
258 | 'required' => true, | |
259 | 'export' => true, | |
260 | 'where' => 'civicrm_email.is_bulkmail', | |
261 | 'headerPattern' => '', | |
262 | 'dataPattern' => '', | |
522a26c9 | 263 | 'table_name' => 'civicrm_email', |
264 | 'entity' => 'Email', | |
265 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 266 | 'localizable' => 0, |
e501603b TO |
267 | ) , |
268 | 'hold_date' => array( | |
269 | 'name' => 'hold_date', | |
270 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
271 | 'title' => ts('Hold Date') , | |
272 | 'description' => 'When the address went on bounce hold', | |
522a26c9 | 273 | 'table_name' => 'civicrm_email', |
274 | 'entity' => 'Email', | |
275 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 276 | 'localizable' => 0, |
e501603b TO |
277 | ) , |
278 | 'reset_date' => array( | |
279 | 'name' => 'reset_date', | |
280 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
281 | 'title' => ts('Reset Date') , | |
282 | 'description' => 'When the address bounce status was last reset', | |
522a26c9 | 283 | 'table_name' => 'civicrm_email', |
284 | 'entity' => 'Email', | |
285 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 286 | 'localizable' => 0, |
e501603b TO |
287 | ) , |
288 | 'signature_text' => array( | |
289 | 'name' => 'signature_text', | |
290 | 'type' => CRM_Utils_Type::T_TEXT, | |
291 | 'title' => ts('Signature Text') , | |
292 | 'description' => 'Text formatted signature for the email.', | |
293 | 'import' => true, | |
294 | 'where' => 'civicrm_email.signature_text', | |
295 | 'headerPattern' => '', | |
296 | 'dataPattern' => '', | |
297 | 'export' => true, | |
298 | 'default' => 'NULL', | |
522a26c9 | 299 | 'table_name' => 'civicrm_email', |
300 | 'entity' => 'Email', | |
301 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 302 | 'localizable' => 0, |
e501603b TO |
303 | ) , |
304 | 'signature_html' => array( | |
305 | 'name' => 'signature_html', | |
306 | 'type' => CRM_Utils_Type::T_TEXT, | |
307 | 'title' => ts('Signature Html') , | |
308 | 'description' => 'HTML formatted signature for the email.', | |
309 | 'import' => true, | |
310 | 'where' => 'civicrm_email.signature_html', | |
311 | 'headerPattern' => '', | |
312 | 'dataPattern' => '', | |
313 | 'export' => true, | |
314 | 'default' => 'NULL', | |
522a26c9 | 315 | 'table_name' => 'civicrm_email', |
316 | 'entity' => 'Email', | |
317 | 'bao' => 'CRM_Core_BAO_Email', | |
6a7e5e5d | 318 | 'localizable' => 0, |
e501603b TO |
319 | ) , |
320 | ); | |
346aaaba | 321 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 322 | } |
346aaaba | 323 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
324 | } |
325 | /** | |
bd8e0b14 | 326 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
327 | * |
328 | * @return array | |
bd8e0b14 | 329 | * Array(string $name => string $uniqueName). |
e501603b TO |
330 | */ |
331 | static function &fieldKeys() { | |
bd8e0b14 TO |
332 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
333 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 334 | } |
bd8e0b14 | 335 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
336 | } |
337 | /** | |
338 | * Returns the names of this table | |
339 | * | |
340 | * @return string | |
341 | */ | |
342 | static function getTableName() { | |
343 | return self::$_tableName; | |
344 | } | |
345 | /** | |
346 | * Returns if this table needs to be logged | |
347 | * | |
348 | * @return boolean | |
349 | */ | |
350 | function getLog() { | |
351 | return self::$_log; | |
352 | } | |
353 | /** | |
354 | * Returns the list of fields that can be imported | |
355 | * | |
356 | * @param bool $prefix | |
357 | * | |
358 | * @return array | |
359 | */ | |
360 | static function &import($prefix = false) { | |
60808919 TO |
361 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'email', $prefix, array()); |
362 | return $r; | |
e501603b TO |
363 | } |
364 | /** | |
365 | * Returns the list of fields that can be exported | |
366 | * | |
367 | * @param bool $prefix | |
368 | * | |
369 | * @return array | |
370 | */ | |
371 | static function &export($prefix = false) { | |
60808919 TO |
372 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'email', $prefix, array()); |
373 | return $r; | |
e501603b | 374 | } |
e7a6b91a AS |
375 | /** |
376 | * Returns the list of indices | |
377 | */ | |
378 | public static function indices($localize = TRUE) { | |
379 | $indices = array( | |
380 | 'index_location_type' => array( | |
381 | 'name' => 'index_location_type', | |
382 | 'field' => array( | |
383 | 0 => 'location_type_id', | |
384 | ) , | |
385 | 'localizable' => false, | |
386 | 'sig' => 'civicrm_email::0::location_type_id', | |
387 | ) , | |
388 | 'UI_email' => array( | |
389 | 'name' => 'UI_email', | |
390 | 'field' => array( | |
391 | 0 => 'email', | |
392 | ) , | |
393 | 'localizable' => false, | |
394 | 'sig' => 'civicrm_email::0::email', | |
395 | ) , | |
396 | 'index_is_primary' => array( | |
397 | 'name' => 'index_is_primary', | |
398 | 'field' => array( | |
399 | 0 => 'is_primary', | |
400 | ) , | |
401 | 'localizable' => false, | |
402 | 'sig' => 'civicrm_email::0::is_primary', | |
403 | ) , | |
404 | 'index_is_billing' => array( | |
405 | 'name' => 'index_is_billing', | |
406 | 'field' => array( | |
407 | 0 => 'is_billing', | |
408 | ) , | |
409 | 'localizable' => false, | |
410 | 'sig' => 'civicrm_email::0::is_billing', | |
411 | ) , | |
412 | ); | |
413 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
414 | } | |
e501603b | 415 | } |