3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2015
31 * Generated from xml/schema/CRM/Contribute/Product.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Contribute_DAO_Product
extends CRM_Core_DAO
{
38 * static instance to hold the table name
42 static $_tableName = 'civicrm_product';
44 * static instance to hold the field values
48 static $_fields = null;
50 * static instance to hold the keys used in $_fields for each field.
54 static $_fieldKeys = null;
56 * static instance to hold the FK relationships
60 static $_links = null;
62 * static instance to hold the values that can
67 static $_import = null;
69 * static instance to hold the values that can
74 static $_export = null;
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
88 * Required product/premium name
94 * Optional description of the product/premium.
100 * Optional product sku or code.
106 * Store comma-delimited list of color, size, etc. options for the product.
112 * Full or relative URL to uploaded image - fullsize.
118 * Full or relative URL to image thumbnail.
124 * Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record.
130 * 3 character string, value from config setting or input via user.
136 * FK to Financial Type.
140 public $financial_type_id;
142 * Minimum contribution required to be eligible to select this premium.
146 public $min_contribution;
148 * Actual cost of this product. Useful to determine net return from sale or using this as an incentive.
154 * Disabling premium removes it from the premiums_premium join table below.
160 * Rolling means we set start/end based on current day, fixed means we set start/end for current year or month
161 (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006)
167 * Month and day (MMDD) that fixed period type subscription or membership starts.
171 public $fixed_period_start_day;
176 public $duration_unit;
178 * Number of units for total duration of subscription, service, membership (e.g. 12 Months).
182 public $duration_interval;
184 * Frequency unit and interval allow option to store actual delivery frequency for a subscription or service.
188 public $frequency_unit;
190 * Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months).
194 public $frequency_interval;
198 * @return civicrm_product
200 function __construct() {
201 $this->__table
= 'civicrm_product';
202 parent
::__construct();
205 * Returns foreign keys and entity references
208 * [CRM_Core_Reference_Interface]
210 static function getReferenceColumns() {
211 if (!self
::$_links) {
212 self
::$_links = static ::createReferenceColumns(__CLASS__
);
213 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
215 return self
::$_links;
218 * Returns all the column names of this table
222 static function &fields() {
223 if (!(self
::$_fields)) {
224 self
::$_fields = array(
227 'type' => CRM_Utils_Type
::T_INT
,
228 'title' => ts('Product ID') ,
231 'product_name' => array(
233 'type' => CRM_Utils_Type
::T_STRING
,
234 'title' => ts('Product Name') ,
235 'description' => 'Required product/premium name',
238 'size' => CRM_Utils_Type
::HUGE
,
240 'where' => 'civicrm_product.name',
241 'headerPattern' => '',
244 'description' => array(
245 'name' => 'description',
246 'type' => CRM_Utils_Type
::T_TEXT
,
247 'title' => ts('Description') ,
248 'description' => 'Optional description of the product/premium.',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('SKU') ,
254 'description' => 'Optional product sku or code.',
256 'size' => CRM_Utils_Type
::BIG
,
258 'where' => 'civicrm_product.sku',
259 'headerPattern' => '',
264 'type' => CRM_Utils_Type
::T_TEXT
,
265 'title' => ts('Options') ,
266 'description' => 'Store comma-delimited list of color, size, etc. options for the product.',
270 'type' => CRM_Utils_Type
::T_STRING
,
271 'title' => ts('Image') ,
272 'description' => 'Full or relative URL to uploaded image - fullsize.',
274 'size' => CRM_Utils_Type
::HUGE
,
276 'thumbnail' => array(
277 'name' => 'thumbnail',
278 'type' => CRM_Utils_Type
::T_STRING
,
279 'title' => ts('Thumbnail') ,
280 'description' => 'Full or relative URL to image thumbnail.',
282 'size' => CRM_Utils_Type
::HUGE
,
286 'type' => CRM_Utils_Type
::T_MONEY
,
287 'title' => ts('Price') ,
288 'description' => 'Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record.',
289 'precision' => array(
295 'name' => 'currency',
296 'type' => CRM_Utils_Type
::T_STRING
,
297 'title' => ts('Currency') ,
298 'description' => '3 character string, value from config setting or input via user.',
300 'size' => CRM_Utils_Type
::FOUR
,
305 'pseudoconstant' => array(
306 'table' => 'civicrm_currency',
307 'keyColumn' => 'name',
308 'labelColumn' => 'full_name',
309 'nameColumn' => 'numeric_code',
312 'financial_type_id' => array(
313 'name' => 'financial_type_id',
314 'type' => CRM_Utils_Type
::T_INT
,
315 'title' => ts('Financial Type') ,
316 'description' => 'FK to Financial Type.',
318 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
319 'pseudoconstant' => array(
320 'table' => 'civicrm_financial_type',
322 'labelColumn' => 'name',
325 'min_contribution' => array(
326 'name' => 'min_contribution',
327 'type' => CRM_Utils_Type
::T_MONEY
,
328 'title' => ts('Minimum Contribution') ,
329 'description' => 'Minimum contribution required to be eligible to select this premium.',
330 'precision' => array(
337 'type' => CRM_Utils_Type
::T_MONEY
,
338 'title' => ts('Cost') ,
339 'description' => 'Actual cost of this product. Useful to determine net return from sale or using this as an incentive.',
340 'precision' => array(
345 'is_active' => array(
346 'name' => 'is_active',
347 'type' => CRM_Utils_Type
::T_BOOLEAN
,
348 'title' => ts('Is Active') ,
349 'description' => 'Disabling premium removes it from the premiums_premium join table below.',
352 'period_type' => array(
353 'name' => 'period_type',
354 'type' => CRM_Utils_Type
::T_STRING
,
355 'title' => ts('Period Type') ,
356 'description' => 'Rolling means we set start/end based on current day, fixed means we set start/end for current year or month
357 (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) ',
359 'size' => CRM_Utils_Type
::EIGHT
,
360 'default' => 'rolling',
364 'pseudoconstant' => array(
365 'callback' => 'CRM_Core_SelectValues::periodType',
368 'fixed_period_start_day' => array(
369 'name' => 'fixed_period_start_day',
370 'type' => CRM_Utils_Type
::T_INT
,
371 'title' => ts('Fixed Period Start Day') ,
372 'description' => 'Month and day (MMDD) that fixed period type subscription or membership starts.',
375 'duration_unit' => array(
376 'name' => 'duration_unit',
377 'type' => CRM_Utils_Type
::T_STRING
,
378 'title' => ts('Duration Unit') ,
380 'size' => CRM_Utils_Type
::EIGHT
,
385 'pseudoconstant' => array(
386 'callback' => 'CRM_Core_SelectValues::getPremiumUnits',
389 'duration_interval' => array(
390 'name' => 'duration_interval',
391 'type' => CRM_Utils_Type
::T_INT
,
392 'title' => ts('Duration Interval') ,
393 'description' => 'Number of units for total duration of subscription, service, membership (e.g. 12 Months).',
395 'frequency_unit' => array(
396 'name' => 'frequency_unit',
397 'type' => CRM_Utils_Type
::T_STRING
,
398 'title' => ts('Frequency Unit') ,
399 'description' => 'Frequency unit and interval allow option to store actual delivery frequency for a subscription or service.',
401 'size' => CRM_Utils_Type
::EIGHT
,
402 'default' => 'month',
406 'pseudoconstant' => array(
407 'callback' => 'CRM_Core_SelectValues::getPremiumUnits',
410 'frequency_interval' => array(
411 'name' => 'frequency_interval',
412 'type' => CRM_Utils_Type
::T_INT
,
413 'title' => ts('Frequency Interval') ,
414 'description' => 'Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months).',
418 return self
::$_fields;
421 * Returns an array containing, for each field, the arary key used for that
422 * field in self::$_fields.
426 static function &fieldKeys() {
427 if (!(self
::$_fieldKeys)) {
428 self
::$_fieldKeys = array(
430 'name' => 'product_name',
431 'description' => 'description',
433 'options' => 'options',
435 'thumbnail' => 'thumbnail',
437 'currency' => 'currency',
438 'financial_type_id' => 'financial_type_id',
439 'min_contribution' => 'min_contribution',
441 'is_active' => 'is_active',
442 'period_type' => 'period_type',
443 'fixed_period_start_day' => 'fixed_period_start_day',
444 'duration_unit' => 'duration_unit',
445 'duration_interval' => 'duration_interval',
446 'frequency_unit' => 'frequency_unit',
447 'frequency_interval' => 'frequency_interval',
450 return self
::$_fieldKeys;
453 * Returns the names of this table
457 static function getTableName() {
458 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
461 * Returns if this table needs to be logged
469 * Returns the list of fields that can be imported
471 * @param bool $prefix
475 static function &import($prefix = false) {
476 if (!(self
::$_import)) {
477 self
::$_import = array();
478 $fields = self
::fields();
479 foreach($fields as $name => $field) {
480 if (CRM_Utils_Array
::value('import', $field)) {
482 self
::$_import['product'] = & $fields[$name];
484 self
::$_import[$name] = & $fields[$name];
489 return self
::$_import;
492 * Returns the list of fields that can be exported
494 * @param bool $prefix
498 static function &export($prefix = false) {
499 if (!(self
::$_export)) {
500 self
::$_export = array();
501 $fields = self
::fields();
502 foreach($fields as $name => $field) {
503 if (CRM_Utils_Array
::value('export', $field)) {
505 self
::$_export['product'] = & $fields[$name];
507 self
::$_export[$name] = & $fields[$name];
512 return self
::$_export;