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