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