3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
31 * Generated from xml/schema/CRM/Core/Phone.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:661faad4886dd1a40784d465b906f447)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Core_DAO_Phone constructor.
40 class CRM_Core_DAO_Phone
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_phone';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
66 * Which Location does this phone belong to.
70 public $location_type_id;
72 * Is this the primary phone for this contact and location.
78 * Is this the billing?
84 * Which Mobile Provider does this phone belong to.
88 public $mobile_provider_id;
90 * Complete phone number.
96 * Optional extension for a phone number.
102 * Phone number stripped of all whitespace, letters, and punctuation.
106 public $phone_numeric;
108 * Which type of phone does this number belongs.
112 public $phone_type_id;
116 function __construct() {
117 $this->__table
= 'civicrm_phone';
118 parent
::__construct();
121 * Returns foreign keys and entity references.
124 * [CRM_Core_Reference_Interface]
126 static function getReferenceColumns() {
127 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
128 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
129 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
130 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
132 return Civi
::$statics[__CLASS__
]['links'];
135 * Returns all the column names of this table
139 static function &fields() {
140 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
141 Civi
::$statics[__CLASS__
]['fields'] = array(
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Phone ID') ,
146 'description' => 'Unique Phone ID',
148 'table_name' => 'civicrm_phone',
150 'bao' => 'CRM_Core_BAO_Phone',
153 'contact_id' => array(
154 'name' => 'contact_id',
155 'type' => CRM_Utils_Type
::T_INT
,
156 'title' => ts('Phone Contact') ,
157 'description' => 'FK to Contact ID',
158 'table_name' => 'civicrm_phone',
160 'bao' => 'CRM_Core_BAO_Phone',
162 'FKClassName' => 'CRM_Contact_DAO_Contact',
164 'location_type_id' => array(
165 'name' => 'location_type_id',
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Phone Location Type') ,
168 'description' => 'Which Location does this phone belong to.',
169 'table_name' => 'civicrm_phone',
171 'bao' => 'CRM_Core_BAO_Phone',
176 'pseudoconstant' => array(
177 'table' => 'civicrm_location_type',
179 'labelColumn' => 'display_name',
182 'is_primary' => array(
183 'name' => 'is_primary',
184 'type' => CRM_Utils_Type
::T_BOOLEAN
,
185 'title' => ts('Is Phone Primary?') ,
186 'description' => 'Is this the primary phone for this contact and location.',
187 'table_name' => 'civicrm_phone',
189 'bao' => 'CRM_Core_BAO_Phone',
192 'is_billing' => array(
193 'name' => 'is_billing',
194 'type' => CRM_Utils_Type
::T_BOOLEAN
,
195 'title' => ts('Is Billing Phone') ,
196 'description' => 'Is this the billing?',
197 'table_name' => 'civicrm_phone',
199 'bao' => 'CRM_Core_BAO_Phone',
202 'mobile_provider_id' => array(
203 'name' => 'mobile_provider_id',
204 'type' => CRM_Utils_Type
::T_INT
,
205 'title' => ts('Mobile Provider') ,
206 'description' => 'Which Mobile Provider does this phone belong to.',
207 'table_name' => 'civicrm_phone',
209 'bao' => 'CRM_Core_BAO_Phone',
214 'type' => CRM_Utils_Type
::T_STRING
,
215 'title' => ts('Phone') ,
216 'description' => 'Complete phone number.',
218 'size' => CRM_Utils_Type
::MEDIUM
,
220 'where' => 'civicrm_phone.phone',
221 'headerPattern' => '/phone/i',
222 'dataPattern' => '/^[\d\(\)\-\.\s]+$/',
224 'table_name' => 'civicrm_phone',
226 'bao' => 'CRM_Core_BAO_Phone',
232 'phone_ext' => array(
233 'name' => 'phone_ext',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Phone Extension') ,
236 'description' => 'Optional extension for a phone number.',
240 'where' => 'civicrm_phone.phone_ext',
241 'headerPattern' => '/extension/i',
242 'dataPattern' => '/^\d+$/',
244 'table_name' => 'civicrm_phone',
246 'bao' => 'CRM_Core_BAO_Phone',
252 'phone_numeric' => array(
253 'name' => 'phone_numeric',
254 'type' => CRM_Utils_Type
::T_STRING
,
255 'title' => ts('Phone Numeric') ,
256 'description' => 'Phone number stripped of all whitespace, letters, and punctuation.',
258 'size' => CRM_Utils_Type
::MEDIUM
,
259 'table_name' => 'civicrm_phone',
261 'bao' => 'CRM_Core_BAO_Phone',
264 'phone_type_id' => array(
265 'name' => 'phone_type_id',
266 'type' => CRM_Utils_Type
::T_INT
,
267 'title' => ts('Phone Type') ,
268 'description' => 'Which type of phone does this number belongs.',
269 'table_name' => 'civicrm_phone',
271 'bao' => 'CRM_Core_BAO_Phone',
276 'pseudoconstant' => array(
277 'optionGroupName' => 'phone_type',
278 'optionEditPath' => 'civicrm/admin/options/phone_type',
282 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
284 return Civi
::$statics[__CLASS__
]['fields'];
287 * Return a mapping from field-name to the corresponding key (as used in fields()).
290 * Array(string $name => string $uniqueName).
292 static function &fieldKeys() {
293 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
294 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
296 return Civi
::$statics[__CLASS__
]['fieldKeys'];
299 * Returns the names of this table
303 static function getTableName() {
304 return self
::$_tableName;
307 * Returns if this table needs to be logged
315 * Returns the list of fields that can be imported
317 * @param bool $prefix
321 static function &import($prefix = false) {
322 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'phone', $prefix, array());
326 * Returns the list of fields that can be exported
328 * @param bool $prefix
332 static function &export($prefix = false) {
333 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'phone', $prefix, array());
337 * Returns the list of indices
339 public static function indices($localize = TRUE) {
341 'index_location_type' => array(
342 'name' => 'index_location_type',
344 0 => 'location_type_id',
346 'localizable' => false,
347 'sig' => 'civicrm_phone::0::location_type_id',
349 'index_is_primary' => array(
350 'name' => 'index_is_primary',
354 'localizable' => false,
355 'sig' => 'civicrm_phone::0::is_primary',
357 'index_is_billing' => array(
358 'name' => 'index_is_billing',
362 'localizable' => false,
363 'sig' => 'civicrm_phone::0::is_billing',
365 'UI_mobile_provider_id' => array(
366 'name' => 'UI_mobile_provider_id',
368 0 => 'mobile_provider_id',
370 'localizable' => false,
371 'sig' => 'civicrm_phone::0::mobile_provider_id',
373 'index_phone_numeric' => array(
374 'name' => 'index_phone_numeric',
376 0 => 'phone_numeric',
378 'localizable' => false,
379 'sig' => 'civicrm_phone::0::phone_numeric',
382 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;