Merge pull request #11250 from agh1/no-update-indices
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:fed218269d1baab495490130b4e2442a)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Price_DAO_PriceFieldValue constructor.
39 */
40 class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_price_field_value';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Price Field Value
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * FK to civicrm_price_field
61 *
62 * @var int unsigned
63 */
64 public $price_field_id;
65 /**
66 * Price field option name
67 *
68 * @var string
69 */
70 public $name;
71 /**
72 * Price field option label
73 *
74 * @var string
75 */
76 public $label;
77 /**
78 * >Price field option description.
79 *
80 * @var text
81 */
82 public $description;
83 /**
84 * Price field option pre help text.
85 *
86 * @var text
87 */
88 public $help_pre;
89 /**
90 * Price field option post field help.
91 *
92 * @var text
93 */
94 public $help_post;
95 /**
96 * Price field option amount
97 *
98 * @var float
99 */
100 public $amount;
101 /**
102 * Number of participants per field option
103 *
104 * @var int unsigned
105 */
106 public $count;
107 /**
108 * Max number of participants per field options
109 *
110 * @var int unsigned
111 */
112 public $max_value;
113 /**
114 * Order in which the field options should appear
115 *
116 * @var int
117 */
118 public $weight;
119 /**
120 * FK to Membership Type
121 *
122 * @var int unsigned
123 */
124 public $membership_type_id;
125 /**
126 * Number of terms for this membership
127 *
128 * @var int unsigned
129 */
130 public $membership_num_terms;
131 /**
132 * Is this default price field option
133 *
134 * @var boolean
135 */
136 public $is_default;
137 /**
138 * Is this price field value active
139 *
140 * @var boolean
141 */
142 public $is_active;
143 /**
144 * FK to Financial Type.
145 *
146 * @var int unsigned
147 */
148 public $financial_type_id;
149 /**
150 * Portion of total amount which is NOT tax deductible.
151 *
152 * @var float
153 */
154 public $non_deductible_amount;
155 /**
156 * Implicit FK to civicrm_option_group with name = 'visibility'
157 *
158 * @var int unsigned
159 */
160 public $visibility_id;
161 /**
162 * Class constructor.
163 */
164 function __construct() {
165 $this->__table = 'civicrm_price_field_value';
166 parent::__construct();
167 }
168 /**
169 * Returns foreign keys and entity references.
170 *
171 * @return array
172 * [CRM_Core_Reference_Interface]
173 */
174 static function getReferenceColumns() {
175 if (!isset(Civi::$statics[__CLASS__]['links'])) {
176 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
177 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id');
178 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id');
179 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
180 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
181 }
182 return Civi::$statics[__CLASS__]['links'];
183 }
184 /**
185 * Returns all the column names of this table
186 *
187 * @return array
188 */
189 static function &fields() {
190 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
191 Civi::$statics[__CLASS__]['fields'] = array(
192 'id' => array(
193 'name' => 'id',
194 'type' => CRM_Utils_Type::T_INT,
195 'title' => ts('Price Field Value ID') ,
196 'description' => 'Price Field Value',
197 'required' => true,
198 'table_name' => 'civicrm_price_field_value',
199 'entity' => 'PriceFieldValue',
200 'bao' => 'CRM_Price_BAO_PriceFieldValue',
201 'localizable' => 0,
202 ) ,
203 'price_field_id' => array(
204 'name' => 'price_field_id',
205 'type' => CRM_Utils_Type::T_INT,
206 'title' => ts('Price Field') ,
207 'description' => 'FK to civicrm_price_field',
208 'required' => true,
209 'table_name' => 'civicrm_price_field_value',
210 'entity' => 'PriceFieldValue',
211 'bao' => 'CRM_Price_BAO_PriceFieldValue',
212 'localizable' => 0,
213 'FKClassName' => 'CRM_Price_DAO_PriceField',
214 ) ,
215 'name' => array(
216 'name' => 'name',
217 'type' => CRM_Utils_Type::T_STRING,
218 'title' => ts('Name') ,
219 'description' => 'Price field option name',
220 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
222 'table_name' => 'civicrm_price_field_value',
223 'entity' => 'PriceFieldValue',
224 'bao' => 'CRM_Price_BAO_PriceFieldValue',
225 'localizable' => 0,
226 'html' => array(
227 'type' => 'Text',
228 ) ,
229 ) ,
230 'label' => array(
231 'name' => 'label',
232 'type' => CRM_Utils_Type::T_STRING,
233 'title' => ts('Label') ,
234 'description' => 'Price field option label',
235 'maxlength' => 255,
236 'size' => CRM_Utils_Type::HUGE,
237 'table_name' => 'civicrm_price_field_value',
238 'entity' => 'PriceFieldValue',
239 'bao' => 'CRM_Price_BAO_PriceFieldValue',
240 'localizable' => 1,
241 'html' => array(
242 'type' => 'Text',
243 ) ,
244 ) ,
245 'description' => array(
246 'name' => 'description',
247 'type' => CRM_Utils_Type::T_TEXT,
248 'title' => ts('Description') ,
249 'description' => '>Price field option description.',
250 'rows' => 2,
251 'cols' => 60,
252 'default' => 'NULL',
253 'table_name' => 'civicrm_price_field_value',
254 'entity' => 'PriceFieldValue',
255 'bao' => 'CRM_Price_BAO_PriceFieldValue',
256 'localizable' => 1,
257 'html' => array(
258 'type' => 'TextArea',
259 ) ,
260 ) ,
261 'help_pre' => array(
262 'name' => 'help_pre',
263 'type' => CRM_Utils_Type::T_TEXT,
264 'title' => ts('Help Pre') ,
265 'description' => 'Price field option pre help text.',
266 'rows' => 2,
267 'cols' => 60,
268 'default' => 'NULL',
269 'table_name' => 'civicrm_price_field_value',
270 'entity' => 'PriceFieldValue',
271 'bao' => 'CRM_Price_BAO_PriceFieldValue',
272 'localizable' => 1,
273 'html' => array(
274 'type' => 'TextArea',
275 ) ,
276 ) ,
277 'help_post' => array(
278 'name' => 'help_post',
279 'type' => CRM_Utils_Type::T_TEXT,
280 'title' => ts('Help Post') ,
281 'description' => 'Price field option post field help.',
282 'rows' => 2,
283 'cols' => 60,
284 'default' => 'NULL',
285 'table_name' => 'civicrm_price_field_value',
286 'entity' => 'PriceFieldValue',
287 'bao' => 'CRM_Price_BAO_PriceFieldValue',
288 'localizable' => 1,
289 'html' => array(
290 'type' => 'TextArea',
291 ) ,
292 ) ,
293 'amount' => array(
294 'name' => 'amount',
295 'type' => CRM_Utils_Type::T_MONEY,
296 'title' => ts('Amount') ,
297 'description' => 'Price field option amount',
298 'required' => true,
299 'precision' => array(
300 18,
301 9
302 ) ,
303 'table_name' => 'civicrm_price_field_value',
304 'entity' => 'PriceFieldValue',
305 'bao' => 'CRM_Price_BAO_PriceFieldValue',
306 'localizable' => 0,
307 'html' => array(
308 'type' => 'Text',
309 ) ,
310 ) ,
311 'count' => array(
312 'name' => 'count',
313 'type' => CRM_Utils_Type::T_INT,
314 'title' => ts('Count') ,
315 'description' => 'Number of participants per field option',
316 'default' => 'NULL',
317 'table_name' => 'civicrm_price_field_value',
318 'entity' => 'PriceFieldValue',
319 'bao' => 'CRM_Price_BAO_PriceFieldValue',
320 'localizable' => 0,
321 'html' => array(
322 'type' => 'Text',
323 ) ,
324 ) ,
325 'max_value' => array(
326 'name' => 'max_value',
327 'type' => CRM_Utils_Type::T_INT,
328 'title' => ts('Max Value') ,
329 'description' => 'Max number of participants per field options',
330 'default' => 'NULL',
331 'table_name' => 'civicrm_price_field_value',
332 'entity' => 'PriceFieldValue',
333 'bao' => 'CRM_Price_BAO_PriceFieldValue',
334 'localizable' => 0,
335 'html' => array(
336 'type' => 'Text',
337 ) ,
338 ) ,
339 'weight' => array(
340 'name' => 'weight',
341 'type' => CRM_Utils_Type::T_INT,
342 'title' => ts('Order') ,
343 'description' => 'Order in which the field options should appear',
344 'default' => '1',
345 'table_name' => 'civicrm_price_field_value',
346 'entity' => 'PriceFieldValue',
347 'bao' => 'CRM_Price_BAO_PriceFieldValue',
348 'localizable' => 0,
349 'html' => array(
350 'type' => 'Text',
351 ) ,
352 ) ,
353 'membership_type_id' => array(
354 'name' => 'membership_type_id',
355 'type' => CRM_Utils_Type::T_INT,
356 'title' => ts('Membership Type') ,
357 'description' => 'FK to Membership Type',
358 'default' => 'NULL',
359 'table_name' => 'civicrm_price_field_value',
360 'entity' => 'PriceFieldValue',
361 'bao' => 'CRM_Price_BAO_PriceFieldValue',
362 'localizable' => 0,
363 'FKClassName' => 'CRM_Member_DAO_MembershipType',
364 'html' => array(
365 'type' => 'Select',
366 ) ,
367 ) ,
368 'membership_num_terms' => array(
369 'name' => 'membership_num_terms',
370 'type' => CRM_Utils_Type::T_INT,
371 'title' => ts('Membership Num Terms') ,
372 'description' => 'Number of terms for this membership',
373 'default' => 'NULL',
374 'table_name' => 'civicrm_price_field_value',
375 'entity' => 'PriceFieldValue',
376 'bao' => 'CRM_Price_BAO_PriceFieldValue',
377 'localizable' => 0,
378 'html' => array(
379 'type' => 'Text',
380 ) ,
381 ) ,
382 'is_default' => array(
383 'name' => 'is_default',
384 'type' => CRM_Utils_Type::T_BOOLEAN,
385 'title' => ts('Is Default Price Field Option?') ,
386 'description' => 'Is this default price field option',
387 'table_name' => 'civicrm_price_field_value',
388 'entity' => 'PriceFieldValue',
389 'bao' => 'CRM_Price_BAO_PriceFieldValue',
390 'localizable' => 0,
391 'html' => array(
392 'type' => 'CheckBox',
393 ) ,
394 ) ,
395 'is_active' => array(
396 'name' => 'is_active',
397 'type' => CRM_Utils_Type::T_BOOLEAN,
398 'title' => ts('Price Field Value is Active') ,
399 'description' => 'Is this price field value active',
400 'default' => '1',
401 'table_name' => 'civicrm_price_field_value',
402 'entity' => 'PriceFieldValue',
403 'bao' => 'CRM_Price_BAO_PriceFieldValue',
404 'localizable' => 0,
405 ) ,
406 'financial_type_id' => array(
407 'name' => 'financial_type_id',
408 'type' => CRM_Utils_Type::T_INT,
409 'title' => ts('Financial Type') ,
410 'description' => 'FK to Financial Type.',
411 'default' => 'NULL',
412 'table_name' => 'civicrm_price_field_value',
413 'entity' => 'PriceFieldValue',
414 'bao' => 'CRM_Price_BAO_PriceFieldValue',
415 'localizable' => 0,
416 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
417 'html' => array(
418 'type' => 'Select',
419 ) ,
420 'pseudoconstant' => array(
421 'table' => 'civicrm_financial_type',
422 'keyColumn' => 'id',
423 'labelColumn' => 'name',
424 )
425 ) ,
426 'non_deductible_amount' => array(
427 'name' => 'non_deductible_amount',
428 'type' => CRM_Utils_Type::T_MONEY,
429 'title' => ts('Non-deductible Amount') ,
430 'description' => 'Portion of total amount which is NOT tax deductible.',
431 'required' => true,
432 'precision' => array(
433 20,
434 2
435 ) ,
436 'default' => '0.0',
437 'table_name' => 'civicrm_price_field_value',
438 'entity' => 'PriceFieldValue',
439 'bao' => 'CRM_Price_BAO_PriceFieldValue',
440 'localizable' => 0,
441 'html' => array(
442 'type' => 'Text',
443 ) ,
444 ) ,
445 'visibility_id' => array(
446 'name' => 'visibility_id',
447 'type' => CRM_Utils_Type::T_INT,
448 'title' => ts('Price Field Option Visibility') ,
449 'description' => 'Implicit FK to civicrm_option_group with name = \'visibility\'',
450 'default' => '1',
451 'table_name' => 'civicrm_price_field_value',
452 'entity' => 'PriceFieldValue',
453 'bao' => 'CRM_Price_BAO_PriceFieldValue',
454 'localizable' => 0,
455 'html' => array(
456 'type' => 'Select',
457 ) ,
458 'pseudoconstant' => array(
459 'optionGroupName' => 'visibility',
460 'optionEditPath' => 'civicrm/admin/options/visibility',
461 )
462 ) ,
463 );
464 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
465 }
466 return Civi::$statics[__CLASS__]['fields'];
467 }
468 /**
469 * Return a mapping from field-name to the corresponding key (as used in fields()).
470 *
471 * @return array
472 * Array(string $name => string $uniqueName).
473 */
474 static function &fieldKeys() {
475 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
476 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
477 }
478 return Civi::$statics[__CLASS__]['fieldKeys'];
479 }
480 /**
481 * Returns the names of this table
482 *
483 * @return string
484 */
485 static function getTableName() {
486 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
487 }
488 /**
489 * Returns if this table needs to be logged
490 *
491 * @return boolean
492 */
493 function getLog() {
494 return self::$_log;
495 }
496 /**
497 * Returns the list of fields that can be imported
498 *
499 * @param bool $prefix
500 *
501 * @return array
502 */
503 static function &import($prefix = false) {
504 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, array());
505 return $r;
506 }
507 /**
508 * Returns the list of fields that can be exported
509 *
510 * @param bool $prefix
511 *
512 * @return array
513 */
514 static function &export($prefix = false) {
515 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, array());
516 return $r;
517 }
518 /**
519 * Returns the list of indices
520 */
521 public static function indices($localize = TRUE) {
522 $indices = array();
523 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
524 }
525 }