commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / CRM / Core / DAO / Email.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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-2015
30 *
31 * Generated from xml/schema/CRM/Core/Email.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 */
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Core_DAO_Email extends CRM_Core_DAO {
37 /**
38 * static instance to hold the table name
39 *
40 * @var string
41 */
42 static $_tableName = 'civicrm_email';
43 /**
44 * static instance to hold the field values
45 *
46 * @var array
47 */
48 static $_fields = null;
49 /**
50 * static instance to hold the keys used in $_fields for each field.
51 *
52 * @var array
53 */
54 static $_fieldKeys = null;
55 /**
56 * static instance to hold the FK relationships
57 *
58 * @var string
59 */
60 static $_links = null;
61 /**
62 * static instance to hold the values that can
63 * be imported
64 *
65 * @var array
66 */
67 static $_import = null;
68 /**
69 * static instance to hold the values that can
70 * be exported
71 *
72 * @var array
73 */
74 static $_export = null;
75 /**
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
78 *
79 * @var boolean
80 */
81 static $_log = true;
82 /**
83 * Unique Email ID
84 *
85 * @var int unsigned
86 */
87 public $id;
88 /**
89 * FK to Contact ID
90 *
91 * @var int unsigned
92 */
93 public $contact_id;
94 /**
95 * Which Location does this email belong to.
96 *
97 * @var int unsigned
98 */
99 public $location_type_id;
100 /**
101 * Email address
102 *
103 * @var string
104 */
105 public $email;
106 /**
107 * Is this the primary?
108 *
109 * @var boolean
110 */
111 public $is_primary;
112 /**
113 * Is this the billing?
114 *
115 * @var boolean
116 */
117 public $is_billing;
118 /**
119 * Is this address on bounce hold?
120 *
121 * @var boolean
122 */
123 public $on_hold;
124 /**
125 * Is this address for bulk mail ?
126 *
127 * @var boolean
128 */
129 public $is_bulkmail;
130 /**
131 * When the address went on bounce hold
132 *
133 * @var datetime
134 */
135 public $hold_date;
136 /**
137 * When the address bounce status was last reset
138 *
139 * @var datetime
140 */
141 public $reset_date;
142 /**
143 * Text formatted signature for the email.
144 *
145 * @var text
146 */
147 public $signature_text;
148 /**
149 * HTML formatted signature for the email.
150 *
151 * @var text
152 */
153 public $signature_html;
154 /**
155 * class constructor
156 *
157 * @return civicrm_email
158 */
159 function __construct() {
160 $this->__table = 'civicrm_email';
161 parent::__construct();
162 }
163 /**
164 * Returns foreign keys and entity references
165 *
166 * @return array
167 * [CRM_Core_Reference_Interface]
168 */
169 static function getReferenceColumns() {
170 if (!self::$_links) {
171 self::$_links = static ::createReferenceColumns(__CLASS__);
172 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
173 }
174 return self::$_links;
175 }
176 /**
177 * Returns all the column names of this table
178 *
179 * @return array
180 */
181 static function &fields() {
182 if (!(self::$_fields)) {
183 self::$_fields = array(
184 'id' => array(
185 'name' => 'id',
186 'type' => CRM_Utils_Type::T_INT,
187 'title' => ts('Email ID') ,
188 'description' => 'Unique Email ID',
189 'required' => true,
190 ) ,
191 'contact_id' => array(
192 'name' => 'contact_id',
193 'type' => CRM_Utils_Type::T_INT,
194 'title' => ts('Email Contact') ,
195 'description' => 'FK to Contact ID',
196 'FKClassName' => 'CRM_Contact_DAO_Contact',
197 ) ,
198 'location_type_id' => array(
199 'name' => 'location_type_id',
200 'type' => CRM_Utils_Type::T_INT,
201 'title' => ts('Email Location Type') ,
202 'description' => 'Which Location does this email belong to.',
203 'html' => array(
204 'type' => 'Select',
205 ) ,
206 'pseudoconstant' => array(
207 'table' => 'civicrm_location_type',
208 'keyColumn' => 'id',
209 'labelColumn' => 'display_name',
210 )
211 ) ,
212 'email' => array(
213 'name' => 'email',
214 'type' => CRM_Utils_Type::T_STRING,
215 'title' => ts('Email') ,
216 'description' => 'Email address',
217 'maxlength' => 254,
218 'size' => CRM_Utils_Type::MEDIUM,
219 'import' => true,
220 'where' => 'civicrm_email.email',
221 'headerPattern' => '/e.?mail/i',
222 '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]$/',
223 'export' => true,
224 'rule' => 'email',
225 'html' => array(
226 'type' => 'Text',
227 ) ,
228 ) ,
229 'is_primary' => array(
230 'name' => 'is_primary',
231 'type' => CRM_Utils_Type::T_BOOLEAN,
232 'title' => ts('Is Primary email') ,
233 'description' => 'Is this the primary?',
234 ) ,
235 'is_billing' => array(
236 'name' => 'is_billing',
237 'type' => CRM_Utils_Type::T_BOOLEAN,
238 'title' => ts('Is Billing Email?') ,
239 'description' => 'Is this the billing?',
240 ) ,
241 'on_hold' => array(
242 'name' => 'on_hold',
243 'type' => CRM_Utils_Type::T_BOOLEAN,
244 'title' => ts('On Hold') ,
245 'description' => 'Is this address on bounce hold?',
246 'required' => true,
247 'export' => true,
248 'where' => 'civicrm_email.on_hold',
249 'headerPattern' => '',
250 'dataPattern' => '',
251 ) ,
252 'is_bulkmail' => array(
253 'name' => 'is_bulkmail',
254 'type' => CRM_Utils_Type::T_BOOLEAN,
255 'title' => ts('Use for Bulk Mail') ,
256 'description' => 'Is this address for bulk mail ?',
257 'required' => true,
258 'export' => true,
259 'where' => 'civicrm_email.is_bulkmail',
260 'headerPattern' => '',
261 'dataPattern' => '',
262 ) ,
263 'hold_date' => array(
264 'name' => 'hold_date',
265 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
266 'title' => ts('Hold Date') ,
267 'description' => 'When the address went on bounce hold',
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',
274 ) ,
275 'signature_text' => array(
276 'name' => 'signature_text',
277 'type' => CRM_Utils_Type::T_TEXT,
278 'title' => ts('Signature Text') ,
279 'description' => 'Text formatted signature for the email.',
280 'import' => true,
281 'where' => 'civicrm_email.signature_text',
282 'headerPattern' => '',
283 'dataPattern' => '',
284 'export' => true,
285 'default' => 'NULL',
286 ) ,
287 'signature_html' => array(
288 'name' => 'signature_html',
289 'type' => CRM_Utils_Type::T_TEXT,
290 'title' => ts('Signature Html') ,
291 'description' => 'HTML formatted signature for the email.',
292 'import' => true,
293 'where' => 'civicrm_email.signature_html',
294 'headerPattern' => '',
295 'dataPattern' => '',
296 'export' => true,
297 'default' => 'NULL',
298 ) ,
299 );
300 }
301 return self::$_fields;
302 }
303 /**
304 * Returns an array containing, for each field, the arary key used for that
305 * field in self::$_fields.
306 *
307 * @return array
308 */
309 static function &fieldKeys() {
310 if (!(self::$_fieldKeys)) {
311 self::$_fieldKeys = array(
312 'id' => 'id',
313 'contact_id' => 'contact_id',
314 'location_type_id' => 'location_type_id',
315 'email' => 'email',
316 'is_primary' => 'is_primary',
317 'is_billing' => 'is_billing',
318 'on_hold' => 'on_hold',
319 'is_bulkmail' => 'is_bulkmail',
320 'hold_date' => 'hold_date',
321 'reset_date' => 'reset_date',
322 'signature_text' => 'signature_text',
323 'signature_html' => 'signature_html',
324 );
325 }
326 return self::$_fieldKeys;
327 }
328 /**
329 * Returns the names of this table
330 *
331 * @return string
332 */
333 static function getTableName() {
334 return self::$_tableName;
335 }
336 /**
337 * Returns if this table needs to be logged
338 *
339 * @return boolean
340 */
341 function getLog() {
342 return self::$_log;
343 }
344 /**
345 * Returns the list of fields that can be imported
346 *
347 * @param bool $prefix
348 *
349 * @return array
350 */
351 static function &import($prefix = false) {
352 if (!(self::$_import)) {
353 self::$_import = array();
354 $fields = self::fields();
355 foreach($fields as $name => $field) {
356 if (CRM_Utils_Array::value('import', $field)) {
357 if ($prefix) {
358 self::$_import['email'] = & $fields[$name];
359 } else {
360 self::$_import[$name] = & $fields[$name];
361 }
362 }
363 }
364 }
365 return self::$_import;
366 }
367 /**
368 * Returns the list of fields that can be exported
369 *
370 * @param bool $prefix
371 *
372 * @return array
373 */
374 static function &export($prefix = false) {
375 if (!(self::$_export)) {
376 self::$_export = array();
377 $fields = self::fields();
378 foreach($fields as $name => $field) {
379 if (CRM_Utils_Array::value('export', $field)) {
380 if ($prefix) {
381 self::$_export['email'] = & $fields[$name];
382 } else {
383 self::$_export[$name] = & $fields[$name];
384 }
385 }
386 }
387 }
388 return self::$_export;
389 }
390 }