Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
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 | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Price/PriceSet.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 33 | * (GenCodeChecksum:7250a5af1e713fc047875f2cc22443ff) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Price_DAO_PriceSet constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_price_set'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
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; | |
601c7a24 | 125 | /** |
126 | * Minimum Amount required for this set. | |
127 | * | |
128 | * @var int unsigned | |
129 | */ | |
130 | public $min_amount; | |
e501603b | 131 | /** |
f41f0342 | 132 | * Class constructor. |
e501603b TO |
133 | */ |
134 | function __construct() { | |
135 | $this->__table = 'civicrm_price_set'; | |
136 | parent::__construct(); | |
137 | } | |
138 | /** | |
f41f0342 | 139 | * Returns foreign keys and entity references. |
e501603b TO |
140 | * |
141 | * @return array | |
142 | * [CRM_Core_Reference_Interface] | |
143 | */ | |
144 | static function getReferenceColumns() { | |
346aaaba TO |
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']); | |
e501603b | 150 | } |
346aaaba | 151 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
152 | } |
153 | /** | |
154 | * Returns all the column names of this table | |
155 | * | |
156 | * @return array | |
157 | */ | |
158 | static function &fields() { | |
346aaaba TO |
159 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
160 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
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, | |
522a26c9 | 167 | 'table_name' => 'civicrm_price_set', |
168 | 'entity' => 'PriceSet', | |
169 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 170 | 'localizable' => 0, |
e501603b TO |
171 | ) , |
172 | 'domain_id' => array( | |
173 | 'name' => 'domain_id', | |
174 | 'type' => CRM_Utils_Type::T_INT, | |
175 | 'title' => ts('Price Set Domain') , | |
176 | 'description' => 'Which Domain is this price-set for', | |
522a26c9 | 177 | 'table_name' => 'civicrm_price_set', |
178 | 'entity' => 'PriceSet', | |
179 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 180 | 'localizable' => 0, |
e501603b TO |
181 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
182 | 'html' => array( | |
183 | 'type' => 'Text', | |
184 | ) , | |
185 | 'pseudoconstant' => array( | |
186 | 'table' => 'civicrm_domain', | |
187 | 'keyColumn' => 'id', | |
188 | 'labelColumn' => 'name', | |
189 | ) | |
190 | ) , | |
191 | 'name' => array( | |
192 | 'name' => 'name', | |
193 | 'type' => CRM_Utils_Type::T_STRING, | |
194 | 'title' => ts('Name') , | |
195 | 'description' => 'Variable name/programmatic handle for this set of price fields.', | |
196 | 'required' => true, | |
197 | 'maxlength' => 255, | |
198 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 199 | 'table_name' => 'civicrm_price_set', |
200 | 'entity' => 'PriceSet', | |
201 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 202 | 'localizable' => 0, |
e501603b TO |
203 | 'html' => array( |
204 | 'type' => 'Text', | |
205 | ) , | |
206 | ) , | |
207 | 'title' => array( | |
208 | 'name' => 'title', | |
209 | 'type' => CRM_Utils_Type::T_STRING, | |
210 | 'title' => ts('Price Set Title') , | |
211 | 'description' => 'Displayed title for the Price Set.', | |
212 | 'required' => true, | |
213 | 'maxlength' => 255, | |
214 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 215 | 'table_name' => 'civicrm_price_set', |
216 | 'entity' => 'PriceSet', | |
217 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 218 | 'localizable' => 1, |
e501603b TO |
219 | 'html' => array( |
220 | 'type' => 'Text', | |
221 | ) , | |
222 | ) , | |
223 | 'is_active' => array( | |
224 | 'name' => 'is_active', | |
225 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
226 | 'title' => ts('Price Set Is Active?') , | |
227 | 'description' => 'Is this price set active', | |
228 | 'default' => '1', | |
522a26c9 | 229 | 'table_name' => 'civicrm_price_set', |
230 | 'entity' => 'PriceSet', | |
231 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 232 | 'localizable' => 0, |
e501603b TO |
233 | 'html' => array( |
234 | 'type' => 'CheckBox', | |
235 | ) , | |
236 | ) , | |
237 | 'help_pre' => array( | |
238 | 'name' => 'help_pre', | |
239 | 'type' => CRM_Utils_Type::T_TEXT, | |
240 | 'title' => ts('Price Set Pre Help') , | |
241 | 'description' => 'Description and/or help text to display before fields in form.', | |
242 | 'rows' => 4, | |
243 | 'cols' => 80, | |
522a26c9 | 244 | 'table_name' => 'civicrm_price_set', |
245 | 'entity' => 'PriceSet', | |
246 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 247 | 'localizable' => 1, |
e501603b TO |
248 | 'html' => array( |
249 | 'type' => 'TextArea', | |
250 | ) , | |
251 | ) , | |
252 | 'help_post' => array( | |
253 | 'name' => 'help_post', | |
254 | 'type' => CRM_Utils_Type::T_TEXT, | |
255 | 'title' => ts('Price Set Post Help') , | |
256 | 'description' => 'Description and/or help text to display after fields in form.', | |
257 | 'rows' => 4, | |
258 | 'cols' => 80, | |
522a26c9 | 259 | 'table_name' => 'civicrm_price_set', |
260 | 'entity' => 'PriceSet', | |
261 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 262 | 'localizable' => 1, |
e501603b TO |
263 | 'html' => array( |
264 | 'type' => 'TextArea', | |
265 | ) , | |
266 | ) , | |
267 | 'javascript' => array( | |
268 | 'name' => 'javascript', | |
269 | 'type' => CRM_Utils_Type::T_STRING, | |
270 | 'title' => ts('Price Set Javascript') , | |
271 | 'description' => 'Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional', | |
272 | 'maxlength' => 64, | |
273 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 274 | 'table_name' => 'civicrm_price_set', |
275 | 'entity' => 'PriceSet', | |
276 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 277 | 'localizable' => 0, |
e501603b TO |
278 | 'html' => array( |
279 | 'type' => 'Text', | |
280 | ) , | |
281 | ) , | |
282 | 'extends' => array( | |
283 | 'name' => 'extends', | |
284 | 'type' => CRM_Utils_Type::T_STRING, | |
285 | 'title' => ts('Price Set Extends') , | |
286 | 'description' => 'What components are using this price set?', | |
287 | 'required' => true, | |
288 | 'maxlength' => 255, | |
289 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 290 | 'table_name' => 'civicrm_price_set', |
291 | 'entity' => 'PriceSet', | |
292 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 293 | 'localizable' => 0, |
e501603b TO |
294 | 'html' => array( |
295 | 'type' => 'Text', | |
296 | ) , | |
297 | 'pseudoconstant' => array( | |
298 | 'table' => 'civicrm_component', | |
299 | 'keyColumn' => 'id', | |
300 | 'labelColumn' => 'name', | |
301 | ) | |
302 | ) , | |
303 | 'financial_type_id' => array( | |
304 | 'name' => 'financial_type_id', | |
305 | 'type' => CRM_Utils_Type::T_INT, | |
306 | 'title' => ts('Financial Type') , | |
307 | 'description' => 'FK to Financial Type(for membership price sets only).', | |
308 | 'default' => 'NULL', | |
522a26c9 | 309 | 'table_name' => 'civicrm_price_set', |
310 | 'entity' => 'PriceSet', | |
311 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 312 | 'localizable' => 0, |
e501603b TO |
313 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
314 | 'html' => array( | |
315 | 'type' => 'Select', | |
316 | ) , | |
317 | 'pseudoconstant' => array( | |
318 | 'table' => 'civicrm_financial_type', | |
319 | 'keyColumn' => 'id', | |
320 | 'labelColumn' => 'name', | |
321 | ) | |
322 | ) , | |
323 | 'is_quick_config' => array( | |
324 | 'name' => 'is_quick_config', | |
325 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
326 | 'title' => ts('Is Price Set Quick Config?') , | |
327 | 'description' => 'Is set if edited on Contribution or Event Page rather than through Manage Price Sets', | |
522a26c9 | 328 | 'table_name' => 'civicrm_price_set', |
329 | 'entity' => 'PriceSet', | |
330 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 331 | 'localizable' => 0, |
e501603b TO |
332 | 'html' => array( |
333 | 'type' => 'CheckBox', | |
334 | ) , | |
335 | ) , | |
336 | 'is_reserved' => array( | |
337 | 'name' => 'is_reserved', | |
338 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
339 | 'title' => ts('Price Set Is Reserved') , | |
340 | 'description' => 'Is this a predefined system price set (i.e. it can not be deleted, edited)?', | |
522a26c9 | 341 | 'table_name' => 'civicrm_price_set', |
342 | 'entity' => 'PriceSet', | |
343 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 344 | 'localizable' => 0, |
e501603b TO |
345 | 'html' => array( |
346 | 'type' => 'CheckBox', | |
347 | ) , | |
348 | ) , | |
601c7a24 | 349 | 'min_amount' => array( |
350 | 'name' => 'min_amount', | |
351 | 'type' => CRM_Utils_Type::T_INT, | |
352 | 'title' => ts('Minimum Amount') , | |
353 | 'description' => 'Minimum Amount required for this set.', | |
522a26c9 | 354 | 'table_name' => 'civicrm_price_set', |
355 | 'entity' => 'PriceSet', | |
356 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
6a7e5e5d | 357 | 'localizable' => 0, |
601c7a24 | 358 | 'html' => array( |
359 | 'type' => 'Text', | |
360 | ) , | |
361 | ) , | |
e501603b | 362 | ); |
346aaaba | 363 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 364 | } |
346aaaba | 365 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
366 | } |
367 | /** | |
bd8e0b14 | 368 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
369 | * |
370 | * @return array | |
bd8e0b14 | 371 | * Array(string $name => string $uniqueName). |
e501603b TO |
372 | */ |
373 | static function &fieldKeys() { | |
bd8e0b14 TO |
374 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
375 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 376 | } |
bd8e0b14 | 377 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
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) { | |
60808919 TO |
403 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set', $prefix, array()); |
404 | return $r; | |
e501603b TO |
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) { | |
60808919 TO |
414 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set', $prefix, array()); |
415 | return $r; | |
e501603b | 416 | } |
e7a6b91a AS |
417 | /** |
418 | * Returns the list of indices | |
419 | */ | |
420 | public static function indices($localize = TRUE) { | |
421 | $indices = array( | |
422 | 'UI_name' => array( | |
423 | 'name' => 'UI_name', | |
424 | 'field' => array( | |
425 | 0 => 'name', | |
426 | ) , | |
427 | 'localizable' => false, | |
428 | 'unique' => true, | |
429 | 'sig' => 'civicrm_price_set::1::name', | |
430 | ) , | |
431 | ); | |
432 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
433 | } | |
e501603b | 434 | } |