Merge pull request #9668 from colemanw/CRM-19864
[civicrm-core.git] / CRM / Price / DAO / PriceSet.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/PriceSet.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:80d53a8eb9ccb6a4fe13148a41fb30d1)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Price_DAO_PriceSet constructor.
39 */
40 class CRM_Price_DAO_PriceSet extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_price_set';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Price Set
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Which Domain is this price-set for
61 *
62 * @var int unsigned
63 */
64 public $domain_id;
65 /**
66 * Variable name/programmatic handle for this set of price fields.
67 *
68 * @var string
69 */
70 public $name;
71 /**
72 * Displayed title for the Price Set.
73 *
74 * @var string
75 */
76 public $title;
77 /**
78 * Is this price set active
79 *
80 * @var boolean
81 */
82 public $is_active;
83 /**
84 * Description and/or help text to display before fields in form.
85 *
86 * @var text
87 */
88 public $help_pre;
89 /**
90 * Description and/or help text to display after fields in form.
91 *
92 * @var text
93 */
94 public $help_post;
95 /**
96 * Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional
97 *
98 * @var string
99 */
100 public $javascript;
101 /**
102 * What components are using this price set?
103 *
104 * @var string
105 */
106 public $extends;
107 /**
108 * FK to Financial Type(for membership price sets only).
109 *
110 * @var int unsigned
111 */
112 public $financial_type_id;
113 /**
114 * Is set if edited on Contribution or Event Page rather than through Manage Price Sets
115 *
116 * @var boolean
117 */
118 public $is_quick_config;
119 /**
120 * Is this a predefined system price set (i.e. it can not be deleted, edited)?
121 *
122 * @var boolean
123 */
124 public $is_reserved;
125 /**
126 * Minimum Amount required for this set.
127 *
128 * @var int unsigned
129 */
130 public $min_amount;
131 /**
132 * Class constructor.
133 */
134 function __construct() {
135 $this->__table = 'civicrm_price_set';
136 parent::__construct();
137 }
138 /**
139 * Returns foreign keys and entity references.
140 *
141 * @return array
142 * [CRM_Core_Reference_Interface]
143 */
144 static function getReferenceColumns() {
145 if (!isset(Civi::$statics[__CLASS__]['links'])) {
146 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
147 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
148 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
149 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
150 }
151 return Civi::$statics[__CLASS__]['links'];
152 }
153 /**
154 * Returns all the column names of this table
155 *
156 * @return array
157 */
158 static function &fields() {
159 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
160 Civi::$statics[__CLASS__]['fields'] = array(
161 'id' => array(
162 'name' => 'id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Price Set ID') ,
165 'description' => 'Price Set',
166 'required' => true,
167 'table_name' => 'civicrm_price_set',
168 'entity' => 'PriceSet',
169 'bao' => 'CRM_Price_BAO_PriceSet',
170 ) ,
171 'domain_id' => array(
172 'name' => 'domain_id',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Price Set Domain') ,
175 'description' => 'Which Domain is this price-set for',
176 'table_name' => 'civicrm_price_set',
177 'entity' => 'PriceSet',
178 'bao' => 'CRM_Price_BAO_PriceSet',
179 'FKClassName' => 'CRM_Core_DAO_Domain',
180 'html' => array(
181 'type' => 'Text',
182 ) ,
183 'pseudoconstant' => array(
184 'table' => 'civicrm_domain',
185 'keyColumn' => 'id',
186 'labelColumn' => 'name',
187 )
188 ) ,
189 'name' => array(
190 'name' => 'name',
191 'type' => CRM_Utils_Type::T_STRING,
192 'title' => ts('Name') ,
193 'description' => 'Variable name/programmatic handle for this set of price fields.',
194 'required' => true,
195 'maxlength' => 255,
196 'size' => CRM_Utils_Type::HUGE,
197 'table_name' => 'civicrm_price_set',
198 'entity' => 'PriceSet',
199 'bao' => 'CRM_Price_BAO_PriceSet',
200 'html' => array(
201 'type' => 'Text',
202 ) ,
203 ) ,
204 'title' => array(
205 'name' => 'title',
206 'type' => CRM_Utils_Type::T_STRING,
207 'title' => ts('Price Set Title') ,
208 'description' => 'Displayed title for the Price Set.',
209 'required' => true,
210 'maxlength' => 255,
211 'size' => CRM_Utils_Type::HUGE,
212 'table_name' => 'civicrm_price_set',
213 'entity' => 'PriceSet',
214 'bao' => 'CRM_Price_BAO_PriceSet',
215 'html' => array(
216 'type' => 'Text',
217 ) ,
218 ) ,
219 'is_active' => array(
220 'name' => 'is_active',
221 'type' => CRM_Utils_Type::T_BOOLEAN,
222 'title' => ts('Price Set Is Active?') ,
223 'description' => 'Is this price set active',
224 'default' => '1',
225 'table_name' => 'civicrm_price_set',
226 'entity' => 'PriceSet',
227 'bao' => 'CRM_Price_BAO_PriceSet',
228 'html' => array(
229 'type' => 'CheckBox',
230 ) ,
231 ) ,
232 'help_pre' => array(
233 'name' => 'help_pre',
234 'type' => CRM_Utils_Type::T_TEXT,
235 'title' => ts('Price Set Pre Help') ,
236 'description' => 'Description and/or help text to display before fields in form.',
237 'rows' => 4,
238 'cols' => 80,
239 'table_name' => 'civicrm_price_set',
240 'entity' => 'PriceSet',
241 'bao' => 'CRM_Price_BAO_PriceSet',
242 'html' => array(
243 'type' => 'TextArea',
244 ) ,
245 ) ,
246 'help_post' => array(
247 'name' => 'help_post',
248 'type' => CRM_Utils_Type::T_TEXT,
249 'title' => ts('Price Set Post Help') ,
250 'description' => 'Description and/or help text to display after fields in form.',
251 'rows' => 4,
252 'cols' => 80,
253 'table_name' => 'civicrm_price_set',
254 'entity' => 'PriceSet',
255 'bao' => 'CRM_Price_BAO_PriceSet',
256 'html' => array(
257 'type' => 'TextArea',
258 ) ,
259 ) ,
260 'javascript' => array(
261 'name' => 'javascript',
262 'type' => CRM_Utils_Type::T_STRING,
263 'title' => ts('Price Set Javascript') ,
264 'description' => 'Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional',
265 'maxlength' => 64,
266 'size' => CRM_Utils_Type::BIG,
267 'table_name' => 'civicrm_price_set',
268 'entity' => 'PriceSet',
269 'bao' => 'CRM_Price_BAO_PriceSet',
270 'html' => array(
271 'type' => 'Text',
272 ) ,
273 ) ,
274 'extends' => array(
275 'name' => 'extends',
276 'type' => CRM_Utils_Type::T_STRING,
277 'title' => ts('Price Set Extends') ,
278 'description' => 'What components are using this price set?',
279 'required' => true,
280 'maxlength' => 255,
281 'size' => CRM_Utils_Type::HUGE,
282 'table_name' => 'civicrm_price_set',
283 'entity' => 'PriceSet',
284 'bao' => 'CRM_Price_BAO_PriceSet',
285 'html' => array(
286 'type' => 'Text',
287 ) ,
288 'pseudoconstant' => array(
289 'table' => 'civicrm_component',
290 'keyColumn' => 'id',
291 'labelColumn' => 'name',
292 )
293 ) ,
294 'financial_type_id' => array(
295 'name' => 'financial_type_id',
296 'type' => CRM_Utils_Type::T_INT,
297 'title' => ts('Financial Type') ,
298 'description' => 'FK to Financial Type(for membership price sets only).',
299 'default' => 'NULL',
300 'table_name' => 'civicrm_price_set',
301 'entity' => 'PriceSet',
302 'bao' => 'CRM_Price_BAO_PriceSet',
303 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
304 'html' => array(
305 'type' => 'Select',
306 ) ,
307 'pseudoconstant' => array(
308 'table' => 'civicrm_financial_type',
309 'keyColumn' => 'id',
310 'labelColumn' => 'name',
311 )
312 ) ,
313 'is_quick_config' => array(
314 'name' => 'is_quick_config',
315 'type' => CRM_Utils_Type::T_BOOLEAN,
316 'title' => ts('Is Price Set Quick Config?') ,
317 'description' => 'Is set if edited on Contribution or Event Page rather than through Manage Price Sets',
318 'table_name' => 'civicrm_price_set',
319 'entity' => 'PriceSet',
320 'bao' => 'CRM_Price_BAO_PriceSet',
321 'html' => array(
322 'type' => 'CheckBox',
323 ) ,
324 ) ,
325 'is_reserved' => array(
326 'name' => 'is_reserved',
327 'type' => CRM_Utils_Type::T_BOOLEAN,
328 'title' => ts('Price Set Is Reserved') ,
329 'description' => 'Is this a predefined system price set (i.e. it can not be deleted, edited)?',
330 'table_name' => 'civicrm_price_set',
331 'entity' => 'PriceSet',
332 'bao' => 'CRM_Price_BAO_PriceSet',
333 'html' => array(
334 'type' => 'CheckBox',
335 ) ,
336 ) ,
337 'min_amount' => array(
338 'name' => 'min_amount',
339 'type' => CRM_Utils_Type::T_INT,
340 'title' => ts('Minimum Amount') ,
341 'description' => 'Minimum Amount required for this set.',
342 'table_name' => 'civicrm_price_set',
343 'entity' => 'PriceSet',
344 'bao' => 'CRM_Price_BAO_PriceSet',
345 'html' => array(
346 'type' => 'Text',
347 ) ,
348 ) ,
349 );
350 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
351 }
352 return Civi::$statics[__CLASS__]['fields'];
353 }
354 /**
355 * Return a mapping from field-name to the corresponding key (as used in fields()).
356 *
357 * @return array
358 * Array(string $name => string $uniqueName).
359 */
360 static function &fieldKeys() {
361 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
362 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
363 }
364 return Civi::$statics[__CLASS__]['fieldKeys'];
365 }
366 /**
367 * Returns the names of this table
368 *
369 * @return string
370 */
371 static function getTableName() {
372 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
373 }
374 /**
375 * Returns if this table needs to be logged
376 *
377 * @return boolean
378 */
379 function getLog() {
380 return self::$_log;
381 }
382 /**
383 * Returns the list of fields that can be imported
384 *
385 * @param bool $prefix
386 *
387 * @return array
388 */
389 static function &import($prefix = false) {
390 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set', $prefix, array());
391 return $r;
392 }
393 /**
394 * Returns the list of fields that can be exported
395 *
396 * @param bool $prefix
397 *
398 * @return array
399 */
400 static function &export($prefix = false) {
401 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set', $prefix, array());
402 return $r;
403 }
404 }