3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
31 * Generated from xml/schema/CRM/Contribute/Product.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:cb23fc697bf604c7303bd7c0994635cc)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Contribute_DAO_Product
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_product';
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
57 * Required product/premium name
63 * Optional description of the product/premium.
69 * Optional product sku or code.
75 * Store comma-delimited list of color, size, etc. options for the product.
81 * Full or relative URL to uploaded image - fullsize.
87 * Full or relative URL to image thumbnail.
93 * Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record.
99 * 3 character string, value from config setting or input via user.
105 * FK to Financial Type.
109 public $financial_type_id;
111 * Minimum contribution required to be eligible to select this premium.
115 public $min_contribution;
117 * Actual cost of this product. Useful to determine net return from sale or using this as an incentive.
123 * Disabling premium removes it from the premiums_premium join table below.
129 * Rolling means we set start/end based on current day, fixed means we set start/end for current year or month
130 (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006)
136 * Month and day (MMDD) that fixed period type subscription or membership starts.
140 public $fixed_period_start_day;
145 public $duration_unit;
147 * Number of units for total duration of subscription, service, membership (e.g. 12 Months).
151 public $duration_interval;
153 * Frequency unit and interval allow option to store actual delivery frequency for a subscription or service.
157 public $frequency_unit;
159 * Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months).
163 public $frequency_interval;
167 * @return civicrm_product
169 function __construct() {
170 $this->__table
= 'civicrm_product';
171 parent
::__construct();
174 * Returns foreign keys and entity references
177 * [CRM_Core_Reference_Interface]
179 static function getReferenceColumns() {
180 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
181 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
182 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
183 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
185 return Civi
::$statics[__CLASS__
]['links'];
188 * Returns all the column names of this table
192 static function &fields() {
193 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
194 Civi
::$statics[__CLASS__
]['fields'] = array(
197 'type' => CRM_Utils_Type
::T_INT
,
198 'title' => ts('Product ID') ,
201 'product_name' => array(
203 'type' => CRM_Utils_Type
::T_STRING
,
204 'title' => ts('Product Name') ,
205 'description' => 'Required product/premium name',
208 'size' => CRM_Utils_Type
::HUGE
,
210 'where' => 'civicrm_product.name',
211 'headerPattern' => '',
214 'description' => array(
215 'name' => 'description',
216 'type' => CRM_Utils_Type
::T_TEXT
,
217 'title' => ts('Description') ,
218 'description' => 'Optional description of the product/premium.',
222 'type' => CRM_Utils_Type
::T_STRING
,
223 'title' => ts('SKU') ,
224 'description' => 'Optional product sku or code.',
226 'size' => CRM_Utils_Type
::BIG
,
228 'where' => 'civicrm_product.sku',
229 'headerPattern' => '',
234 'type' => CRM_Utils_Type
::T_TEXT
,
235 'title' => ts('Options') ,
236 'description' => 'Store comma-delimited list of color, size, etc. options for the product.',
240 'type' => CRM_Utils_Type
::T_STRING
,
241 'title' => ts('Image') ,
242 'description' => 'Full or relative URL to uploaded image - fullsize.',
244 'size' => CRM_Utils_Type
::HUGE
,
246 'thumbnail' => array(
247 'name' => 'thumbnail',
248 'type' => CRM_Utils_Type
::T_STRING
,
249 'title' => ts('Thumbnail') ,
250 'description' => 'Full or relative URL to image thumbnail.',
252 'size' => CRM_Utils_Type
::HUGE
,
256 'type' => CRM_Utils_Type
::T_MONEY
,
257 'title' => ts('Price') ,
258 'description' => 'Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record.',
259 'precision' => array(
265 'name' => 'currency',
266 'type' => CRM_Utils_Type
::T_STRING
,
267 'title' => ts('Currency') ,
268 'description' => '3 character string, value from config setting or input via user.',
270 'size' => CRM_Utils_Type
::FOUR
,
275 'pseudoconstant' => array(
276 'table' => 'civicrm_currency',
277 'keyColumn' => 'name',
278 'labelColumn' => 'full_name',
279 'nameColumn' => 'name',
282 'financial_type_id' => array(
283 'name' => 'financial_type_id',
284 'type' => CRM_Utils_Type
::T_INT
,
285 'title' => ts('Financial Type') ,
286 'description' => 'FK to Financial Type.',
288 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
289 'pseudoconstant' => array(
290 'table' => 'civicrm_financial_type',
292 'labelColumn' => 'name',
295 'min_contribution' => array(
296 'name' => 'min_contribution',
297 'type' => CRM_Utils_Type
::T_MONEY
,
298 'title' => ts('Minimum Contribution') ,
299 'description' => 'Minimum contribution required to be eligible to select this premium.',
300 'precision' => array(
307 'type' => CRM_Utils_Type
::T_MONEY
,
308 'title' => ts('Cost') ,
309 'description' => 'Actual cost of this product. Useful to determine net return from sale or using this as an incentive.',
310 'precision' => array(
315 'is_active' => array(
316 'name' => 'is_active',
317 'type' => CRM_Utils_Type
::T_BOOLEAN
,
318 'title' => ts('Is Active') ,
319 'description' => 'Disabling premium removes it from the premiums_premium join table below.',
322 'period_type' => array(
323 'name' => 'period_type',
324 'type' => CRM_Utils_Type
::T_STRING
,
325 'title' => ts('Period Type') ,
326 'description' => 'Rolling means we set start/end based on current day, fixed means we set start/end for current year or month
327 (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) ',
329 'size' => CRM_Utils_Type
::EIGHT
,
330 'default' => 'rolling',
334 'pseudoconstant' => array(
335 'callback' => 'CRM_Core_SelectValues::periodType',
338 'fixed_period_start_day' => array(
339 'name' => 'fixed_period_start_day',
340 'type' => CRM_Utils_Type
::T_INT
,
341 'title' => ts('Fixed Period Start Day') ,
342 'description' => 'Month and day (MMDD) that fixed period type subscription or membership starts.',
345 'duration_unit' => array(
346 'name' => 'duration_unit',
347 'type' => CRM_Utils_Type
::T_STRING
,
348 'title' => ts('Duration Unit') ,
350 'size' => CRM_Utils_Type
::EIGHT
,
355 'pseudoconstant' => array(
356 'callback' => 'CRM_Core_SelectValues::getPremiumUnits',
359 'duration_interval' => array(
360 'name' => 'duration_interval',
361 'type' => CRM_Utils_Type
::T_INT
,
362 'title' => ts('Duration Interval') ,
363 'description' => 'Number of units for total duration of subscription, service, membership (e.g. 12 Months).',
365 'frequency_unit' => array(
366 'name' => 'frequency_unit',
367 'type' => CRM_Utils_Type
::T_STRING
,
368 'title' => ts('Frequency Unit') ,
369 'description' => 'Frequency unit and interval allow option to store actual delivery frequency for a subscription or service.',
371 'size' => CRM_Utils_Type
::EIGHT
,
372 'default' => 'month',
376 'pseudoconstant' => array(
377 'callback' => 'CRM_Core_SelectValues::getPremiumUnits',
380 'frequency_interval' => array(
381 'name' => 'frequency_interval',
382 'type' => CRM_Utils_Type
::T_INT
,
383 'title' => ts('Frequency Interval') ,
384 'description' => 'Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months).',
387 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
389 return Civi
::$statics[__CLASS__
]['fields'];
392 * Return a mapping from field-name to the corresponding key (as used in fields()).
395 * Array(string $name => string $uniqueName).
397 static function &fieldKeys() {
398 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
399 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
401 return Civi
::$statics[__CLASS__
]['fieldKeys'];
404 * Returns the names of this table
408 static function getTableName() {
409 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
412 * Returns if this table needs to be logged
420 * Returns the list of fields that can be imported
422 * @param bool $prefix
426 static function &import($prefix = false) {
427 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'product', $prefix, array());
431 * Returns the list of fields that can be exported
433 * @param bool $prefix
437 static function &export($prefix = false) {
438 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'product', $prefix, array());