Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
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 | |
29 | * @copyright CiviCRM LLC (c) 2004-2016 | |
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 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Core_DAO_Email extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_email'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = true; | |
51 | /** | |
52 | * Unique Email ID | |
53 | * | |
54 | * @var int unsigned | |
55 | */ | |
56 | public $id; | |
57 | /** | |
58 | * FK to Contact ID | |
59 | * | |
60 | * @var int unsigned | |
61 | */ | |
62 | public $contact_id; | |
63 | /** | |
64 | * Which Location does this email belong to. | |
65 | * | |
66 | * @var int unsigned | |
67 | */ | |
68 | public $location_type_id; | |
69 | /** | |
70 | * Email address | |
71 | * | |
72 | * @var string | |
73 | */ | |
74 | public $email; | |
75 | /** | |
76 | * Is this the primary? | |
77 | * | |
78 | * @var boolean | |
79 | */ | |
80 | public $is_primary; | |
81 | /** | |
82 | * Is this the billing? | |
83 | * | |
84 | * @var boolean | |
85 | */ | |
86 | public $is_billing; | |
87 | /** | |
88 | * Is this address on bounce hold? | |
89 | * | |
90 | * @var boolean | |
91 | */ | |
92 | public $on_hold; | |
93 | /** | |
94 | * Is this address for bulk mail ? | |
95 | * | |
96 | * @var boolean | |
97 | */ | |
98 | public $is_bulkmail; | |
99 | /** | |
100 | * When the address went on bounce hold | |
101 | * | |
102 | * @var datetime | |
103 | */ | |
104 | public $hold_date; | |
105 | /** | |
106 | * When the address bounce status was last reset | |
107 | * | |
108 | * @var datetime | |
109 | */ | |
110 | public $reset_date; | |
111 | /** | |
112 | * Text formatted signature for the email. | |
113 | * | |
114 | * @var text | |
115 | */ | |
116 | public $signature_text; | |
117 | /** | |
118 | * HTML formatted signature for the email. | |
119 | * | |
120 | * @var text | |
121 | */ | |
122 | public $signature_html; | |
123 | /** | |
124 | * class constructor | |
125 | * | |
126 | * @return civicrm_email | |
127 | */ | |
128 | function __construct() { | |
129 | $this->__table = 'civicrm_email'; | |
130 | parent::__construct(); | |
131 | } | |
132 | /** | |
133 | * Returns foreign keys and entity references | |
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 | } |