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