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