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/Phone.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:97437ba9054b6175f63fe45e1756081f)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_Phone
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_phone';
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
64 * Which Location does this phone belong to.
68 public $location_type_id;
70 * Is this the primary phone for this contact and location.
76 * Is this the billing?
82 * Which Mobile Provider does this phone belong to.
86 public $mobile_provider_id;
88 * Complete phone number.
94 * Optional extension for a phone number.
100 * Phone number stripped of all whitespace, letters, and punctuation.
104 public $phone_numeric;
106 * Which type of phone does this number belongs.
110 public $phone_type_id;
114 * @return civicrm_phone
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',
149 'contact_id' => array(
150 'name' => 'contact_id',
151 'type' => CRM_Utils_Type
::T_INT
,
152 'title' => ts('Phone Contact') ,
153 'description' => 'FK to Contact ID',
154 'FKClassName' => 'CRM_Contact_DAO_Contact',
156 'location_type_id' => array(
157 'name' => 'location_type_id',
158 'type' => CRM_Utils_Type
::T_INT
,
159 'title' => ts('Phone Location Type') ,
160 'description' => 'Which Location does this phone belong to.',
164 'pseudoconstant' => array(
165 'table' => 'civicrm_location_type',
167 'labelColumn' => 'display_name',
170 'is_primary' => array(
171 'name' => 'is_primary',
172 'type' => CRM_Utils_Type
::T_BOOLEAN
,
173 'title' => ts('Is Phone Primary?') ,
174 'description' => 'Is this the primary phone for this contact and location.',
176 'is_billing' => array(
177 'name' => 'is_billing',
178 'type' => CRM_Utils_Type
::T_BOOLEAN
,
179 'title' => ts('Is Billing Phone') ,
180 'description' => 'Is this the billing?',
182 'mobile_provider_id' => array(
183 'name' => 'mobile_provider_id',
184 'type' => CRM_Utils_Type
::T_INT
,
185 'title' => ts('Mobile Provider') ,
186 'description' => 'Which Mobile Provider does this phone belong to.',
190 'type' => CRM_Utils_Type
::T_STRING
,
191 'title' => ts('Phone') ,
192 'description' => 'Complete phone number.',
194 'size' => CRM_Utils_Type
::MEDIUM
,
196 'where' => 'civicrm_phone.phone',
197 'headerPattern' => '/phone/i',
198 'dataPattern' => '/^[\d\(\)\-\.\s]+$/',
204 'phone_ext' => array(
205 'name' => 'phone_ext',
206 'type' => CRM_Utils_Type
::T_STRING
,
207 'title' => ts('Phone Extension') ,
208 'description' => 'Optional extension for a phone number.',
212 'where' => 'civicrm_phone.phone_ext',
213 'headerPattern' => '/extension/i',
214 'dataPattern' => '/^\d+$/',
220 'phone_numeric' => array(
221 'name' => 'phone_numeric',
222 'type' => CRM_Utils_Type
::T_STRING
,
223 'title' => ts('Phone Numeric') ,
224 'description' => 'Phone number stripped of all whitespace, letters, and punctuation.',
226 'size' => CRM_Utils_Type
::MEDIUM
,
228 'phone_type_id' => array(
229 'name' => 'phone_type_id',
230 'type' => CRM_Utils_Type
::T_INT
,
231 'title' => ts('Phone Type') ,
232 'description' => 'Which type of phone does this number belongs.',
236 'pseudoconstant' => array(
237 'optionGroupName' => 'phone_type',
238 'optionEditPath' => 'civicrm/admin/options/phone_type',
242 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
244 return Civi
::$statics[__CLASS__
]['fields'];
247 * Return a mapping from field-name to the corresponding key (as used in fields()).
250 * Array(string $name => string $uniqueName).
252 static function &fieldKeys() {
253 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
254 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
256 return Civi
::$statics[__CLASS__
]['fieldKeys'];
259 * Returns the names of this table
263 static function getTableName() {
264 return self
::$_tableName;
267 * Returns if this table needs to be logged
275 * Returns the list of fields that can be imported
277 * @param bool $prefix
281 static function &import($prefix = false) {
282 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'phone', $prefix, array());
286 * Returns the list of fields that can be exported
288 * @param bool $prefix
292 static function &export($prefix = false) {
293 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'phone', $prefix, array());