3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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-2014
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue
extends CRM_Core_DAO
39 * static instance to hold the table name
44 static $_tableName = 'civicrm_price_field_value';
46 * static instance to hold the field values
51 static $_fields = null;
53 * static instance to hold the FK relationships
58 static $_links = null;
60 * static instance to hold the values that can
66 static $_import = null;
68 * 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
90 * FK to civicrm_price_field
94 public $price_field_id;
96 * Price field option name
102 * Price field option label
108 * >Price field option description.
114 * Price field option amount
120 * Number of participants per field option
126 * Max number of participants per field options
132 * Order in which the field options should appear
138 * FK to Membership Type
142 public $membership_type_id;
144 * Is this default price field option
150 * Is this price field value active
159 * @return civicrm_price_field_value
161 function __construct()
163 $this->__table
= 'civicrm_price_field_value';
164 parent
::__construct();
167 * return foreign links
174 if (!(self
::$_links)) {
175 self
::$_links = array(
176 'price_field_id' => 'civicrm_price_field:id',
177 'membership_type_id' => 'civicrm_membership_type:id',
180 return self
::$_links;
183 * returns all the column names of this table
188 static function &fields()
190 if (!(self
::$_fields)) {
191 self
::$_fields = array(
194 'type' => CRM_Utils_Type
::T_INT
,
197 'price_field_id' => array(
198 'name' => 'price_field_id',
199 'type' => CRM_Utils_Type
::T_INT
,
201 'FKClassName' => 'Snapshot_v4p2_Price_DAO_Field',
205 'type' => CRM_Utils_Type
::T_STRING
,
206 'title' => ts('Name') ,
208 'size' => CRM_Utils_Type
::HUGE
,
212 'type' => CRM_Utils_Type
::T_STRING
,
213 'title' => ts('Label') ,
215 'size' => CRM_Utils_Type
::HUGE
,
217 'description' => array(
218 'name' => 'description',
219 'type' => CRM_Utils_Type
::T_TEXT
,
220 'title' => ts('Description') ,
227 'type' => CRM_Utils_Type
::T_STRING
,
228 'title' => ts('Amount') ,
231 'size' => CRM_Utils_Type
::HUGE
,
235 'type' => CRM_Utils_Type
::T_INT
,
236 'title' => ts('Count') ,
239 'max_value' => array(
240 'name' => 'max_value',
241 'type' => CRM_Utils_Type
::T_INT
,
242 'title' => ts('Max Value') ,
247 'type' => CRM_Utils_Type
::T_INT
,
248 'title' => ts('Weight') ,
251 'membership_type_id' => array(
252 'name' => 'membership_type_id',
253 'type' => CRM_Utils_Type
::T_INT
,
255 'FKClassName' => 'CRM_Member_DAO_MembershipType',
257 'is_default' => array(
258 'name' => 'is_default',
259 'type' => CRM_Utils_Type
::T_BOOLEAN
,
261 'is_active' => array(
262 'name' => 'is_active',
263 'type' => CRM_Utils_Type
::T_BOOLEAN
,
268 return self
::$_fields;
271 * returns the names of this table
277 static function getTableName()
279 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
282 * returns if this table needs to be logged
292 * returns the list of fields that can be imported
298 static function &import($prefix = false)
300 if (!(self
::$_import)) {
301 self
::$_import = array();
302 $fields = self
::fields();
303 foreach($fields as $name => $field) {
304 if (!empty($field['import'])) {
306 self
::$_import['price_field_value'] = & $fields[$name];
308 self
::$_import[$name] = & $fields[$name];
313 return self
::$_import;
316 * returns the list of fields that can be exported
322 static function &export($prefix = false)
324 if (!(self
::$_export)) {
325 self
::$_export = array();
326 $fields = self
::fields();
327 foreach($fields as $name => $field) {
328 if (!empty($field['export'])) {
330 self
::$_export['price_field_value'] = & $fields[$name];
332 self
::$_export[$name] = & $fields[$name];
337 return self
::$_export;