Regen DAOs with new import() / export()
[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 value to see if we should log any modifications to
64 * this table in the civicrm_log table
65 *
66 * @var boolean
67 */
68 static $_log = true;
69 /**
70 * Soft Contribution ID
71 *
72 * @var int unsigned
73 */
74 public $id;
75 /**
76 * FK to contribution table.
77 *
78 * @var int unsigned
79 */
80 public $contribution_id;
81 /**
82 * FK to Contact ID
83 *
84 * @var int unsigned
85 */
86 public $contact_id;
87 /**
88 * Amount of this soft contribution.
89 *
90 * @var float
91 */
92 public $amount;
93 /**
94 * 3 character string, value from config setting or input via user.
95 *
96 * @var string
97 */
98 public $currency;
99 /**
100 * FK to civicrm_pcp.id
101 *
102 * @var int unsigned
103 */
104 public $pcp_id;
105 /**
106 *
107 * @var boolean
108 */
109 public $pcp_display_in_roll;
110 /**
111 *
112 * @var string
113 */
114 public $pcp_roll_nickname;
115 /**
116 *
117 * @var string
118 */
119 public $pcp_personal_note;
120 /**
121 * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.
122 *
123 * @var int unsigned
124 */
125 public $soft_credit_type_id;
126 /**
127 * class constructor
128 *
129 * @return civicrm_contribution_soft
130 */
131 function __construct() {
132 $this->__table = 'civicrm_contribution_soft';
133 parent::__construct();
134 }
135 /**
136 * Returns foreign keys and entity references
137 *
138 * @return array
139 * [CRM_Core_Reference_Interface]
140 */
141 static function getReferenceColumns() {
142 if (!self::$_links) {
143 self::$_links = static ::createReferenceColumns(__CLASS__);
144 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id');
145 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
146 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'pcp_id', 'civicrm_pcp', 'id');
147 }
148 return self::$_links;
149 }
150 /**
151 * Returns all the column names of this table
152 *
153 * @return array
154 */
155 static function &fields() {
156 if (!(self::$_fields)) {
157 self::$_fields = array(
158 'contribution_soft_id' => array(
159 'name' => 'id',
160 'type' => CRM_Utils_Type::T_INT,
161 'title' => ts('Soft Contribution ID') ,
162 'description' => 'Soft Contribution ID',
163 'required' => true,
164 'import' => true,
165 'where' => 'civicrm_contribution_soft.id',
166 'headerPattern' => '',
167 'dataPattern' => '',
168 'export' => true,
169 ) ,
170 'contribution_id' => array(
171 'name' => 'contribution_id',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('Soft Contribution - Contribution') ,
174 'description' => 'FK to contribution table.',
175 'required' => true,
176 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
177 ) ,
178 'contribution_soft_contact_id' => array(
179 'name' => 'contact_id',
180 'type' => CRM_Utils_Type::T_INT,
181 'title' => ts('Contact ID') ,
182 'description' => 'FK to Contact ID',
183 'required' => true,
184 'import' => true,
185 'where' => 'civicrm_contribution_soft.contact_id',
186 'headerPattern' => '/contact(.?id)?/i',
187 'dataPattern' => '/^\d+$/',
188 'export' => true,
189 'FKClassName' => 'CRM_Contact_DAO_Contact',
190 ) ,
191 'amount' => array(
192 'name' => 'amount',
193 'type' => CRM_Utils_Type::T_MONEY,
194 'title' => ts('Soft Contribution Amount') ,
195 'description' => 'Amount of this soft contribution.',
196 'required' => true,
197 'precision' => array(
198 20,
199 2
200 ) ,
201 'import' => true,
202 'where' => 'civicrm_contribution_soft.amount',
203 'headerPattern' => '/total(.?am(ou)?nt)?/i',
204 'dataPattern' => '/^\d+(\.\d{2})?$/',
205 'export' => true,
206 ) ,
207 'currency' => array(
208 'name' => 'currency',
209 'type' => CRM_Utils_Type::T_STRING,
210 'title' => ts('Soft Contribution Currency') ,
211 'description' => '3 character string, value from config setting or input via user.',
212 'maxlength' => 3,
213 'size' => CRM_Utils_Type::FOUR,
214 'default' => 'NULL',
215 'html' => array(
216 'type' => 'Select',
217 ) ,
218 'pseudoconstant' => array(
219 'table' => 'civicrm_currency',
220 'keyColumn' => 'name',
221 'labelColumn' => 'full_name',
222 'nameColumn' => 'name',
223 )
224 ) ,
225 'pcp_id' => array(
226 'name' => 'pcp_id',
227 'type' => CRM_Utils_Type::T_INT,
228 'title' => ts('Soft Contribution PCP') ,
229 'description' => 'FK to civicrm_pcp.id',
230 'default' => 'NULL',
231 'FKClassName' => 'CRM_PCP_DAO_PCP',
232 'pseudoconstant' => array(
233 'table' => 'civicrm_pcp',
234 'keyColumn' => 'id',
235 'labelColumn' => 'title',
236 )
237 ) ,
238 'pcp_display_in_roll' => array(
239 'name' => 'pcp_display_in_roll',
240 'type' => CRM_Utils_Type::T_BOOLEAN,
241 'title' => ts('Soft Contribution Display on PCP') ,
242 ) ,
243 'pcp_roll_nickname' => array(
244 'name' => 'pcp_roll_nickname',
245 'type' => CRM_Utils_Type::T_STRING,
246 'title' => ts('Soft Contribution PCP Nickname') ,
247 'maxlength' => 255,
248 'size' => CRM_Utils_Type::HUGE,
249 'default' => 'NULL',
250 ) ,
251 'pcp_personal_note' => array(
252 'name' => 'pcp_personal_note',
253 'type' => CRM_Utils_Type::T_STRING,
254 'title' => ts('Soft Contribution PCP Note') ,
255 'maxlength' => 255,
256 'size' => CRM_Utils_Type::HUGE,
257 'default' => 'NULL',
258 ) ,
259 'soft_credit_type_id' => array(
260 'name' => 'soft_credit_type_id',
261 'type' => CRM_Utils_Type::T_INT,
262 'title' => ts('Soft Credit Type') ,
263 'description' => 'Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.',
264 'default' => 'NULL',
265 'pseudoconstant' => array(
266 'optionGroupName' => 'soft_credit_type',
267 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
268 )
269 ) ,
270 );
271 }
272 return self::$_fields;
273 }
274 /**
275 * Returns an array containing, for each field, the arary key used for that
276 * field in self::$_fields.
277 *
278 * @return array
279 */
280 static function &fieldKeys() {
281 if (!(self::$_fieldKeys)) {
282 self::$_fieldKeys = array(
283 'id' => 'contribution_soft_id',
284 'contribution_id' => 'contribution_id',
285 'contact_id' => 'contribution_soft_contact_id',
286 'amount' => 'amount',
287 'currency' => 'currency',
288 'pcp_id' => 'pcp_id',
289 'pcp_display_in_roll' => 'pcp_display_in_roll',
290 'pcp_roll_nickname' => 'pcp_roll_nickname',
291 'pcp_personal_note' => 'pcp_personal_note',
292 'soft_credit_type_id' => 'soft_credit_type_id',
293 );
294 }
295 return self::$_fieldKeys;
296 }
297 /**
298 * Returns the names of this table
299 *
300 * @return string
301 */
302 static function getTableName() {
303 return self::$_tableName;
304 }
305 /**
306 * Returns if this table needs to be logged
307 *
308 * @return boolean
309 */
310 function getLog() {
311 return self::$_log;
312 }
313 /**
314 * Returns the list of fields that can be imported
315 *
316 * @param bool $prefix
317 *
318 * @return array
319 */
320 static function &import($prefix = false) {
321 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, array());
322 return $r;
323 }
324 /**
325 * Returns the list of fields that can be exported
326 *
327 * @param bool $prefix
328 *
329 * @return array
330 */
331 static function &export($prefix = false) {
332 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, array());
333 return $r;
334 }
335 }