3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2015
31 * Generated from xml/schema/CRM/Core/Email.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Core_DAO_Email
extends CRM_Core_DAO
{
38 * static instance to hold the table name
42 static $_tableName = 'civicrm_email';
44 * static instance to hold the field values
48 static $_fields = null;
50 * static instance to hold the keys used in $_fields for each field.
54 static $_fieldKeys = null;
56 * static instance to hold the FK relationships
60 static $_links = null;
62 * static instance to hold the values that can
67 static $_import = null;
69 * static instance to hold the values that can
74 static $_export = null;
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
95 * Which Location does this email belong to.
99 public $location_type_id;
107 * Is this the primary?
113 * Is this the billing?
119 * Is this address on bounce hold?
125 * Is this address for bulk mail ?
131 * When the address went on bounce hold
137 * When the address bounce status was last reset
143 * Text formatted signature for the email.
147 public $signature_text;
149 * HTML formatted signature for the email.
153 public $signature_html;
157 * @return civicrm_email
159 function __construct() {
160 $this->__table
= 'civicrm_email';
161 parent
::__construct();
164 * Returns foreign keys and entity references
167 * [CRM_Core_Reference_Interface]
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');
174 return self
::$_links;
177 * Returns all the column names of this table
181 static function &fields() {
182 if (!(self
::$_fields)) {
183 self
::$_fields = array(
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Email ID') ,
188 'description' => 'Unique Email ID',
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',
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.',
206 'pseudoconstant' => array(
207 'table' => 'civicrm_location_type',
209 'labelColumn' => 'display_name',
214 'type' => CRM_Utils_Type
::T_STRING
,
215 'title' => ts('Email') ,
216 'description' => 'Email address',
218 'size' => CRM_Utils_Type
::MEDIUM
,
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]$/',
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?',
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?',
243 'type' => CRM_Utils_Type
::T_BOOLEAN
,
244 'title' => ts('On Hold') ,
245 'description' => 'Is this address on bounce hold?',
248 'where' => 'civicrm_email.on_hold',
249 'headerPattern' => '',
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 ?',
259 'where' => 'civicrm_email.is_bulkmail',
260 'headerPattern' => '',
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',
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',
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.',
281 'where' => 'civicrm_email.signature_text',
282 'headerPattern' => '',
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.',
293 'where' => 'civicrm_email.signature_html',
294 'headerPattern' => '',
301 return self
::$_fields;
304 * Returns an array containing, for each field, the arary key used for that
305 * field in self::$_fields.
309 static function &fieldKeys() {
310 if (!(self
::$_fieldKeys)) {
311 self
::$_fieldKeys = array(
313 'contact_id' => 'contact_id',
314 'location_type_id' => 'location_type_id',
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',
326 return self
::$_fieldKeys;
329 * Returns the names of this table
333 static function getTableName() {
334 return self
::$_tableName;
337 * Returns if this table needs to be logged
345 * Returns the list of fields that can be imported
347 * @param bool $prefix
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)) {
358 self
::$_import['email'] = & $fields[$name];
360 self
::$_import[$name] = & $fields[$name];
365 return self
::$_import;
368 * Returns the list of fields that can be exported
370 * @param bool $prefix
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)) {
381 self
::$_export['email'] = & $fields[$name];
383 self
::$_export[$name] = & $fields[$name];
388 return self
::$_export;