3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
31 * Generated from xml/schema/CRM/Core/Email.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:988b68b07a90ff903001c8f68b2e2545)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_Email
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_email';
45 * static instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the keys used in $_fields for each field.
55 static $_fieldKeys = null;
57 * static instance to hold the FK relationships
61 static $_links = null;
63 * static instance to hold the values that can
68 static $_import = null;
70 * static instance to hold the values that can
75 static $_export = null;
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
96 * Which Location does this email belong to.
100 public $location_type_id;
108 * Is this the primary?
114 * Is this the billing?
120 * Is this address on bounce hold?
126 * Is this address for bulk mail ?
132 * When the address went on bounce hold
138 * When the address bounce status was last reset
144 * Text formatted signature for the email.
148 public $signature_text;
150 * HTML formatted signature for the email.
154 public $signature_html;
158 * @return civicrm_email
160 function __construct() {
161 $this->__table
= 'civicrm_email';
162 parent
::__construct();
165 * Returns foreign keys and entity references
168 * [CRM_Core_Reference_Interface]
170 static function getReferenceColumns() {
171 if (!self
::$_links) {
172 self
::$_links = static ::createReferenceColumns(__CLASS__
);
173 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
175 return self
::$_links;
178 * Returns all the column names of this table
182 static function &fields() {
183 if (!(self
::$_fields)) {
184 self
::$_fields = array(
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Email ID') ,
189 'description' => 'Unique Email ID',
192 'contact_id' => array(
193 'name' => 'contact_id',
194 'type' => CRM_Utils_Type
::T_INT
,
195 'title' => ts('Email Contact') ,
196 'description' => 'FK to Contact ID',
197 'FKClassName' => 'CRM_Contact_DAO_Contact',
199 'location_type_id' => array(
200 'name' => 'location_type_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Email Location Type') ,
203 'description' => 'Which Location does this email belong to.',
207 'pseudoconstant' => array(
208 'table' => 'civicrm_location_type',
210 'labelColumn' => 'display_name',
215 'type' => CRM_Utils_Type
::T_STRING
,
216 'title' => ts('Email') ,
217 'description' => 'Email address',
221 'where' => 'civicrm_email.email',
222 'headerPattern' => '/e.?mail/i',
223 '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]$/',
230 'is_primary' => array(
231 'name' => 'is_primary',
232 'type' => CRM_Utils_Type
::T_BOOLEAN
,
233 'title' => ts('Is Primary email') ,
234 'description' => 'Is this the primary?',
236 'is_billing' => array(
237 'name' => 'is_billing',
238 'type' => CRM_Utils_Type
::T_BOOLEAN
,
239 'title' => ts('Is Billing Email?') ,
240 'description' => 'Is this the billing?',
244 'type' => CRM_Utils_Type
::T_BOOLEAN
,
245 'title' => ts('On Hold') ,
246 'description' => 'Is this address on bounce hold?',
249 'where' => 'civicrm_email.on_hold',
250 'headerPattern' => '',
253 'type' => 'CheckBox',
256 'is_bulkmail' => array(
257 'name' => 'is_bulkmail',
258 'type' => CRM_Utils_Type
::T_BOOLEAN
,
259 'title' => ts('Use for Bulk Mail') ,
260 'description' => 'Is this address for bulk mail ?',
263 'where' => 'civicrm_email.is_bulkmail',
264 'headerPattern' => '',
267 'hold_date' => array(
268 'name' => 'hold_date',
269 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
270 'title' => ts('Hold Date') ,
271 'description' => 'When the address went on bounce hold',
273 'reset_date' => array(
274 'name' => 'reset_date',
275 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
276 'title' => ts('Reset Date') ,
277 'description' => 'When the address bounce status was last reset',
279 'signature_text' => array(
280 'name' => 'signature_text',
281 'type' => CRM_Utils_Type
::T_TEXT
,
282 'title' => ts('Signature Text') ,
283 'description' => 'Text formatted signature for the email.',
285 'where' => 'civicrm_email.signature_text',
286 'headerPattern' => '',
291 'signature_html' => array(
292 'name' => 'signature_html',
293 'type' => CRM_Utils_Type
::T_TEXT
,
294 'title' => ts('Signature Html') ,
295 'description' => 'HTML formatted signature for the email.',
297 'where' => 'civicrm_email.signature_html',
298 'headerPattern' => '',
305 return self
::$_fields;
308 * Returns an array containing, for each field, the arary key used for that
309 * field in self::$_fields.
313 static function &fieldKeys() {
314 if (!(self
::$_fieldKeys)) {
315 self
::$_fieldKeys = array(
317 'contact_id' => 'contact_id',
318 'location_type_id' => 'location_type_id',
320 'is_primary' => 'is_primary',
321 'is_billing' => 'is_billing',
322 'on_hold' => 'on_hold',
323 'is_bulkmail' => 'is_bulkmail',
324 'hold_date' => 'hold_date',
325 'reset_date' => 'reset_date',
326 'signature_text' => 'signature_text',
327 'signature_html' => 'signature_html',
330 return self
::$_fieldKeys;
333 * Returns the names of this table
337 static function getTableName() {
338 return self
::$_tableName;
341 * Returns if this table needs to be logged
349 * Returns the list of fields that can be imported
351 * @param bool $prefix
355 static function &import($prefix = false) {
356 if (!(self
::$_import)) {
357 self
::$_import = array();
358 $fields = self
::fields();
359 foreach($fields as $name => $field) {
360 if (CRM_Utils_Array
::value('import', $field)) {
362 self
::$_import['email'] = & $fields[$name];
364 self
::$_import[$name] = & $fields[$name];
369 return self
::$_import;
372 * Returns the list of fields that can be exported
374 * @param bool $prefix
378 static function &export($prefix = false) {
379 if (!(self
::$_export)) {
380 self
::$_export = array();
381 $fields = self
::fields();
382 foreach($fields as $name => $field) {
383 if (CRM_Utils_Array
::value('export', $field)) {
385 self
::$_export['email'] = & $fields[$name];
387 self
::$_export[$name] = & $fields[$name];
392 return self
::$_export;