Translate description in DAO files
[civicrm-core.git] / CRM / Core / DAO / Phone.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Phone.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
219c47d6 9 * (GenCodeChecksum:22802e5d7d8dfce93626004aaf6cd2e2)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Phone entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Phone extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_phone';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
c3fc2621
CW
29 static $_log = TRUE;
30
e501603b
TO
31 /**
32 * Unique Phone ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * FK to Contact ID
40 *
41 * @var int unsigned
42 */
43 public $contact_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Which Location does this phone belong to.
47 *
48 * @var int unsigned
49 */
50 public $location_type_id;
c3fc2621 51
e501603b
TO
52 /**
53 * Is this the primary phone for this contact and location.
54 *
55 * @var boolean
56 */
57 public $is_primary;
c3fc2621 58
e501603b
TO
59 /**
60 * Is this the billing?
61 *
62 * @var boolean
63 */
64 public $is_billing;
c3fc2621 65
e501603b
TO
66 /**
67 * Which Mobile Provider does this phone belong to.
68 *
69 * @var int unsigned
70 */
71 public $mobile_provider_id;
c3fc2621 72
e501603b
TO
73 /**
74 * Complete phone number.
75 *
76 * @var string
77 */
78 public $phone;
c3fc2621 79
e501603b
TO
80 /**
81 * Optional extension for a phone number.
82 *
83 * @var string
84 */
85 public $phone_ext;
c3fc2621 86
e501603b
TO
87 /**
88 * Phone number stripped of all whitespace, letters, and punctuation.
89 *
90 * @var string
91 */
92 public $phone_numeric;
c3fc2621 93
e501603b
TO
94 /**
95 * Which type of phone does this number belongs.
96 *
97 * @var int unsigned
98 */
99 public $phone_type_id;
c3fc2621 100
e501603b 101 /**
f41f0342 102 * Class constructor.
e501603b 103 */
c3fc2621 104 public function __construct() {
e501603b
TO
105 $this->__table = 'civicrm_phone';
106 parent::__construct();
107 }
c3fc2621 108
e501603b 109 /**
f41f0342 110 * Returns foreign keys and entity references.
e501603b
TO
111 *
112 * @return array
113 * [CRM_Core_Reference_Interface]
114 */
c3fc2621 115 public static function getReferenceColumns() {
346aaaba
TO
116 if (!isset(Civi::$statics[__CLASS__]['links'])) {
117 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
c3fc2621 118 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 119 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 120 }
346aaaba 121 return Civi::$statics[__CLASS__]['links'];
e501603b 122 }
c3fc2621 123
e501603b
TO
124 /**
125 * Returns all the column names of this table
126 *
127 * @return array
128 */
c3fc2621 129 public static function &fields() {
346aaaba 130 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
131 Civi::$statics[__CLASS__]['fields'] = [
132 'id' => [
e501603b
TO
133 'name' => 'id',
134 'type' => CRM_Utils_Type::T_INT,
c3fc2621 135 'title' => ts('Phone ID'),
215b423e 136 'description' => ts('Unique Phone ID'),
c3fc2621 137 'required' => TRUE,
522a26c9 138 'table_name' => 'civicrm_phone',
139 'entity' => 'Phone',
140 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 141 'localizable' => 0,
c3fc2621
CW
142 ],
143 'contact_id' => [
e501603b
TO
144 'name' => 'contact_id',
145 'type' => CRM_Utils_Type::T_INT,
c3fc2621 146 'title' => ts('Phone Contact'),
215b423e 147 'description' => ts('FK to Contact ID'),
522a26c9 148 'table_name' => 'civicrm_phone',
149 'entity' => 'Phone',
150 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 151 'localizable' => 0,
e501603b 152 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
153 ],
154 'location_type_id' => [
e501603b
TO
155 'name' => 'location_type_id',
156 'type' => CRM_Utils_Type::T_INT,
c3fc2621 157 'title' => ts('Phone Location Type'),
215b423e 158 'description' => ts('Which Location does this phone belong to.'),
522a26c9 159 'table_name' => 'civicrm_phone',
160 'entity' => 'Phone',
161 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 162 'localizable' => 0,
c3fc2621 163 'html' => [
e501603b 164 'type' => 'Select',
c3fc2621
CW
165 ],
166 'pseudoconstant' => [
e501603b
TO
167 'table' => 'civicrm_location_type',
168 'keyColumn' => 'id',
169 'labelColumn' => 'display_name',
c3fc2621
CW
170 ]
171 ],
172 'is_primary' => [
e501603b
TO
173 'name' => 'is_primary',
174 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 175 'title' => ts('Is Phone Primary?'),
215b423e 176 'description' => ts('Is this the primary phone for this contact and location.'),
45a83e42 177 'default' => '0',
522a26c9 178 'table_name' => 'civicrm_phone',
179 'entity' => 'Phone',
180 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 181 'localizable' => 0,
c3fc2621
CW
182 ],
183 'is_billing' => [
e501603b
TO
184 'name' => 'is_billing',
185 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 186 'title' => ts('Is Billing Phone'),
215b423e 187 'description' => ts('Is this the billing?'),
45a83e42 188 'default' => '0',
522a26c9 189 'table_name' => 'civicrm_phone',
190 'entity' => 'Phone',
191 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 192 'localizable' => 0,
c3fc2621
CW
193 ],
194 'mobile_provider_id' => [
e501603b
TO
195 'name' => 'mobile_provider_id',
196 'type' => CRM_Utils_Type::T_INT,
c3fc2621 197 'title' => ts('Mobile Provider'),
215b423e 198 'description' => ts('Which Mobile Provider does this phone belong to.'),
522a26c9 199 'table_name' => 'civicrm_phone',
200 'entity' => 'Phone',
201 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 202 'localizable' => 0,
c3fc2621
CW
203 ],
204 'phone' => [
e501603b
TO
205 'name' => 'phone',
206 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 207 'title' => ts('Phone'),
215b423e 208 'description' => ts('Complete phone number.'),
e501603b
TO
209 'maxlength' => 32,
210 'size' => CRM_Utils_Type::MEDIUM,
c3fc2621 211 'import' => TRUE,
e501603b
TO
212 'where' => 'civicrm_phone.phone',
213 'headerPattern' => '/phone/i',
214 'dataPattern' => '/^[\d\(\)\-\.\s]+$/',
c3fc2621 215 'export' => TRUE,
522a26c9 216 'table_name' => 'civicrm_phone',
217 'entity' => 'Phone',
218 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 219 'localizable' => 0,
c3fc2621 220 'html' => [
e501603b 221 'type' => 'Text',
c3fc2621
CW
222 ],
223 ],
224 'phone_ext' => [
e501603b
TO
225 'name' => 'phone_ext',
226 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 227 'title' => ts('Phone Extension'),
215b423e 228 'description' => ts('Optional extension for a phone number.'),
e501603b
TO
229 'maxlength' => 16,
230 'size' => 4,
c3fc2621 231 'import' => TRUE,
e501603b
TO
232 'where' => 'civicrm_phone.phone_ext',
233 'headerPattern' => '/extension/i',
234 'dataPattern' => '/^\d+$/',
c3fc2621 235 'export' => TRUE,
522a26c9 236 'table_name' => 'civicrm_phone',
237 'entity' => 'Phone',
238 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 239 'localizable' => 0,
c3fc2621 240 'html' => [
e501603b 241 'type' => 'Text',
c3fc2621
CW
242 ],
243 ],
244 'phone_numeric' => [
e501603b
TO
245 'name' => 'phone_numeric',
246 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 247 'title' => ts('Phone Numeric'),
215b423e 248 'description' => ts('Phone number stripped of all whitespace, letters, and punctuation.'),
e501603b
TO
249 'maxlength' => 32,
250 'size' => CRM_Utils_Type::MEDIUM,
522a26c9 251 'table_name' => 'civicrm_phone',
252 'entity' => 'Phone',
253 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 254 'localizable' => 0,
c3fc2621
CW
255 ],
256 'phone_type_id' => [
e501603b
TO
257 'name' => 'phone_type_id',
258 'type' => CRM_Utils_Type::T_INT,
c3fc2621 259 'title' => ts('Phone Type'),
215b423e 260 'description' => ts('Which type of phone does this number belongs.'),
219c47d6 261 'export' => TRUE,
262 'where' => 'civicrm_phone.phone_type_id',
263 'headerPattern' => '',
264 'dataPattern' => '',
522a26c9 265 'table_name' => 'civicrm_phone',
266 'entity' => 'Phone',
267 'bao' => 'CRM_Core_BAO_Phone',
6a7e5e5d 268 'localizable' => 0,
c3fc2621 269 'html' => [
e501603b 270 'type' => 'Select',
c3fc2621
CW
271 ],
272 'pseudoconstant' => [
e501603b
TO
273 'optionGroupName' => 'phone_type',
274 'optionEditPath' => 'civicrm/admin/options/phone_type',
c3fc2621
CW
275 ]
276 ],
277 ];
346aaaba 278 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 279 }
346aaaba 280 return Civi::$statics[__CLASS__]['fields'];
e501603b 281 }
c3fc2621 282
e501603b 283 /**
bd8e0b14 284 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
285 *
286 * @return array
bd8e0b14 287 * Array(string $name => string $uniqueName).
e501603b 288 */
c3fc2621 289 public static function &fieldKeys() {
bd8e0b14
TO
290 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
291 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 292 }
bd8e0b14 293 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 294 }
c3fc2621 295
e501603b
TO
296 /**
297 * Returns the names of this table
298 *
299 * @return string
300 */
c3fc2621 301 public static function getTableName() {
e501603b
TO
302 return self::$_tableName;
303 }
c3fc2621 304
e501603b
TO
305 /**
306 * Returns if this table needs to be logged
307 *
c3fc2621 308 * @return bool
e501603b 309 */
c3fc2621 310 public function getLog() {
e501603b
TO
311 return self::$_log;
312 }
c3fc2621 313
e501603b
TO
314 /**
315 * Returns the list of fields that can be imported
316 *
317 * @param bool $prefix
318 *
319 * @return array
320 */
c3fc2621
CW
321 public static function &import($prefix = FALSE) {
322 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'phone', $prefix, []);
60808919 323 return $r;
e501603b 324 }
c3fc2621 325
e501603b
TO
326 /**
327 * Returns the list of fields that can be exported
328 *
329 * @param bool $prefix
330 *
331 * @return array
332 */
c3fc2621
CW
333 public static function &export($prefix = FALSE) {
334 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'phone', $prefix, []);
60808919 335 return $r;
e501603b 336 }
c3fc2621 337
e7a6b91a
AS
338 /**
339 * Returns the list of indices
c3fc2621
CW
340 *
341 * @param bool $localize
342 *
343 * @return array
e7a6b91a
AS
344 */
345 public static function indices($localize = TRUE) {
c3fc2621
CW
346 $indices = [
347 'index_location_type' => [
e7a6b91a 348 'name' => 'index_location_type',
c3fc2621 349 'field' => [
e7a6b91a 350 0 => 'location_type_id',
c3fc2621
CW
351 ],
352 'localizable' => FALSE,
e7a6b91a 353 'sig' => 'civicrm_phone::0::location_type_id',
c3fc2621
CW
354 ],
355 'index_is_primary' => [
e7a6b91a 356 'name' => 'index_is_primary',
c3fc2621 357 'field' => [
e7a6b91a 358 0 => 'is_primary',
c3fc2621
CW
359 ],
360 'localizable' => FALSE,
e7a6b91a 361 'sig' => 'civicrm_phone::0::is_primary',
c3fc2621
CW
362 ],
363 'index_is_billing' => [
e7a6b91a 364 'name' => 'index_is_billing',
c3fc2621 365 'field' => [
e7a6b91a 366 0 => 'is_billing',
c3fc2621
CW
367 ],
368 'localizable' => FALSE,
e7a6b91a 369 'sig' => 'civicrm_phone::0::is_billing',
c3fc2621
CW
370 ],
371 'UI_mobile_provider_id' => [
e7a6b91a 372 'name' => 'UI_mobile_provider_id',
c3fc2621 373 'field' => [
e7a6b91a 374 0 => 'mobile_provider_id',
c3fc2621
CW
375 ],
376 'localizable' => FALSE,
e7a6b91a 377 'sig' => 'civicrm_phone::0::mobile_provider_id',
c3fc2621
CW
378 ],
379 'index_phone_numeric' => [
e7a6b91a 380 'name' => 'index_phone_numeric',
c3fc2621 381 'field' => [
e7a6b91a 382 0 => 'phone_numeric',
c3fc2621
CW
383 ],
384 'localizable' => FALSE,
e7a6b91a 385 'sig' => 'civicrm_phone::0::phone_numeric',
c3fc2621
CW
386 ],
387 ];
e7a6b91a
AS
388 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
389 }
c3fc2621 390
e501603b 391}