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