Fix visibility on legacy functions
[civicrm-core.git] / CRM / Upgrade / Snapshot / V4p2 / Price / DAO / Set.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
26 */
27 /**
28 *
29 * @package CRM
30 * @copyright CiviCRM LLC (c) 2004-2017
31 * $Id$
32 *
33 */
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36
37 /**
38 * Class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set
39 */
40 class CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set extends CRM_Core_DAO {
41 /**
42 * static instance to hold the table name
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_price_set';
47 /**
48 * static instance to hold the field values
49 *
50 * @var array
51 */
52 static $_fields = NULL;
53 /**
54 * static instance to hold the FK relationships
55 *
56 * @var string
57 */
58 static $_links = NULL;
59 /**
60 * static instance to hold the values that can
61 * be imported
62 *
63 * @var array
64 */
65 static $_import = NULL;
66 /**
67 * static instance to hold the values that can
68 * be exported
69 *
70 * @var array
71 */
72 static $_export = NULL;
73 /**
74 * static value to see if we should log any modifications to
75 * this table in the civicrm_log table
76 *
77 * @var boolean
78 */
79 static $_log = TRUE;
80 /**
81 * Price Set
82 *
83 * @var int unsigned
84 */
85 public $id;
86 /**
87 * Which Domain is this price-set for
88 *
89 * @var int unsigned
90 */
91 public $domain_id;
92 /**
93 * Variable name/programmatic handle for this set of price fields.
94 *
95 * @var string
96 */
97 public $name;
98 /**
99 * Displayed title for the Price Set.
100 *
101 * @var string
102 */
103 public $title;
104 /**
105 * Is this price set active
106 *
107 * @var boolean
108 */
109 public $is_active;
110 /**
111 * Description and/or help text to display before fields in form.
112 *
113 * @var text
114 */
115 public $help_pre;
116 /**
117 * Description and/or help text to display after fields in form.
118 *
119 * @var text
120 */
121 public $help_post;
122 /**
123 * Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional
124 *
125 * @var string
126 */
127 public $javascript;
128 /**
129 * What components are using this price set?
130 *
131 * @var string
132 */
133 public $extends;
134 /**
135 * FK to Contribution Type(for membership price sets only).
136 *
137 * @var int unsigned
138 */
139 public $contribution_type_id;
140 /**
141 * Is set if edited on Contribution or Event Page rather than through Manage Price Sets
142 *
143 * @var boolean
144 */
145 public $is_quick_config;
146 /**
147 * Is this a predefined system price set (i.e. it can not be deleted, edited)?
148 *
149 * @var boolean
150 */
151 public $is_reserved;
152
153 /**
154 * Class constructor.
155 *
156 * @return \CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set
157 */
158 public function __construct() {
159 $this->__table = 'civicrm_price_set';
160 parent::__construct();
161 }
162
163 /**
164 * Return foreign links.
165 *
166 * @return array
167 */
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',
173 );
174 }
175 return self::$_links;
176 }
177
178 /**
179 * Returns all the column names of this table.
180 *
181 * @return array
182 */
183 public static function &fields() {
184 if (!(self::$_fields)) {
185 self::$_fields = array(
186 'id' => array(
187 'name' => 'id',
188 'type' => CRM_Utils_Type::T_INT,
189 'required' => TRUE,
190 ),
191 'domain_id' => array(
192 'name' => 'domain_id',
193 'type' => CRM_Utils_Type::T_INT,
194 'FKClassName' => 'CRM_Core_DAO_Domain',
195 ),
196 'name' => array(
197 'name' => 'name',
198 'type' => CRM_Utils_Type::T_STRING,
199 'title' => ts('Name'),
200 'required' => TRUE,
201 'maxlength' => 255,
202 'size' => CRM_Utils_Type::HUGE,
203 ),
204 'title' => array(
205 'name' => 'title',
206 'type' => CRM_Utils_Type::T_STRING,
207 'title' => ts('Title'),
208 'required' => TRUE,
209 'maxlength' => 255,
210 'size' => CRM_Utils_Type::HUGE,
211 ),
212 'is_active' => array(
213 'name' => 'is_active',
214 'type' => CRM_Utils_Type::T_BOOLEAN,
215 'default' => '',
216 ),
217 'help_pre' => array(
218 'name' => 'help_pre',
219 'type' => CRM_Utils_Type::T_TEXT,
220 'title' => ts('Help Pre'),
221 'rows' => 4,
222 'cols' => 80,
223 ),
224 'help_post' => array(
225 'name' => 'help_post',
226 'type' => CRM_Utils_Type::T_TEXT,
227 'title' => ts('Help Post'),
228 'rows' => 4,
229 'cols' => 80,
230 ),
231 'javascript' => array(
232 'name' => 'javascript',
233 'type' => CRM_Utils_Type::T_STRING,
234 'title' => ts('Javascript'),
235 'maxlength' => 64,
236 'size' => CRM_Utils_Type::BIG,
237 ),
238 'extends' => array(
239 'name' => 'extends',
240 'type' => CRM_Utils_Type::T_STRING,
241 'title' => ts('Extends'),
242 'required' => TRUE,
243 'maxlength' => 255,
244 'size' => CRM_Utils_Type::HUGE,
245 ),
246 'contribution_type_id' => array(
247 'name' => 'contribution_type_id',
248 'type' => CRM_Utils_Type::T_INT,
249 'default' => 'UL',
250 'FKClassName' => 'CRM_Contribute_DAO_ContributionType',
251 ),
252 'is_quick_config' => array(
253 'name' => 'is_quick_config',
254 'type' => CRM_Utils_Type::T_BOOLEAN,
255 ),
256 'is_reserved' => array(
257 'name' => 'is_reserved',
258 'type' => CRM_Utils_Type::T_BOOLEAN,
259 ),
260 );
261 }
262 return self::$_fields;
263 }
264
265 /**
266 * returns the names of this table.
267 *
268 * @return string
269 */
270 public static function getTableName() {
271 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
272 }
273
274 /**
275 * returns if this table needs to be logged.
276 *
277 * @return boolean
278 */
279 public function getLog() {
280 return self::$_log;
281 }
282
283 /**
284 * Returns the list of fields that can be imported.
285 *
286 * @param bool $prefix
287 *
288 * @return array
289 */
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'])) {
296 if ($prefix) {
297 self::$_import['price_set'] = &$fields[$name];
298 }
299 else {
300 self::$_import[$name] = &$fields[$name];
301 }
302 }
303 }
304 }
305 return self::$_import;
306 }
307
308 /**
309 * returns the list of fields that can be exported.
310 *
311 * @param bool $prefix
312 *
313 * @return array
314 */
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'])) {
321 if ($prefix) {
322 self::$_export['price_set'] = &$fields[$name];
323 }
324 else {
325 self::$_export[$name] = &$fields[$name];
326 }
327 }
328 }
329 }
330 return self::$_export;
331 }
332 }