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 | |
522a26c9 | 33 | * (GenCodeChecksum:80d53a8eb9ccb6a4fe13148a41fb30d1) |
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', | |
e501603b TO |
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', | |
522a26c9 | 176 | 'table_name' => 'civicrm_price_set', |
177 | 'entity' => 'PriceSet', | |
178 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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, | |
522a26c9 | 197 | 'table_name' => 'civicrm_price_set', |
198 | 'entity' => 'PriceSet', | |
199 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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, | |
522a26c9 | 212 | 'table_name' => 'civicrm_price_set', |
213 | 'entity' => 'PriceSet', | |
214 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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', | |
522a26c9 | 225 | 'table_name' => 'civicrm_price_set', |
226 | 'entity' => 'PriceSet', | |
227 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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, | |
522a26c9 | 239 | 'table_name' => 'civicrm_price_set', |
240 | 'entity' => 'PriceSet', | |
241 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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, | |
522a26c9 | 253 | 'table_name' => 'civicrm_price_set', |
254 | 'entity' => 'PriceSet', | |
255 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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, | |
522a26c9 | 267 | 'table_name' => 'civicrm_price_set', |
268 | 'entity' => 'PriceSet', | |
269 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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, | |
522a26c9 | 282 | 'table_name' => 'civicrm_price_set', |
283 | 'entity' => 'PriceSet', | |
284 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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', | |
522a26c9 | 300 | 'table_name' => 'civicrm_price_set', |
301 | 'entity' => 'PriceSet', | |
302 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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', | |
522a26c9 | 318 | 'table_name' => 'civicrm_price_set', |
319 | 'entity' => 'PriceSet', | |
320 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
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)?', | |
522a26c9 | 330 | 'table_name' => 'civicrm_price_set', |
331 | 'entity' => 'PriceSet', | |
332 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
e501603b TO |
333 | 'html' => array( |
334 | 'type' => 'CheckBox', | |
335 | ) , | |
336 | ) , | |
601c7a24 | 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.', | |
522a26c9 | 342 | 'table_name' => 'civicrm_price_set', |
343 | 'entity' => 'PriceSet', | |
344 | 'bao' => 'CRM_Price_BAO_PriceSet', | |
601c7a24 | 345 | 'html' => array( |
346 | 'type' => 'Text', | |
347 | ) , | |
348 | ) , | |
e501603b | 349 | ); |
346aaaba | 350 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 351 | } |
346aaaba | 352 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
353 | } |
354 | /** | |
bd8e0b14 | 355 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
356 | * |
357 | * @return array | |
bd8e0b14 | 358 | * Array(string $name => string $uniqueName). |
e501603b TO |
359 | */ |
360 | static function &fieldKeys() { | |
bd8e0b14 TO |
361 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
362 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 363 | } |
bd8e0b14 | 364 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
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) { | |
60808919 TO |
390 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set', $prefix, array()); |
391 | return $r; | |
e501603b TO |
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) { | |
60808919 TO |
401 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set', $prefix, array()); |
402 | return $r; | |
e501603b TO |
403 | } |
404 | } |