Merge remote-tracking branch 'agh1/4.7.26-releasenotes' into 4.7.27-rc-notes
[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:d5b9853fb1321ad9872ce5b11a582d81)
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 string
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_STRING,
296 'title' => ts('Amount') ,
297 'description' => 'Price field option amount',
298 'required' => true,
299 'maxlength' => 512,
300 'size' => 8,
301 'table_name' => 'civicrm_price_field_value',
302 'entity' => 'PriceFieldValue',
303 'bao' => 'CRM_Price_BAO_PriceFieldValue',
304 'localizable' => 0,
305 'html' => array(
306 'type' => 'Text',
307 ) ,
308 ) ,
309 'count' => array(
310 'name' => 'count',
311 'type' => CRM_Utils_Type::T_INT,
312 'title' => ts('Count') ,
313 'description' => 'Number of participants per field option',
314 'default' => 'NULL',
315 'table_name' => 'civicrm_price_field_value',
316 'entity' => 'PriceFieldValue',
317 'bao' => 'CRM_Price_BAO_PriceFieldValue',
318 'localizable' => 0,
319 'html' => array(
320 'type' => 'Text',
321 ) ,
322 ) ,
323 'max_value' => array(
324 'name' => 'max_value',
325 'type' => CRM_Utils_Type::T_INT,
326 'title' => ts('Max Value') ,
327 'description' => 'Max number of participants per field options',
328 'default' => 'NULL',
329 'table_name' => 'civicrm_price_field_value',
330 'entity' => 'PriceFieldValue',
331 'bao' => 'CRM_Price_BAO_PriceFieldValue',
332 'localizable' => 0,
333 'html' => array(
334 'type' => 'Text',
335 ) ,
336 ) ,
337 'weight' => array(
338 'name' => 'weight',
339 'type' => CRM_Utils_Type::T_INT,
340 'title' => ts('Order') ,
341 'description' => 'Order in which the field options should appear',
342 'default' => '1',
343 'table_name' => 'civicrm_price_field_value',
344 'entity' => 'PriceFieldValue',
345 'bao' => 'CRM_Price_BAO_PriceFieldValue',
346 'localizable' => 0,
347 'html' => array(
348 'type' => 'Text',
349 ) ,
350 ) ,
351 'membership_type_id' => array(
352 'name' => 'membership_type_id',
353 'type' => CRM_Utils_Type::T_INT,
354 'title' => ts('Membership Type') ,
355 'description' => 'FK to Membership Type',
356 'default' => 'NULL',
357 'table_name' => 'civicrm_price_field_value',
358 'entity' => 'PriceFieldValue',
359 'bao' => 'CRM_Price_BAO_PriceFieldValue',
360 'localizable' => 0,
361 'FKClassName' => 'CRM_Member_DAO_MembershipType',
362 'html' => array(
363 'type' => 'Select',
364 ) ,
365 ) ,
366 'membership_num_terms' => array(
367 'name' => 'membership_num_terms',
368 'type' => CRM_Utils_Type::T_INT,
369 'title' => ts('Membership Num Terms') ,
370 'description' => 'Number of terms for this membership',
371 'default' => 'NULL',
372 'table_name' => 'civicrm_price_field_value',
373 'entity' => 'PriceFieldValue',
374 'bao' => 'CRM_Price_BAO_PriceFieldValue',
375 'localizable' => 0,
376 'html' => array(
377 'type' => 'Text',
378 ) ,
379 ) ,
380 'is_default' => array(
381 'name' => 'is_default',
382 'type' => CRM_Utils_Type::T_BOOLEAN,
383 'title' => ts('Is Default Price Field Option?') ,
384 'description' => 'Is this default price field option',
385 'table_name' => 'civicrm_price_field_value',
386 'entity' => 'PriceFieldValue',
387 'bao' => 'CRM_Price_BAO_PriceFieldValue',
388 'localizable' => 0,
389 'html' => array(
390 'type' => 'CheckBox',
391 ) ,
392 ) ,
393 'is_active' => array(
394 'name' => 'is_active',
395 'type' => CRM_Utils_Type::T_BOOLEAN,
396 'title' => ts('Price Field Value is Active') ,
397 'description' => 'Is this price field value active',
398 'default' => '1',
399 'table_name' => 'civicrm_price_field_value',
400 'entity' => 'PriceFieldValue',
401 'bao' => 'CRM_Price_BAO_PriceFieldValue',
402 'localizable' => 0,
403 ) ,
404 'financial_type_id' => array(
405 'name' => 'financial_type_id',
406 'type' => CRM_Utils_Type::T_INT,
407 'title' => ts('Financial Type') ,
408 'description' => 'FK to Financial Type.',
409 'default' => 'NULL',
410 'table_name' => 'civicrm_price_field_value',
411 'entity' => 'PriceFieldValue',
412 'bao' => 'CRM_Price_BAO_PriceFieldValue',
413 'localizable' => 0,
414 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
415 'html' => array(
416 'type' => 'Select',
417 ) ,
418 'pseudoconstant' => array(
419 'table' => 'civicrm_financial_type',
420 'keyColumn' => 'id',
421 'labelColumn' => 'name',
422 )
423 ) ,
424 'non_deductible_amount' => array(
425 'name' => 'non_deductible_amount',
426 'type' => CRM_Utils_Type::T_MONEY,
427 'title' => ts('Non-deductible Amount') ,
428 'description' => 'Portion of total amount which is NOT tax deductible.',
429 'required' => true,
430 'precision' => array(
431 20,
432 2
433 ) ,
434 'default' => '0.0',
435 'table_name' => 'civicrm_price_field_value',
436 'entity' => 'PriceFieldValue',
437 'bao' => 'CRM_Price_BAO_PriceFieldValue',
438 'localizable' => 0,
439 'html' => array(
440 'type' => 'Text',
441 ) ,
442 ) ,
443 'visibility_id' => array(
444 'name' => 'visibility_id',
445 'type' => CRM_Utils_Type::T_INT,
446 'title' => ts('Price Field Option Visibility') ,
447 'description' => 'Implicit FK to civicrm_option_group with name = \'visibility\'',
448 'default' => '1',
449 'table_name' => 'civicrm_price_field_value',
450 'entity' => 'PriceFieldValue',
451 'bao' => 'CRM_Price_BAO_PriceFieldValue',
452 'localizable' => 0,
453 'html' => array(
454 'type' => 'Select',
455 ) ,
456 'pseudoconstant' => array(
457 'optionGroupName' => 'visibility',
458 'optionEditPath' => 'civicrm/admin/options/visibility',
459 )
460 ) ,
461 );
462 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
463 }
464 return Civi::$statics[__CLASS__]['fields'];
465 }
466 /**
467 * Return a mapping from field-name to the corresponding key (as used in fields()).
468 *
469 * @return array
470 * Array(string $name => string $uniqueName).
471 */
472 static function &fieldKeys() {
473 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
474 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
475 }
476 return Civi::$statics[__CLASS__]['fieldKeys'];
477 }
478 /**
479 * Returns the names of this table
480 *
481 * @return string
482 */
483 static function getTableName() {
484 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
485 }
486 /**
487 * Returns if this table needs to be logged
488 *
489 * @return boolean
490 */
491 function getLog() {
492 return self::$_log;
493 }
494 /**
495 * Returns the list of fields that can be imported
496 *
497 * @param bool $prefix
498 *
499 * @return array
500 */
501 static function &import($prefix = false) {
502 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, array());
503 return $r;
504 }
505 /**
506 * Returns the list of fields that can be exported
507 *
508 * @param bool $prefix
509 *
510 * @return array
511 */
512 static function &export($prefix = false) {
513 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, array());
514 return $r;
515 }
516 /**
517 * Returns the list of indices
518 */
519 public static function indices($localize = TRUE) {
520 $indices = array();
521 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
522 }
523 }