CRM-20312 add field localisation data to DAO.
[civicrm-core.git] / CRM / Core / DAO / Email.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/Core/Email.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:33bf5e19c3136f4860d3d078a3fbd68d)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_Email constructor.
39 */
e501603b
TO
40class 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',
e501603b
TO
163 ) ,
164 'contact_id' => array(
165 'name' => 'contact_id',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('Email Contact') ,
168 'description' => 'FK to Contact ID',
522a26c9 169 'table_name' => 'civicrm_email',
170 'entity' => 'Email',
171 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
172 'FKClassName' => 'CRM_Contact_DAO_Contact',
173 ) ,
174 'location_type_id' => array(
175 'name' => 'location_type_id',
176 'type' => CRM_Utils_Type::T_INT,
177 'title' => ts('Email Location Type') ,
178 'description' => 'Which Location does this email belong to.',
522a26c9 179 'table_name' => 'civicrm_email',
180 'entity' => 'Email',
181 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
182 'html' => array(
183 'type' => 'Select',
184 ) ,
185 'pseudoconstant' => array(
186 'table' => 'civicrm_location_type',
187 'keyColumn' => 'id',
188 'labelColumn' => 'display_name',
189 )
190 ) ,
191 'email' => array(
192 'name' => 'email',
193 'type' => CRM_Utils_Type::T_STRING,
194 'title' => ts('Email') ,
195 'description' => 'Email address',
196 'maxlength' => 254,
197 'size' => 30,
198 'import' => true,
199 'where' => 'civicrm_email.email',
200 'headerPattern' => '/e.?mail/i',
201 '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]$/',
202 'export' => true,
203 'rule' => 'email',
522a26c9 204 'table_name' => 'civicrm_email',
205 'entity' => 'Email',
206 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
207 'html' => array(
208 'type' => 'Text',
209 ) ,
210 ) ,
211 'is_primary' => array(
212 'name' => 'is_primary',
213 'type' => CRM_Utils_Type::T_BOOLEAN,
214 'title' => ts('Is Primary email') ,
215 'description' => 'Is this the primary?',
522a26c9 216 'table_name' => 'civicrm_email',
217 'entity' => 'Email',
218 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
219 ) ,
220 'is_billing' => array(
221 'name' => 'is_billing',
222 'type' => CRM_Utils_Type::T_BOOLEAN,
223 'title' => ts('Is Billing Email?') ,
224 'description' => 'Is this the billing?',
522a26c9 225 'table_name' => 'civicrm_email',
226 'entity' => 'Email',
227 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
228 ) ,
229 'on_hold' => array(
230 'name' => 'on_hold',
231 'type' => CRM_Utils_Type::T_BOOLEAN,
232 'title' => ts('On Hold') ,
233 'description' => 'Is this address on bounce hold?',
234 'required' => true,
235 'export' => true,
236 'where' => 'civicrm_email.on_hold',
237 'headerPattern' => '',
238 'dataPattern' => '',
522a26c9 239 'table_name' => 'civicrm_email',
240 'entity' => 'Email',
241 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
242 'html' => array(
243 'type' => 'CheckBox',
244 ) ,
245 ) ,
246 'is_bulkmail' => array(
247 'name' => 'is_bulkmail',
248 'type' => CRM_Utils_Type::T_BOOLEAN,
249 'title' => ts('Use for Bulk Mail') ,
250 'description' => 'Is this address for bulk mail ?',
251 'required' => true,
252 'export' => true,
253 'where' => 'civicrm_email.is_bulkmail',
254 'headerPattern' => '',
255 'dataPattern' => '',
522a26c9 256 'table_name' => 'civicrm_email',
257 'entity' => 'Email',
258 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
259 ) ,
260 'hold_date' => array(
261 'name' => 'hold_date',
262 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
263 'title' => ts('Hold Date') ,
264 'description' => 'When the address went on bounce hold',
522a26c9 265 'table_name' => 'civicrm_email',
266 'entity' => 'Email',
267 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
268 ) ,
269 'reset_date' => array(
270 'name' => 'reset_date',
271 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
272 'title' => ts('Reset Date') ,
273 'description' => 'When the address bounce status was last reset',
522a26c9 274 'table_name' => 'civicrm_email',
275 'entity' => 'Email',
276 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
277 ) ,
278 'signature_text' => array(
279 'name' => 'signature_text',
280 'type' => CRM_Utils_Type::T_TEXT,
281 'title' => ts('Signature Text') ,
282 'description' => 'Text formatted signature for the email.',
283 'import' => true,
284 'where' => 'civicrm_email.signature_text',
285 'headerPattern' => '',
286 'dataPattern' => '',
287 'export' => true,
288 'default' => 'NULL',
522a26c9 289 'table_name' => 'civicrm_email',
290 'entity' => 'Email',
291 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
292 ) ,
293 'signature_html' => array(
294 'name' => 'signature_html',
295 'type' => CRM_Utils_Type::T_TEXT,
296 'title' => ts('Signature Html') ,
297 'description' => 'HTML formatted signature for the email.',
298 'import' => true,
299 'where' => 'civicrm_email.signature_html',
300 'headerPattern' => '',
301 'dataPattern' => '',
302 'export' => true,
303 'default' => 'NULL',
522a26c9 304 'table_name' => 'civicrm_email',
305 'entity' => 'Email',
306 'bao' => 'CRM_Core_BAO_Email',
e501603b
TO
307 ) ,
308 );
346aaaba 309 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 310 }
346aaaba 311 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
312 }
313 /**
bd8e0b14 314 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
315 *
316 * @return array
bd8e0b14 317 * Array(string $name => string $uniqueName).
e501603b
TO
318 */
319 static function &fieldKeys() {
bd8e0b14
TO
320 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
321 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 322 }
bd8e0b14 323 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
324 }
325 /**
326 * Returns the names of this table
327 *
328 * @return string
329 */
330 static function getTableName() {
331 return self::$_tableName;
332 }
333 /**
334 * Returns if this table needs to be logged
335 *
336 * @return boolean
337 */
338 function getLog() {
339 return self::$_log;
340 }
341 /**
342 * Returns the list of fields that can be imported
343 *
344 * @param bool $prefix
345 *
346 * @return array
347 */
348 static function &import($prefix = false) {
60808919
TO
349 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'email', $prefix, array());
350 return $r;
e501603b
TO
351 }
352 /**
353 * Returns the list of fields that can be exported
354 *
355 * @param bool $prefix
356 *
357 * @return array
358 */
359 static function &export($prefix = false) {
60808919
TO
360 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'email', $prefix, array());
361 return $r;
e501603b
TO
362 }
363}