3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2016
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
38 * Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue
40 class CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue
extends CRM_Core_DAO
{
42 * static instance to hold the table name
46 static $_tableName = 'civicrm_price_field_value';
48 * static instance to hold the field values
52 static $_fields = NULL;
54 * static instance to hold the FK relationships
58 static $_links = NULL;
60 * static instance to hold the values that can
65 static $_import = NULL;
67 * static instance to hold the values that can
72 static $_export = NULL;
74 * static value to see if we should log any modifications to
75 * this table in the civicrm_log table
87 * FK to civicrm_price_field
91 public $price_field_id;
93 * Price field option name
99 * Price field option label
105 * >Price field option description.
111 * Price field option amount
117 * Number of participants per field option
123 * Max number of participants per field options
129 * Order in which the field options should appear
135 * FK to Membership Type
139 public $membership_type_id;
141 * Is this default price field option
147 * Is this price field value active
156 * @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue
158 public function __construct() {
159 $this->__table
= 'civicrm_price_field_value';
160 parent
::__construct();
164 * Return foreign links.
168 public function links() {
169 if (!(self
::$_links)) {
170 self
::$_links = array(
171 'price_field_id' => 'civicrm_price_field:id',
172 'membership_type_id' => 'civicrm_membership_type:id',
175 return self
::$_links;
179 * Returns all the column names of this table.
183 static function &fields() {
184 if (!(self
::$_fields)) {
185 self
::$_fields = array(
188 'type' => CRM_Utils_Type
::T_INT
,
191 'price_field_id' => array(
192 'name' => 'price_field_id',
193 'type' => CRM_Utils_Type
::T_INT
,
195 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Field',
199 'type' => CRM_Utils_Type
::T_STRING
,
200 'title' => ts('Name'),
202 'size' => CRM_Utils_Type
::HUGE
,
206 'type' => CRM_Utils_Type
::T_STRING
,
207 'title' => ts('Label'),
209 'size' => CRM_Utils_Type
::HUGE
,
211 'description' => array(
212 'name' => 'description',
213 'type' => CRM_Utils_Type
::T_TEXT
,
214 'title' => ts('Description'),
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Amount'),
225 'size' => CRM_Utils_Type
::HUGE
,
229 'type' => CRM_Utils_Type
::T_INT
,
230 'title' => ts('Count'),
233 'max_value' => array(
234 'name' => 'max_value',
235 'type' => CRM_Utils_Type
::T_INT
,
236 'title' => ts('Max Value'),
241 'type' => CRM_Utils_Type
::T_INT
,
242 'title' => ts('Weight'),
245 'membership_type_id' => array(
246 'name' => 'membership_type_id',
247 'type' => CRM_Utils_Type
::T_INT
,
249 'FKClassName' => 'CRM_Member_DAO_MembershipType',
251 'is_default' => array(
252 'name' => 'is_default',
253 'type' => CRM_Utils_Type
::T_BOOLEAN
,
255 'is_active' => array(
256 'name' => 'is_active',
257 'type' => CRM_Utils_Type
::T_BOOLEAN
,
262 return self
::$_fields;
266 * returns the names of this table.
270 public static function getTableName() {
271 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
275 * returns if this table needs to be logged.
279 public function getLog() {
284 * Returns the list of fields that can be imported.
286 * @param bool $prefix
290 static function &import($prefix = FALSE) {
291 if (!(self
::$_import)) {
292 self
::$_import = array();
293 $fields = self
::fields();
294 foreach ($fields as $name => $field) {
295 if (!empty($field['import'])) {
297 self
::$_import['price_field_value'] = &$fields[$name];
300 self
::$_import[$name] = &$fields[$name];
305 return self
::$_import;
309 * Returns the list of fields that can be exported.
311 * @param bool $prefix
315 static function &export($prefix = FALSE) {
316 if (!(self
::$_export)) {
317 self
::$_export = array();
318 $fields = self
::fields();
319 foreach ($fields as $name => $field) {
320 if (!empty($field['export'])) {
322 self
::$_export['price_field_value'] = &$fields[$name];
325 self
::$_export[$name] = &$fields[$name];
330 return self
::$_export;