Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contribute/Product.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
1fe423d6 | 9 | * (GenCodeChecksum:c598ff101a6b96d122908bf8acab8193) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Product entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contribute_DAO_Product extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.4'; | |
d31fb4e3 | 18 | const COMPONENT = 'CiviContribute'; |
c3fc2621 | 19 | |
e501603b | 20 | /** |
f41f0342 | 21 | * Static instance to hold the table name. |
e501603b TO |
22 | * |
23 | * @var string | |
24 | */ | |
fa45b5b9 | 25 | public static $_tableName = 'civicrm_product'; |
c3fc2621 | 26 | |
8ab43c93 CW |
27 | /** |
28 | * Field to show when displaying a record. | |
29 | * | |
30 | * @var string | |
31 | */ | |
32 | public static $_labelField = 'name'; | |
33 | ||
e501603b | 34 | /** |
f41f0342 | 35 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 36 | * |
c3fc2621 | 37 | * @var bool |
e501603b | 38 | */ |
fa45b5b9 | 39 | public static $_log = TRUE; |
c3fc2621 | 40 | |
e501603b | 41 | /** |
e6ca0a57 | 42 | * @var int |
e501603b TO |
43 | */ |
44 | public $id; | |
c3fc2621 | 45 | |
e501603b TO |
46 | /** |
47 | * Required product/premium name | |
48 | * | |
49 | * @var string | |
50 | */ | |
51 | public $name; | |
c3fc2621 | 52 | |
e501603b TO |
53 | /** |
54 | * Optional description of the product/premium. | |
55 | * | |
56 | * @var text | |
57 | */ | |
58 | public $description; | |
c3fc2621 | 59 | |
e501603b TO |
60 | /** |
61 | * Optional product sku or code. | |
62 | * | |
63 | * @var string | |
64 | */ | |
65 | public $sku; | |
c3fc2621 | 66 | |
e501603b TO |
67 | /** |
68 | * Store comma-delimited list of color, size, etc. options for the product. | |
69 | * | |
70 | * @var text | |
71 | */ | |
72 | public $options; | |
c3fc2621 | 73 | |
e501603b TO |
74 | /** |
75 | * Full or relative URL to uploaded image - fullsize. | |
76 | * | |
77 | * @var string | |
78 | */ | |
79 | public $image; | |
c3fc2621 | 80 | |
e501603b TO |
81 | /** |
82 | * Full or relative URL to image thumbnail. | |
83 | * | |
84 | * @var string | |
85 | */ | |
86 | public $thumbnail; | |
c3fc2621 | 87 | |
e501603b TO |
88 | /** |
89 | * Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record. | |
90 | * | |
91 | * @var float | |
92 | */ | |
93 | public $price; | |
c3fc2621 | 94 | |
e501603b TO |
95 | /** |
96 | * 3 character string, value from config setting or input via user. | |
97 | * | |
98 | * @var string | |
99 | */ | |
100 | public $currency; | |
c3fc2621 | 101 | |
e501603b TO |
102 | /** |
103 | * FK to Financial Type. | |
104 | * | |
e6ca0a57 | 105 | * @var int |
e501603b TO |
106 | */ |
107 | public $financial_type_id; | |
c3fc2621 | 108 | |
e501603b TO |
109 | /** |
110 | * Minimum contribution required to be eligible to select this premium. | |
111 | * | |
112 | * @var float | |
113 | */ | |
114 | public $min_contribution; | |
c3fc2621 | 115 | |
e501603b TO |
116 | /** |
117 | * Actual cost of this product. Useful to determine net return from sale or using this as an incentive. | |
118 | * | |
119 | * @var float | |
120 | */ | |
121 | public $cost; | |
c3fc2621 | 122 | |
e501603b TO |
123 | /** |
124 | * Disabling premium removes it from the premiums_premium join table below. | |
125 | * | |
e6ca0a57 | 126 | * @var bool |
e501603b TO |
127 | */ |
128 | public $is_active; | |
c3fc2621 | 129 | |
e501603b TO |
130 | /** |
131 | * Rolling means we set start/end based on current day, fixed means we set start/end for current year or month | |
fb607354 | 132 | * (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) |
e501603b TO |
133 | * |
134 | * @var string | |
135 | */ | |
136 | public $period_type; | |
c3fc2621 | 137 | |
e501603b TO |
138 | /** |
139 | * Month and day (MMDD) that fixed period type subscription or membership starts. | |
140 | * | |
141 | * @var int | |
142 | */ | |
143 | public $fixed_period_start_day; | |
c3fc2621 | 144 | |
e501603b | 145 | /** |
e501603b TO |
146 | * @var string |
147 | */ | |
148 | public $duration_unit; | |
c3fc2621 | 149 | |
e501603b TO |
150 | /** |
151 | * Number of units for total duration of subscription, service, membership (e.g. 12 Months). | |
152 | * | |
153 | * @var int | |
154 | */ | |
155 | public $duration_interval; | |
c3fc2621 | 156 | |
e501603b TO |
157 | /** |
158 | * Frequency unit and interval allow option to store actual delivery frequency for a subscription or service. | |
159 | * | |
160 | * @var string | |
161 | */ | |
162 | public $frequency_unit; | |
c3fc2621 | 163 | |
e501603b TO |
164 | /** |
165 | * Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months). | |
166 | * | |
167 | * @var int | |
168 | */ | |
169 | public $frequency_interval; | |
c3fc2621 | 170 | |
e501603b | 171 | /** |
f41f0342 | 172 | * Class constructor. |
e501603b | 173 | */ |
c3fc2621 | 174 | public function __construct() { |
e501603b TO |
175 | $this->__table = 'civicrm_product'; |
176 | parent::__construct(); | |
177 | } | |
c3fc2621 | 178 | |
449c4e6b CW |
179 | /** |
180 | * Returns localized title of this entity. | |
7b66c3b5 AH |
181 | * |
182 | * @param bool $plural | |
183 | * Whether to return the plural version of the title. | |
449c4e6b | 184 | */ |
7b66c3b5 AH |
185 | public static function getEntityTitle($plural = FALSE) { |
186 | return $plural ? ts('Products') : ts('Product'); | |
449c4e6b CW |
187 | } |
188 | ||
e501603b | 189 | /** |
f41f0342 | 190 | * Returns foreign keys and entity references. |
e501603b TO |
191 | * |
192 | * @return array | |
193 | * [CRM_Core_Reference_Interface] | |
194 | */ | |
c3fc2621 | 195 | public static function getReferenceColumns() { |
346aaaba | 196 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 197 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 198 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); |
346aaaba | 199 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 200 | } |
346aaaba | 201 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 202 | } |
c3fc2621 | 203 | |
e501603b TO |
204 | /** |
205 | * Returns all the column names of this table | |
206 | * | |
207 | * @return array | |
208 | */ | |
c3fc2621 | 209 | public static function &fields() { |
346aaaba | 210 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
211 | Civi::$statics[__CLASS__]['fields'] = [ |
212 | 'id' => [ | |
e501603b TO |
213 | 'name' => 'id', |
214 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
215 | 'title' => ts('Product ID'), |
216 | 'required' => TRUE, | |
a36434b9 | 217 | 'where' => 'civicrm_product.id', |
522a26c9 | 218 | 'table_name' => 'civicrm_product', |
219 | 'entity' => 'Product', | |
45a83e42 | 220 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 221 | 'localizable' => 0, |
2cbbebe8 A |
222 | 'html' => [ |
223 | 'type' => 'Number', | |
224 | ], | |
1fe423d6 | 225 | 'readonly' => TRUE, |
a9d0587b | 226 | 'add' => '1.4', |
c3fc2621 CW |
227 | ], |
228 | 'product_name' => [ | |
e501603b TO |
229 | 'name' => 'name', |
230 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 231 | 'title' => ts('Product Name'), |
215b423e | 232 | 'description' => ts('Required product/premium name'), |
c3fc2621 | 233 | 'required' => TRUE, |
e501603b TO |
234 | 'maxlength' => 255, |
235 | 'size' => CRM_Utils_Type::HUGE, | |
e501603b | 236 | 'where' => 'civicrm_product.name', |
a36434b9 | 237 | 'export' => TRUE, |
522a26c9 | 238 | 'table_name' => 'civicrm_product', |
239 | 'entity' => 'Product', | |
45a83e42 | 240 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 241 | 'localizable' => 1, |
a9d0587b | 242 | 'add' => '1.4', |
c3fc2621 CW |
243 | ], |
244 | 'description' => [ | |
e501603b TO |
245 | 'name' => 'description', |
246 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 247 | 'title' => ts('Description'), |
215b423e | 248 | 'description' => ts('Optional description of the product/premium.'), |
a36434b9 | 249 | 'where' => 'civicrm_product.description', |
522a26c9 | 250 | 'table_name' => 'civicrm_product', |
251 | 'entity' => 'Product', | |
45a83e42 | 252 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 253 | 'localizable' => 1, |
a9d0587b | 254 | 'add' => '1.4', |
c3fc2621 CW |
255 | ], |
256 | 'sku' => [ | |
e501603b TO |
257 | 'name' => 'sku', |
258 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 259 | 'title' => ts('SKU'), |
215b423e | 260 | 'description' => ts('Optional product sku or code.'), |
e501603b TO |
261 | 'maxlength' => 50, |
262 | 'size' => CRM_Utils_Type::BIG, | |
e501603b | 263 | 'where' => 'civicrm_product.sku', |
a36434b9 | 264 | 'export' => TRUE, |
522a26c9 | 265 | 'table_name' => 'civicrm_product', |
266 | 'entity' => 'Product', | |
45a83e42 | 267 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 268 | 'localizable' => 0, |
a9d0587b | 269 | 'add' => '1.4', |
c3fc2621 CW |
270 | ], |
271 | 'options' => [ | |
e501603b TO |
272 | 'name' => 'options', |
273 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 274 | 'title' => ts('Options'), |
215b423e | 275 | 'description' => ts('Store comma-delimited list of color, size, etc. options for the product.'), |
a36434b9 | 276 | 'where' => 'civicrm_product.options', |
522a26c9 | 277 | 'table_name' => 'civicrm_product', |
278 | 'entity' => 'Product', | |
45a83e42 | 279 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 280 | 'localizable' => 1, |
a9d0587b | 281 | 'add' => '1.4', |
c3fc2621 CW |
282 | ], |
283 | 'image' => [ | |
e501603b TO |
284 | 'name' => 'image', |
285 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 286 | 'title' => ts('Image'), |
215b423e | 287 | 'description' => ts('Full or relative URL to uploaded image - fullsize.'), |
e501603b TO |
288 | 'maxlength' => 255, |
289 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 290 | 'where' => 'civicrm_product.image', |
522a26c9 | 291 | 'table_name' => 'civicrm_product', |
292 | 'entity' => 'Product', | |
45a83e42 | 293 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 294 | 'localizable' => 0, |
a9d0587b | 295 | 'add' => '1.4', |
c3fc2621 CW |
296 | ], |
297 | 'thumbnail' => [ | |
e501603b TO |
298 | 'name' => 'thumbnail', |
299 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 300 | 'title' => ts('Thumbnail'), |
215b423e | 301 | 'description' => ts('Full or relative URL to image thumbnail.'), |
e501603b TO |
302 | 'maxlength' => 255, |
303 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 304 | 'where' => 'civicrm_product.thumbnail', |
522a26c9 | 305 | 'table_name' => 'civicrm_product', |
306 | 'entity' => 'Product', | |
45a83e42 | 307 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 308 | 'localizable' => 0, |
a9d0587b | 309 | 'add' => '1.4', |
c3fc2621 CW |
310 | ], |
311 | 'price' => [ | |
e501603b TO |
312 | 'name' => 'price', |
313 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 314 | 'title' => ts('Price'), |
215b423e | 315 | 'description' => ts('Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record.'), |
c3fc2621 | 316 | 'precision' => [ |
e501603b | 317 | 20, |
fb607354 | 318 | 2, |
c3fc2621 | 319 | ], |
a36434b9 | 320 | 'where' => 'civicrm_product.price', |
522a26c9 | 321 | 'table_name' => 'civicrm_product', |
322 | 'entity' => 'Product', | |
45a83e42 | 323 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 324 | 'localizable' => 0, |
a9d0587b | 325 | 'add' => '1.4', |
c3fc2621 CW |
326 | ], |
327 | 'currency' => [ | |
e501603b TO |
328 | 'name' => 'currency', |
329 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 330 | 'title' => ts('Currency'), |
215b423e | 331 | 'description' => ts('3 character string, value from config setting or input via user.'), |
e501603b TO |
332 | 'maxlength' => 3, |
333 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 334 | 'where' => 'civicrm_product.currency', |
e501603b | 335 | 'default' => 'NULL', |
522a26c9 | 336 | 'table_name' => 'civicrm_product', |
337 | 'entity' => 'Product', | |
45a83e42 | 338 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 339 | 'localizable' => 0, |
c3fc2621 | 340 | 'html' => [ |
e501603b | 341 | 'type' => 'Select', |
c23563e3 | 342 | 'label' => ts("Currency"), |
c3fc2621 CW |
343 | ], |
344 | 'pseudoconstant' => [ | |
e501603b TO |
345 | 'table' => 'civicrm_currency', |
346 | 'keyColumn' => 'name', | |
347 | 'labelColumn' => 'full_name', | |
348 | 'nameColumn' => 'name', | |
a8fdb24e | 349 | 'abbrColumn' => 'symbol', |
e6ca0a57 | 350 | ], |
a9d0587b | 351 | 'add' => '3.2', |
c3fc2621 CW |
352 | ], |
353 | 'financial_type_id' => [ | |
e501603b TO |
354 | 'name' => 'financial_type_id', |
355 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 356 | 'title' => ts('Financial Type ID'), |
215b423e | 357 | 'description' => ts('FK to Financial Type.'), |
a36434b9 | 358 | 'where' => 'civicrm_product.financial_type_id', |
e501603b | 359 | 'default' => 'NULL', |
522a26c9 | 360 | 'table_name' => 'civicrm_product', |
361 | 'entity' => 'Product', | |
45a83e42 | 362 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 363 | 'localizable' => 0, |
e501603b | 364 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
2cbbebe8 A |
365 | 'html' => [ |
366 | 'label' => ts("Financial Type"), | |
367 | ], | |
c3fc2621 | 368 | 'pseudoconstant' => [ |
e501603b TO |
369 | 'table' => 'civicrm_financial_type', |
370 | 'keyColumn' => 'id', | |
371 | 'labelColumn' => 'name', | |
e6ca0a57 | 372 | ], |
a9d0587b | 373 | 'add' => '4.3', |
c3fc2621 CW |
374 | ], |
375 | 'min_contribution' => [ | |
e501603b TO |
376 | 'name' => 'min_contribution', |
377 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 378 | 'title' => ts('Minimum Contribution'), |
215b423e | 379 | 'description' => ts('Minimum contribution required to be eligible to select this premium.'), |
c3fc2621 | 380 | 'precision' => [ |
e501603b | 381 | 20, |
fb607354 | 382 | 2, |
c3fc2621 | 383 | ], |
a36434b9 | 384 | 'where' => 'civicrm_product.min_contribution', |
522a26c9 | 385 | 'table_name' => 'civicrm_product', |
386 | 'entity' => 'Product', | |
45a83e42 | 387 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 388 | 'localizable' => 0, |
a9d0587b | 389 | 'add' => '1.4', |
c3fc2621 CW |
390 | ], |
391 | 'cost' => [ | |
e501603b TO |
392 | 'name' => 'cost', |
393 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 394 | 'title' => ts('Cost'), |
215b423e | 395 | 'description' => ts('Actual cost of this product. Useful to determine net return from sale or using this as an incentive.'), |
c3fc2621 | 396 | 'precision' => [ |
e501603b | 397 | 20, |
fb607354 | 398 | 2, |
c3fc2621 | 399 | ], |
a36434b9 | 400 | 'where' => 'civicrm_product.cost', |
522a26c9 | 401 | 'table_name' => 'civicrm_product', |
402 | 'entity' => 'Product', | |
45a83e42 | 403 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 404 | 'localizable' => 0, |
a9d0587b | 405 | 'add' => '1.4', |
c3fc2621 CW |
406 | ], |
407 | 'is_active' => [ | |
e501603b TO |
408 | 'name' => 'is_active', |
409 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 410 | 'title' => ts('Is Active'), |
215b423e | 411 | 'description' => ts('Disabling premium removes it from the premiums_premium join table below.'), |
c3fc2621 | 412 | 'required' => TRUE, |
a36434b9 | 413 | 'where' => 'civicrm_product.is_active', |
522a26c9 | 414 | 'table_name' => 'civicrm_product', |
415 | 'entity' => 'Product', | |
45a83e42 | 416 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 417 | 'localizable' => 0, |
a9d0587b | 418 | 'add' => '1.4', |
c3fc2621 CW |
419 | ], |
420 | 'period_type' => [ | |
e501603b TO |
421 | 'name' => 'period_type', |
422 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 423 | 'title' => ts('Period Type'), |
215b423e | 424 | 'description' => ts('Rolling means we set start/end based on current day, fixed means we set start/end for current year or month |
425 | (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) '), | |
e501603b TO |
426 | 'maxlength' => 8, |
427 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 428 | 'where' => 'civicrm_product.period_type', |
e501603b | 429 | 'default' => 'rolling', |
522a26c9 | 430 | 'table_name' => 'civicrm_product', |
431 | 'entity' => 'Product', | |
45a83e42 | 432 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 433 | 'localizable' => 0, |
c3fc2621 | 434 | 'html' => [ |
e501603b | 435 | 'type' => 'Select', |
c3fc2621 CW |
436 | ], |
437 | 'pseudoconstant' => [ | |
e501603b | 438 | 'callback' => 'CRM_Core_SelectValues::periodType', |
e6ca0a57 | 439 | ], |
a9d0587b | 440 | 'add' => '1.4', |
c3fc2621 CW |
441 | ], |
442 | 'fixed_period_start_day' => [ | |
e501603b TO |
443 | 'name' => 'fixed_period_start_day', |
444 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 445 | 'title' => ts('Fixed Period Start Day'), |
215b423e | 446 | 'description' => ts('Month and day (MMDD) that fixed period type subscription or membership starts.'), |
a36434b9 | 447 | 'where' => 'civicrm_product.fixed_period_start_day', |
e501603b | 448 | 'default' => '0101', |
522a26c9 | 449 | 'table_name' => 'civicrm_product', |
450 | 'entity' => 'Product', | |
45a83e42 | 451 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 452 | 'localizable' => 0, |
a9d0587b | 453 | 'add' => '1.4', |
c3fc2621 CW |
454 | ], |
455 | 'duration_unit' => [ | |
e501603b TO |
456 | 'name' => 'duration_unit', |
457 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 458 | 'title' => ts('Duration Unit'), |
e501603b TO |
459 | 'maxlength' => 8, |
460 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 461 | 'where' => 'civicrm_product.duration_unit', |
e501603b | 462 | 'default' => 'year', |
522a26c9 | 463 | 'table_name' => 'civicrm_product', |
464 | 'entity' => 'Product', | |
45a83e42 | 465 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 466 | 'localizable' => 0, |
c3fc2621 | 467 | 'html' => [ |
e501603b | 468 | 'type' => 'Select', |
c3fc2621 CW |
469 | ], |
470 | 'pseudoconstant' => [ | |
e501603b | 471 | 'callback' => 'CRM_Core_SelectValues::getPremiumUnits', |
e6ca0a57 | 472 | ], |
a9d0587b | 473 | 'add' => '1.4', |
c3fc2621 CW |
474 | ], |
475 | 'duration_interval' => [ | |
e501603b TO |
476 | 'name' => 'duration_interval', |
477 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 478 | 'title' => ts('Duration Interval'), |
215b423e | 479 | 'description' => ts('Number of units for total duration of subscription, service, membership (e.g. 12 Months).'), |
a36434b9 | 480 | 'where' => 'civicrm_product.duration_interval', |
522a26c9 | 481 | 'table_name' => 'civicrm_product', |
482 | 'entity' => 'Product', | |
45a83e42 | 483 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 484 | 'localizable' => 0, |
a9d0587b | 485 | 'add' => '1.4', |
c3fc2621 CW |
486 | ], |
487 | 'frequency_unit' => [ | |
e501603b TO |
488 | 'name' => 'frequency_unit', |
489 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 490 | 'title' => ts('Frequency Unit'), |
215b423e | 491 | 'description' => ts('Frequency unit and interval allow option to store actual delivery frequency for a subscription or service.'), |
e501603b TO |
492 | 'maxlength' => 8, |
493 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 494 | 'where' => 'civicrm_product.frequency_unit', |
e501603b | 495 | 'default' => 'month', |
522a26c9 | 496 | 'table_name' => 'civicrm_product', |
497 | 'entity' => 'Product', | |
45a83e42 | 498 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 499 | 'localizable' => 0, |
c3fc2621 | 500 | 'html' => [ |
e501603b | 501 | 'type' => 'Select', |
c3fc2621 CW |
502 | ], |
503 | 'pseudoconstant' => [ | |
e501603b | 504 | 'callback' => 'CRM_Core_SelectValues::getPremiumUnits', |
e6ca0a57 | 505 | ], |
a9d0587b | 506 | 'add' => '1.4', |
c3fc2621 CW |
507 | ], |
508 | 'frequency_interval' => [ | |
e501603b TO |
509 | 'name' => 'frequency_interval', |
510 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 511 | 'title' => ts('Frequency Interval'), |
215b423e | 512 | 'description' => ts('Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months).'), |
a36434b9 | 513 | 'where' => 'civicrm_product.frequency_interval', |
522a26c9 | 514 | 'table_name' => 'civicrm_product', |
515 | 'entity' => 'Product', | |
45a83e42 | 516 | 'bao' => 'CRM_Contribute_BAO_Product', |
6a7e5e5d | 517 | 'localizable' => 0, |
a9d0587b | 518 | 'add' => '1.4', |
c3fc2621 CW |
519 | ], |
520 | ]; | |
346aaaba | 521 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 522 | } |
346aaaba | 523 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 524 | } |
c3fc2621 | 525 | |
e501603b | 526 | /** |
bd8e0b14 | 527 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
528 | * |
529 | * @return array | |
bd8e0b14 | 530 | * Array(string $name => string $uniqueName). |
e501603b | 531 | */ |
c3fc2621 | 532 | public static function &fieldKeys() { |
bd8e0b14 TO |
533 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
534 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 535 | } |
bd8e0b14 | 536 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 537 | } |
c3fc2621 | 538 | |
e501603b TO |
539 | /** |
540 | * Returns the names of this table | |
541 | * | |
542 | * @return string | |
543 | */ | |
c3fc2621 | 544 | public static function getTableName() { |
e501603b TO |
545 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
546 | } | |
c3fc2621 | 547 | |
e501603b TO |
548 | /** |
549 | * Returns if this table needs to be logged | |
550 | * | |
c3fc2621 | 551 | * @return bool |
e501603b | 552 | */ |
c3fc2621 | 553 | public function getLog() { |
e501603b TO |
554 | return self::$_log; |
555 | } | |
c3fc2621 | 556 | |
e501603b TO |
557 | /** |
558 | * Returns the list of fields that can be imported | |
559 | * | |
560 | * @param bool $prefix | |
561 | * | |
562 | * @return array | |
563 | */ | |
c3fc2621 CW |
564 | public static function &import($prefix = FALSE) { |
565 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'product', $prefix, []); | |
60808919 | 566 | return $r; |
e501603b | 567 | } |
c3fc2621 | 568 | |
e501603b TO |
569 | /** |
570 | * Returns the list of fields that can be exported | |
571 | * | |
572 | * @param bool $prefix | |
573 | * | |
574 | * @return array | |
575 | */ | |
c3fc2621 CW |
576 | public static function &export($prefix = FALSE) { |
577 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'product', $prefix, []); | |
60808919 | 578 | return $r; |
e501603b | 579 | } |
c3fc2621 | 580 | |
e7a6b91a AS |
581 | /** |
582 | * Returns the list of indices | |
c3fc2621 CW |
583 | * |
584 | * @param bool $localize | |
585 | * | |
586 | * @return array | |
e7a6b91a AS |
587 | */ |
588 | public static function indices($localize = TRUE) { | |
c3fc2621 | 589 | $indices = []; |
e7a6b91a AS |
590 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
591 | } | |
c3fc2621 | 592 | |
e501603b | 593 | } |