Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Price/PriceField.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
7b66c3b5 | 9 | * (GenCodeChecksum:fdebc45a7d5c35abb0c9c480dbf201b2) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the PriceField entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Price_DAO_PriceField extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.8'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_price_field'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = TRUE; |
c3fc2621 | 32 | |
e501603b TO |
33 | /** |
34 | * Price Field | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * FK to civicrm_price_set | |
42 | * | |
e6ca0a57 | 43 | * @var int |
e501603b TO |
44 | */ |
45 | public $price_set_id; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * Variable name/programmatic handle for this field. | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $name; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * Text for form field label (also friendly name for administering this field). | |
56 | * | |
57 | * @var string | |
58 | */ | |
59 | public $label; | |
c3fc2621 | 60 | |
e501603b | 61 | /** |
e501603b TO |
62 | * @var string |
63 | */ | |
64 | public $html_type; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Enter a quantity for this field? | |
68 | * | |
e6ca0a57 | 69 | * @var bool |
e501603b TO |
70 | */ |
71 | public $is_enter_qty; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Description and/or help text to display before this field. | |
75 | * | |
76 | * @var text | |
77 | */ | |
78 | public $help_pre; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Description and/or help text to display after this field. | |
82 | * | |
83 | * @var text | |
84 | */ | |
85 | public $help_post; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * Order in which the fields should appear | |
89 | * | |
90 | * @var int | |
91 | */ | |
92 | public $weight; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Should the price be displayed next to the label for each option? | |
96 | * | |
e6ca0a57 | 97 | * @var bool |
e501603b TO |
98 | */ |
99 | public $is_display_amounts; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * number of options per line for checkbox and radio | |
103 | * | |
e6ca0a57 | 104 | * @var int |
e501603b TO |
105 | */ |
106 | public $options_per_line; | |
c3fc2621 | 107 | |
e501603b TO |
108 | /** |
109 | * Is this price field active | |
110 | * | |
e6ca0a57 | 111 | * @var bool |
e501603b TO |
112 | */ |
113 | public $is_active; | |
c3fc2621 | 114 | |
e501603b TO |
115 | /** |
116 | * Is this price field required (value must be > 1) | |
117 | * | |
e6ca0a57 | 118 | * @var bool |
e501603b TO |
119 | */ |
120 | public $is_required; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * If non-zero, do not show this field before the date specified | |
124 | * | |
125 | * @var datetime | |
126 | */ | |
127 | public $active_on; | |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * If non-zero, do not show this field after the date specified | |
131 | * | |
132 | * @var datetime | |
133 | */ | |
134 | public $expire_on; | |
c3fc2621 | 135 | |
e501603b TO |
136 | /** |
137 | * Optional scripting attributes for field | |
138 | * | |
139 | * @var string | |
140 | */ | |
141 | public $javascript; | |
c3fc2621 | 142 | |
e501603b TO |
143 | /** |
144 | * Implicit FK to civicrm_option_group with name = 'visibility' | |
145 | * | |
e6ca0a57 | 146 | * @var int |
e501603b TO |
147 | */ |
148 | public $visibility_id; | |
c3fc2621 | 149 | |
e501603b | 150 | /** |
f41f0342 | 151 | * Class constructor. |
e501603b | 152 | */ |
c3fc2621 | 153 | public function __construct() { |
e501603b TO |
154 | $this->__table = 'civicrm_price_field'; |
155 | parent::__construct(); | |
156 | } | |
c3fc2621 | 157 | |
449c4e6b CW |
158 | /** |
159 | * Returns localized title of this entity. | |
7b66c3b5 AH |
160 | * |
161 | * @param bool $plural | |
162 | * Whether to return the plural version of the title. | |
449c4e6b | 163 | */ |
7b66c3b5 AH |
164 | public static function getEntityTitle($plural = FALSE) { |
165 | return $plural ? ts('Price Fields') : ts('Price Field'); | |
449c4e6b CW |
166 | } |
167 | ||
e501603b | 168 | /** |
f41f0342 | 169 | * Returns foreign keys and entity references. |
e501603b TO |
170 | * |
171 | * @return array | |
172 | * [CRM_Core_Reference_Interface] | |
173 | */ | |
c3fc2621 | 174 | public static function getReferenceColumns() { |
346aaaba | 175 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 176 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 177 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id'); |
346aaaba | 178 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 179 | } |
346aaaba | 180 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 181 | } |
c3fc2621 | 182 | |
e501603b TO |
183 | /** |
184 | * Returns all the column names of this table | |
185 | * | |
186 | * @return array | |
187 | */ | |
c3fc2621 | 188 | public static function &fields() { |
346aaaba | 189 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
190 | Civi::$statics[__CLASS__]['fields'] = [ |
191 | 'id' => [ | |
e501603b TO |
192 | 'name' => 'id', |
193 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 194 | 'title' => ts('Price Field ID'), |
215b423e | 195 | 'description' => ts('Price Field'), |
c3fc2621 | 196 | 'required' => TRUE, |
a36434b9 | 197 | 'where' => 'civicrm_price_field.id', |
522a26c9 | 198 | 'table_name' => 'civicrm_price_field', |
199 | 'entity' => 'PriceField', | |
200 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 201 | 'localizable' => 0, |
a9d0587b | 202 | 'add' => '1.8', |
c3fc2621 CW |
203 | ], |
204 | 'price_set_id' => [ | |
e501603b TO |
205 | 'name' => 'price_set_id', |
206 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 207 | 'title' => ts('Price Set'), |
215b423e | 208 | 'description' => ts('FK to civicrm_price_set'), |
c3fc2621 | 209 | 'required' => TRUE, |
a36434b9 | 210 | 'where' => 'civicrm_price_field.price_set_id', |
522a26c9 | 211 | 'table_name' => 'civicrm_price_field', |
212 | 'entity' => 'PriceField', | |
213 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 214 | 'localizable' => 0, |
e501603b | 215 | 'FKClassName' => 'CRM_Price_DAO_PriceSet', |
56616a73 PN |
216 | 'pseudoconstant' => [ |
217 | 'table' => 'civicrm_price_set', | |
218 | 'keyColumn' => 'id', | |
219 | 'labelColumn' => 'title', | |
4f238b49 | 220 | 'nameColumn' => 'name', |
56616a73 | 221 | ], |
a9d0587b | 222 | 'add' => '1.8', |
c3fc2621 CW |
223 | ], |
224 | 'name' => [ | |
e501603b TO |
225 | 'name' => 'name', |
226 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 227 | 'title' => ts('Name'), |
215b423e | 228 | 'description' => ts('Variable name/programmatic handle for this field.'), |
c3fc2621 | 229 | 'required' => TRUE, |
e501603b TO |
230 | 'maxlength' => 255, |
231 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 232 | 'where' => 'civicrm_price_field.name', |
522a26c9 | 233 | 'table_name' => 'civicrm_price_field', |
234 | 'entity' => 'PriceField', | |
235 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 236 | 'localizable' => 0, |
c3fc2621 | 237 | 'html' => [ |
e501603b | 238 | 'type' => 'Text', |
c3fc2621 | 239 | ], |
a9d0587b | 240 | 'add' => '1.8', |
c3fc2621 CW |
241 | ], |
242 | 'label' => [ | |
e501603b TO |
243 | 'name' => 'label', |
244 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 245 | 'title' => ts('Label'), |
215b423e | 246 | 'description' => ts('Text for form field label (also friendly name for administering this field).'), |
c3fc2621 | 247 | 'required' => TRUE, |
e501603b TO |
248 | 'maxlength' => 255, |
249 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 250 | 'where' => 'civicrm_price_field.label', |
522a26c9 | 251 | 'table_name' => 'civicrm_price_field', |
252 | 'entity' => 'PriceField', | |
253 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 254 | 'localizable' => 1, |
c3fc2621 | 255 | 'html' => [ |
e501603b | 256 | 'type' => 'Text', |
c3fc2621 | 257 | ], |
a9d0587b | 258 | 'add' => '1.8', |
c3fc2621 CW |
259 | ], |
260 | 'html_type' => [ | |
e501603b TO |
261 | 'name' => 'html_type', |
262 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 CW |
263 | 'title' => ts('Html Type'), |
264 | 'required' => TRUE, | |
e501603b TO |
265 | 'maxlength' => 12, |
266 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 267 | 'where' => 'civicrm_price_field.html_type', |
522a26c9 | 268 | 'table_name' => 'civicrm_price_field', |
269 | 'entity' => 'PriceField', | |
270 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 271 | 'localizable' => 0, |
c3fc2621 | 272 | 'html' => [ |
e501603b | 273 | 'type' => 'Select', |
c3fc2621 CW |
274 | ], |
275 | 'pseudoconstant' => [ | |
e501603b | 276 | 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes', |
e6ca0a57 | 277 | ], |
a9d0587b | 278 | 'add' => '1.8', |
c3fc2621 CW |
279 | ], |
280 | 'is_enter_qty' => [ | |
e501603b TO |
281 | 'name' => 'is_enter_qty', |
282 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 283 | 'title' => ts('Price Field Quantity Required?'), |
215b423e | 284 | 'description' => ts('Enter a quantity for this field?'), |
a36434b9 | 285 | 'where' => 'civicrm_price_field.is_enter_qty', |
45a83e42 | 286 | 'default' => '0', |
522a26c9 | 287 | 'table_name' => 'civicrm_price_field', |
288 | 'entity' => 'PriceField', | |
289 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 290 | 'localizable' => 0, |
c3fc2621 | 291 | 'html' => [ |
e501603b | 292 | 'type' => 'CheckBox', |
c3fc2621 | 293 | ], |
a9d0587b | 294 | 'add' => '1.8', |
c3fc2621 CW |
295 | ], |
296 | 'help_pre' => [ | |
e501603b TO |
297 | 'name' => 'help_pre', |
298 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 299 | 'title' => ts('Price Field Pre Text'), |
215b423e | 300 | 'description' => ts('Description and/or help text to display before this field.'), |
e501603b TO |
301 | 'rows' => 4, |
302 | 'cols' => 80, | |
a36434b9 | 303 | 'where' => 'civicrm_price_field.help_pre', |
522a26c9 | 304 | 'table_name' => 'civicrm_price_field', |
305 | 'entity' => 'PriceField', | |
306 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 307 | 'localizable' => 1, |
c3fc2621 | 308 | 'html' => [ |
e501603b | 309 | 'type' => 'TextArea', |
c3fc2621 | 310 | ], |
a9d0587b | 311 | 'add' => '1.8', |
c3fc2621 CW |
312 | ], |
313 | 'help_post' => [ | |
e501603b TO |
314 | 'name' => 'help_post', |
315 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 316 | 'title' => ts('Price Field Post Text'), |
215b423e | 317 | 'description' => ts('Description and/or help text to display after this field.'), |
e501603b TO |
318 | 'rows' => 4, |
319 | 'cols' => 80, | |
a36434b9 | 320 | 'where' => 'civicrm_price_field.help_post', |
522a26c9 | 321 | 'table_name' => 'civicrm_price_field', |
322 | 'entity' => 'PriceField', | |
323 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 324 | 'localizable' => 1, |
c3fc2621 | 325 | 'html' => [ |
e501603b | 326 | 'type' => 'TextArea', |
c3fc2621 | 327 | ], |
a9d0587b | 328 | 'add' => '1.8', |
c3fc2621 CW |
329 | ], |
330 | 'weight' => [ | |
e501603b TO |
331 | 'name' => 'weight', |
332 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 333 | 'title' => ts('Order'), |
215b423e | 334 | 'description' => ts('Order in which the fields should appear'), |
a36434b9 | 335 | 'where' => 'civicrm_price_field.weight', |
e501603b | 336 | 'default' => '1', |
522a26c9 | 337 | 'table_name' => 'civicrm_price_field', |
338 | 'entity' => 'PriceField', | |
339 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 340 | 'localizable' => 0, |
c3fc2621 | 341 | 'html' => [ |
e501603b | 342 | 'type' => 'Select', |
c3fc2621 | 343 | ], |
a9d0587b | 344 | 'add' => '1.8', |
c3fc2621 CW |
345 | ], |
346 | 'is_display_amounts' => [ | |
e501603b TO |
347 | 'name' => 'is_display_amounts', |
348 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 349 | 'title' => ts('Price Field Show Amounts?'), |
215b423e | 350 | 'description' => ts('Should the price be displayed next to the label for each option?'), |
a36434b9 | 351 | 'where' => 'civicrm_price_field.is_display_amounts', |
e501603b | 352 | 'default' => '1', |
522a26c9 | 353 | 'table_name' => 'civicrm_price_field', |
354 | 'entity' => 'PriceField', | |
355 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 356 | 'localizable' => 0, |
c3fc2621 | 357 | 'html' => [ |
e501603b | 358 | 'type' => 'CheckBox', |
c3fc2621 | 359 | ], |
a9d0587b | 360 | 'add' => NULL, |
c3fc2621 CW |
361 | ], |
362 | 'options_per_line' => [ | |
e501603b TO |
363 | 'name' => 'options_per_line', |
364 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 365 | 'title' => ts('Price Field Options per Row'), |
215b423e | 366 | 'description' => ts('number of options per line for checkbox and radio'), |
a36434b9 | 367 | 'where' => 'civicrm_price_field.options_per_line', |
e501603b | 368 | 'default' => '1', |
522a26c9 | 369 | 'table_name' => 'civicrm_price_field', |
370 | 'entity' => 'PriceField', | |
371 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 372 | 'localizable' => 0, |
c3fc2621 | 373 | 'html' => [ |
e501603b | 374 | 'type' => 'Text', |
c3fc2621 | 375 | ], |
a9d0587b | 376 | 'add' => '1.8', |
c3fc2621 CW |
377 | ], |
378 | 'is_active' => [ | |
e501603b TO |
379 | 'name' => 'is_active', |
380 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 381 | 'title' => ts('Price Field Is Active?'), |
215b423e | 382 | 'description' => ts('Is this price field active'), |
a36434b9 | 383 | 'where' => 'civicrm_price_field.is_active', |
e501603b | 384 | 'default' => '1', |
522a26c9 | 385 | 'table_name' => 'civicrm_price_field', |
386 | 'entity' => 'PriceField', | |
387 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 388 | 'localizable' => 0, |
c3fc2621 | 389 | 'html' => [ |
e501603b | 390 | 'type' => 'CheckBox', |
c3fc2621 | 391 | ], |
a9d0587b | 392 | 'add' => '1.8', |
c3fc2621 CW |
393 | ], |
394 | 'is_required' => [ | |
e501603b TO |
395 | 'name' => 'is_required', |
396 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 397 | 'title' => ts('Price Field is Required?'), |
215b423e | 398 | 'description' => ts('Is this price field required (value must be > 1)'), |
a36434b9 | 399 | 'where' => 'civicrm_price_field.is_required', |
e501603b | 400 | 'default' => '1', |
522a26c9 | 401 | 'table_name' => 'civicrm_price_field', |
402 | 'entity' => 'PriceField', | |
403 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 404 | 'localizable' => 0, |
c3fc2621 | 405 | 'html' => [ |
e501603b | 406 | 'type' => 'CheckBox', |
c3fc2621 | 407 | ], |
a9d0587b | 408 | 'add' => '1.8', |
c3fc2621 CW |
409 | ], |
410 | 'active_on' => [ | |
e501603b TO |
411 | 'name' => 'active_on', |
412 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 413 | 'title' => ts('Price Field Start Date'), |
215b423e | 414 | 'description' => ts('If non-zero, do not show this field before the date specified'), |
a36434b9 | 415 | 'where' => 'civicrm_price_field.active_on', |
e501603b | 416 | 'default' => 'NULL', |
522a26c9 | 417 | 'table_name' => 'civicrm_price_field', |
418 | 'entity' => 'PriceField', | |
419 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 420 | 'localizable' => 0, |
c3fc2621 | 421 | 'html' => [ |
70a44aee SL |
422 | 'type' => 'Select Date', |
423 | 'formatType' => 'activityDateTime', | |
c3fc2621 | 424 | ], |
a9d0587b | 425 | 'add' => '1.8', |
c3fc2621 CW |
426 | ], |
427 | 'expire_on' => [ | |
e501603b TO |
428 | 'name' => 'expire_on', |
429 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 430 | 'title' => ts('Price Field End Date'), |
215b423e | 431 | 'description' => ts('If non-zero, do not show this field after the date specified'), |
a36434b9 | 432 | 'where' => 'civicrm_price_field.expire_on', |
e501603b | 433 | 'default' => 'NULL', |
522a26c9 | 434 | 'table_name' => 'civicrm_price_field', |
435 | 'entity' => 'PriceField', | |
436 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 437 | 'localizable' => 0, |
c3fc2621 | 438 | 'html' => [ |
e501603b | 439 | 'type' => 'Select Date', |
70a44aee | 440 | 'formatType' => 'activityDateTime', |
c3fc2621 | 441 | ], |
a9d0587b | 442 | 'add' => '1.8', |
c3fc2621 CW |
443 | ], |
444 | 'javascript' => [ | |
e501603b TO |
445 | 'name' => 'javascript', |
446 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 447 | 'title' => ts('Price Field Javascript'), |
215b423e | 448 | 'description' => ts('Optional scripting attributes for field'), |
e501603b TO |
449 | 'maxlength' => 255, |
450 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 451 | 'where' => 'civicrm_price_field.javascript', |
522a26c9 | 452 | 'table_name' => 'civicrm_price_field', |
453 | 'entity' => 'PriceField', | |
454 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 455 | 'localizable' => 0, |
c3fc2621 | 456 | 'html' => [ |
e501603b | 457 | 'type' => 'Text', |
c3fc2621 | 458 | ], |
a9d0587b | 459 | 'add' => '1.8', |
c3fc2621 CW |
460 | ], |
461 | 'visibility_id' => [ | |
e501603b TO |
462 | 'name' => 'visibility_id', |
463 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 464 | 'title' => ts('Price Field Visibility'), |
215b423e | 465 | 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''), |
a36434b9 | 466 | 'where' => 'civicrm_price_field.visibility_id', |
e501603b | 467 | 'default' => '1', |
522a26c9 | 468 | 'table_name' => 'civicrm_price_field', |
469 | 'entity' => 'PriceField', | |
470 | 'bao' => 'CRM_Price_BAO_PriceField', | |
6a7e5e5d | 471 | 'localizable' => 0, |
c3fc2621 | 472 | 'html' => [ |
e501603b | 473 | 'type' => 'Select', |
c3fc2621 CW |
474 | ], |
475 | 'pseudoconstant' => [ | |
e501603b TO |
476 | 'optionGroupName' => 'visibility', |
477 | 'optionEditPath' => 'civicrm/admin/options/visibility', | |
e6ca0a57 | 478 | ], |
a9d0587b | 479 | 'add' => '3.2', |
c3fc2621 CW |
480 | ], |
481 | ]; | |
346aaaba | 482 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 483 | } |
346aaaba | 484 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 485 | } |
c3fc2621 | 486 | |
e501603b | 487 | /** |
bd8e0b14 | 488 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
489 | * |
490 | * @return array | |
bd8e0b14 | 491 | * Array(string $name => string $uniqueName). |
e501603b | 492 | */ |
c3fc2621 | 493 | public static function &fieldKeys() { |
bd8e0b14 TO |
494 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
495 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 496 | } |
bd8e0b14 | 497 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 498 | } |
c3fc2621 | 499 | |
e501603b TO |
500 | /** |
501 | * Returns the names of this table | |
502 | * | |
503 | * @return string | |
504 | */ | |
c3fc2621 | 505 | public static function getTableName() { |
e501603b TO |
506 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
507 | } | |
c3fc2621 | 508 | |
e501603b TO |
509 | /** |
510 | * Returns if this table needs to be logged | |
511 | * | |
c3fc2621 | 512 | * @return bool |
e501603b | 513 | */ |
c3fc2621 | 514 | public function getLog() { |
e501603b TO |
515 | return self::$_log; |
516 | } | |
c3fc2621 | 517 | |
e501603b TO |
518 | /** |
519 | * Returns the list of fields that can be imported | |
520 | * | |
521 | * @param bool $prefix | |
522 | * | |
523 | * @return array | |
524 | */ | |
c3fc2621 CW |
525 | public static function &import($prefix = FALSE) { |
526 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field', $prefix, []); | |
60808919 | 527 | return $r; |
e501603b | 528 | } |
c3fc2621 | 529 | |
e501603b TO |
530 | /** |
531 | * Returns the list of fields that can be exported | |
532 | * | |
533 | * @param bool $prefix | |
534 | * | |
535 | * @return array | |
536 | */ | |
c3fc2621 CW |
537 | public static function &export($prefix = FALSE) { |
538 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field', $prefix, []); | |
60808919 | 539 | return $r; |
e501603b | 540 | } |
c3fc2621 | 541 | |
e7a6b91a AS |
542 | /** |
543 | * Returns the list of indices | |
c3fc2621 CW |
544 | * |
545 | * @param bool $localize | |
546 | * | |
547 | * @return array | |
e7a6b91a AS |
548 | */ |
549 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
550 | $indices = [ |
551 | 'index_name' => [ | |
e7a6b91a | 552 | 'name' => 'index_name', |
c3fc2621 | 553 | 'field' => [ |
e7a6b91a | 554 | 0 => 'name', |
c3fc2621 CW |
555 | ], |
556 | 'localizable' => FALSE, | |
e7a6b91a | 557 | 'sig' => 'civicrm_price_field::0::name', |
c3fc2621 CW |
558 | ], |
559 | ]; | |
e7a6b91a AS |
560 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
561 | } | |
c3fc2621 | 562 | |
e501603b | 563 | } |