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