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:aed6082497eb601fdc249c7a361204a8)
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',
152 'contact_id' => array(
153 'name' => 'contact_id',
154 'type' => CRM_Utils_Type
::T_INT
,
155 'title' => ts('Phone Contact') ,
156 'description' => 'FK to Contact ID',
157 'table_name' => 'civicrm_phone',
159 'bao' => 'CRM_Core_BAO_Phone',
160 'FKClassName' => 'CRM_Contact_DAO_Contact',
162 'location_type_id' => array(
163 'name' => 'location_type_id',
164 'type' => CRM_Utils_Type
::T_INT
,
165 'title' => ts('Phone Location Type') ,
166 'description' => 'Which Location does this phone belong to.',
167 'table_name' => 'civicrm_phone',
169 'bao' => 'CRM_Core_BAO_Phone',
173 'pseudoconstant' => array(
174 'table' => 'civicrm_location_type',
176 'labelColumn' => 'display_name',
179 'is_primary' => array(
180 'name' => 'is_primary',
181 'type' => CRM_Utils_Type
::T_BOOLEAN
,
182 'title' => ts('Is Phone Primary?') ,
183 'description' => 'Is this the primary phone for this contact and location.',
184 'table_name' => 'civicrm_phone',
186 'bao' => 'CRM_Core_BAO_Phone',
188 'is_billing' => array(
189 'name' => 'is_billing',
190 'type' => CRM_Utils_Type
::T_BOOLEAN
,
191 'title' => ts('Is Billing Phone') ,
192 'description' => 'Is this the billing?',
193 'table_name' => 'civicrm_phone',
195 'bao' => 'CRM_Core_BAO_Phone',
197 'mobile_provider_id' => array(
198 'name' => 'mobile_provider_id',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Mobile Provider') ,
201 'description' => 'Which Mobile Provider does this phone belong to.',
202 'table_name' => 'civicrm_phone',
204 'bao' => 'CRM_Core_BAO_Phone',
208 'type' => CRM_Utils_Type
::T_STRING
,
209 'title' => ts('Phone') ,
210 'description' => 'Complete phone number.',
212 'size' => CRM_Utils_Type
::MEDIUM
,
214 'where' => 'civicrm_phone.phone',
215 'headerPattern' => '/phone/i',
216 'dataPattern' => '/^[\d\(\)\-\.\s]+$/',
218 'table_name' => 'civicrm_phone',
220 'bao' => 'CRM_Core_BAO_Phone',
225 'phone_ext' => array(
226 'name' => 'phone_ext',
227 'type' => CRM_Utils_Type
::T_STRING
,
228 'title' => ts('Phone Extension') ,
229 'description' => 'Optional extension for a phone number.',
233 'where' => 'civicrm_phone.phone_ext',
234 'headerPattern' => '/extension/i',
235 'dataPattern' => '/^\d+$/',
237 'table_name' => 'civicrm_phone',
239 'bao' => 'CRM_Core_BAO_Phone',
244 'phone_numeric' => array(
245 'name' => 'phone_numeric',
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('Phone Numeric') ,
248 'description' => 'Phone number stripped of all whitespace, letters, and punctuation.',
250 'size' => CRM_Utils_Type
::MEDIUM
,
251 'table_name' => 'civicrm_phone',
253 'bao' => 'CRM_Core_BAO_Phone',
255 'phone_type_id' => array(
256 'name' => 'phone_type_id',
257 'type' => CRM_Utils_Type
::T_INT
,
258 'title' => ts('Phone Type') ,
259 'description' => 'Which type of phone does this number belongs.',
260 'table_name' => 'civicrm_phone',
262 'bao' => 'CRM_Core_BAO_Phone',
266 'pseudoconstant' => array(
267 'optionGroupName' => 'phone_type',
268 'optionEditPath' => 'civicrm/admin/options/phone_type',
272 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
274 return Civi
::$statics[__CLASS__
]['fields'];
277 * Return a mapping from field-name to the corresponding key (as used in fields()).
280 * Array(string $name => string $uniqueName).
282 static function &fieldKeys() {
283 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
284 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
286 return Civi
::$statics[__CLASS__
]['fieldKeys'];
289 * Returns the names of this table
293 static function getTableName() {
294 return self
::$_tableName;
297 * Returns if this table needs to be logged
305 * Returns the list of fields that can be imported
307 * @param bool $prefix
311 static function &import($prefix = false) {
312 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'phone', $prefix, array());
316 * Returns the list of fields that can be exported
318 * @param bool $prefix
322 static function &export($prefix = false) {
323 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'phone', $prefix, array());