3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
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 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2015
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
38 * Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set
40 class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set
extends CRM_Core_DAO
{
42 * static instance to hold the table name
46 static $_tableName = 'civicrm_price_set';
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 * Which Domain is this price-set for
93 * Variable name/programmatic handle for this set of price fields.
99 * Displayed title for the Price Set.
105 * Is this price set active
111 * Description and/or help text to display before fields in form.
117 * Description and/or help text to display after fields in form.
123 * Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional
129 * What components are using this price set?
135 * FK to Contribution Type(for membership price sets only).
139 public $contribution_type_id;
141 * Is set if edited on Contribution or Event Page rather than through Manage Price Sets
145 public $is_quick_config;
147 * Is this a predefined system price set (i.e. it can not be deleted, edited)?
156 * @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set
158 public function __construct() {
159 $this->__table
= 'civicrm_price_set';
160 parent
::__construct();
164 * Return foreign links.
168 public function links() {
169 if (!(self
::$_links)) {
170 self
::$_links = array(
171 'domain_id' => 'civicrm_domain:id',
172 'contribution_type_id' => 'civicrm_contribution_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 'domain_id' => array(
192 'name' => 'domain_id',
193 'type' => CRM_Utils_Type
::T_INT
,
194 'FKClassName' => 'CRM_Core_DAO_Domain',
198 'type' => CRM_Utils_Type
::T_STRING
,
199 'title' => ts('Name'),
202 'size' => CRM_Utils_Type
::HUGE
,
206 'type' => CRM_Utils_Type
::T_STRING
,
207 'title' => ts('Title'),
210 'size' => CRM_Utils_Type
::HUGE
,
212 'is_active' => array(
213 'name' => 'is_active',
214 'type' => CRM_Utils_Type
::T_BOOLEAN
,
218 'name' => 'help_pre',
219 'type' => CRM_Utils_Type
::T_TEXT
,
220 'title' => ts('Help Pre'),
224 'help_post' => array(
225 'name' => 'help_post',
226 'type' => CRM_Utils_Type
::T_TEXT
,
227 'title' => ts('Help Post'),
231 'javascript' => array(
232 'name' => 'javascript',
233 'type' => CRM_Utils_Type
::T_STRING
,
234 'title' => ts('Javascript'),
236 'size' => CRM_Utils_Type
::BIG
,
240 'type' => CRM_Utils_Type
::T_STRING
,
241 'title' => ts('Extends'),
244 'size' => CRM_Utils_Type
::HUGE
,
246 'contribution_type_id' => array(
247 'name' => 'contribution_type_id',
248 'type' => CRM_Utils_Type
::T_INT
,
250 'FKClassName' => 'CRM_Contribute_DAO_ContributionType',
252 'is_quick_config' => array(
253 'name' => 'is_quick_config',
254 'type' => CRM_Utils_Type
::T_BOOLEAN
,
256 'is_reserved' => array(
257 'name' => 'is_reserved',
258 '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.
288 static function &import($prefix = FALSE) {
289 if (!(self
::$_import)) {
290 self
::$_import = array();
291 $fields = self
::fields();
292 foreach ($fields as $name => $field) {
293 if (!empty($field['import'])) {
295 self
::$_import['price_set'] = &$fields[$name];
298 self
::$_import[$name] = &$fields[$name];
303 return self
::$_import;
307 * returns the list of fields that can be exported.
311 static function &export($prefix = FALSE) {
312 if (!(self
::$_export)) {
313 self
::$_export = array();
314 $fields = self
::fields();
315 foreach ($fields as $name => $field) {
316 if (!empty($field['export'])) {
318 self
::$_export['price_set'] = &$fields[$name];
321 self
::$_export[$name] = &$fields[$name];
326 return self
::$_export;