fixup CRM-14885 - Import DAOs
[civicrm-core.git] / CRM / Contribute / DAO / ContributionSoft.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Contribute/ContributionSoft.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:ea8abcdf53630758c538439bb186c717)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_contribution_soft';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = true;
83 /**
84 * Soft Contribution ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * FK to contribution table.
91 *
92 * @var int unsigned
93 */
94 public $contribution_id;
95 /**
96 * FK to Contact ID
97 *
98 * @var int unsigned
99 */
100 public $contact_id;
101 /**
102 * Amount of this soft contribution.
103 *
104 * @var float
105 */
106 public $amount;
107 /**
108 * 3 character string, value from config setting or input via user.
109 *
110 * @var string
111 */
112 public $currency;
113 /**
114 * FK to civicrm_pcp.id
115 *
116 * @var int unsigned
117 */
118 public $pcp_id;
119 /**
120 *
121 * @var boolean
122 */
123 public $pcp_display_in_roll;
124 /**
125 *
126 * @var string
127 */
128 public $pcp_roll_nickname;
129 /**
130 *
131 * @var string
132 */
133 public $pcp_personal_note;
134 /**
135 * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.
136 *
137 * @var int unsigned
138 */
139 public $soft_credit_type_id;
140 /**
141 * class constructor
142 *
143 * @return civicrm_contribution_soft
144 */
145 function __construct() {
146 $this->__table = 'civicrm_contribution_soft';
147 parent::__construct();
148 }
149 /**
150 * Returns foreign keys and entity references
151 *
152 * @return array
153 * [CRM_Core_Reference_Interface]
154 */
155 static function getReferenceColumns() {
156 if (!self::$_links) {
157 self::$_links = static ::createReferenceColumns(__CLASS__);
158 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id');
159 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
160 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'pcp_id', 'civicrm_pcp', 'id');
161 }
162 return self::$_links;
163 }
164 /**
165 * Returns all the column names of this table
166 *
167 * @return array
168 */
169 static function &fields() {
170 if (!(self::$_fields)) {
171 self::$_fields = array(
172 'contribution_soft_id' => array(
173 'name' => 'id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Soft Contribution ID') ,
176 'description' => 'Soft Contribution ID',
177 'required' => true,
178 'import' => true,
179 'where' => 'civicrm_contribution_soft.id',
180 'headerPattern' => '',
181 'dataPattern' => '',
182 'export' => true,
183 ) ,
184 'contribution_id' => array(
185 'name' => 'contribution_id',
186 'type' => CRM_Utils_Type::T_INT,
187 'title' => ts('Soft Contribution - Contribution') ,
188 'description' => 'FK to contribution table.',
189 'required' => true,
190 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
191 ) ,
192 'contribution_soft_contact_id' => array(
193 'name' => 'contact_id',
194 'type' => CRM_Utils_Type::T_INT,
195 'title' => ts('Contact ID') ,
196 'description' => 'FK to Contact ID',
197 'required' => true,
198 'import' => true,
199 'where' => 'civicrm_contribution_soft.contact_id',
200 'headerPattern' => '/contact(.?id)?/i',
201 'dataPattern' => '/^\d+$/',
202 'export' => true,
203 'FKClassName' => 'CRM_Contact_DAO_Contact',
204 ) ,
205 'amount' => array(
206 'name' => 'amount',
207 'type' => CRM_Utils_Type::T_MONEY,
208 'title' => ts('Soft Contribution Amount') ,
209 'description' => 'Amount of this soft contribution.',
210 'required' => true,
211 'precision' => array(
212 20,
213 2
214 ) ,
215 'import' => true,
216 'where' => 'civicrm_contribution_soft.amount',
217 'headerPattern' => '/total(.?am(ou)?nt)?/i',
218 'dataPattern' => '/^\d+(\.\d{2})?$/',
219 'export' => true,
220 ) ,
221 'currency' => array(
222 'name' => 'currency',
223 'type' => CRM_Utils_Type::T_STRING,
224 'title' => ts('Soft Contribution Currency') ,
225 'description' => '3 character string, value from config setting or input via user.',
226 'maxlength' => 3,
227 'size' => CRM_Utils_Type::FOUR,
228 'default' => 'NULL',
229 'html' => array(
230 'type' => 'Select',
231 ) ,
232 'pseudoconstant' => array(
233 'table' => 'civicrm_currency',
234 'keyColumn' => 'name',
235 'labelColumn' => 'full_name',
236 'nameColumn' => 'name',
237 )
238 ) ,
239 'pcp_id' => array(
240 'name' => 'pcp_id',
241 'type' => CRM_Utils_Type::T_INT,
242 'title' => ts('Soft Contribution PCP') ,
243 'description' => 'FK to civicrm_pcp.id',
244 'default' => 'NULL',
245 'FKClassName' => 'CRM_PCP_DAO_PCP',
246 'pseudoconstant' => array(
247 'table' => 'civicrm_pcp',
248 'keyColumn' => 'id',
249 'labelColumn' => 'title',
250 )
251 ) ,
252 'pcp_display_in_roll' => array(
253 'name' => 'pcp_display_in_roll',
254 'type' => CRM_Utils_Type::T_BOOLEAN,
255 'title' => ts('Soft Contribution Display on PCP') ,
256 ) ,
257 'pcp_roll_nickname' => array(
258 'name' => 'pcp_roll_nickname',
259 'type' => CRM_Utils_Type::T_STRING,
260 'title' => ts('Soft Contribution PCP Nickname') ,
261 'maxlength' => 255,
262 'size' => CRM_Utils_Type::HUGE,
263 'default' => 'NULL',
264 ) ,
265 'pcp_personal_note' => array(
266 'name' => 'pcp_personal_note',
267 'type' => CRM_Utils_Type::T_STRING,
268 'title' => ts('Soft Contribution PCP Note') ,
269 'maxlength' => 255,
270 'size' => CRM_Utils_Type::HUGE,
271 'default' => 'NULL',
272 ) ,
273 'soft_credit_type_id' => array(
274 'name' => 'soft_credit_type_id',
275 'type' => CRM_Utils_Type::T_INT,
276 'title' => ts('Soft Credit Type') ,
277 'description' => 'Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.',
278 'default' => 'NULL',
279 'pseudoconstant' => array(
280 'optionGroupName' => 'soft_credit_type',
281 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
282 )
283 ) ,
284 );
285 }
286 return self::$_fields;
287 }
288 /**
289 * Returns an array containing, for each field, the arary key used for that
290 * field in self::$_fields.
291 *
292 * @return array
293 */
294 static function &fieldKeys() {
295 if (!(self::$_fieldKeys)) {
296 self::$_fieldKeys = array(
297 'id' => 'contribution_soft_id',
298 'contribution_id' => 'contribution_id',
299 'contact_id' => 'contribution_soft_contact_id',
300 'amount' => 'amount',
301 'currency' => 'currency',
302 'pcp_id' => 'pcp_id',
303 'pcp_display_in_roll' => 'pcp_display_in_roll',
304 'pcp_roll_nickname' => 'pcp_roll_nickname',
305 'pcp_personal_note' => 'pcp_personal_note',
306 'soft_credit_type_id' => 'soft_credit_type_id',
307 );
308 }
309 return self::$_fieldKeys;
310 }
311 /**
312 * Returns the names of this table
313 *
314 * @return string
315 */
316 static function getTableName() {
317 return self::$_tableName;
318 }
319 /**
320 * Returns if this table needs to be logged
321 *
322 * @return boolean
323 */
324 function getLog() {
325 return self::$_log;
326 }
327 /**
328 * Returns the list of fields that can be imported
329 *
330 * @param bool $prefix
331 *
332 * @return array
333 */
334 static function &import($prefix = false) {
335 if (!(self::$_import)) {
336 self::$_import = array();
337 $fields = self::fields();
338 foreach($fields as $name => $field) {
339 if (CRM_Utils_Array::value('import', $field)) {
340 if ($prefix) {
341 self::$_import['contribution_soft'] = & $fields[$name];
342 } else {
343 self::$_import[$name] = & $fields[$name];
344 }
345 }
346 }
347 }
348 return self::$_import;
349 }
350 /**
351 * Returns the list of fields that can be exported
352 *
353 * @param bool $prefix
354 *
355 * @return array
356 */
357 static function &export($prefix = false) {
358 if (!(self::$_export)) {
359 self::$_export = array();
360 $fields = self::fields();
361 foreach($fields as $name => $field) {
362 if (CRM_Utils_Array::value('export', $field)) {
363 if ($prefix) {
364 self::$_export['contribution_soft'] = & $fields[$name];
365 } else {
366 self::$_export[$name] = & $fields[$name];
367 }
368 }
369 }
370 }
371 return self::$_export;
372 }
373 }