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