Commit | Line | Data |
---|---|---|
e501603b TO |
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/Financial/FinancialItem.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:4abc5641f9aab2a8d925cf5898a3a858) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_financial_item'; | |
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; | |
e501603b TO |
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 | * | |
71 | * @var int unsigned | |
72 | */ | |
73 | public $id; | |
74 | /** | |
75 | * Date and time the item was created | |
76 | * | |
77 | * @var timestamp | |
78 | */ | |
79 | public $created_date; | |
80 | /** | |
81 | * Date and time of the source transaction | |
82 | * | |
83 | * @var datetime | |
84 | */ | |
85 | public $transaction_date; | |
86 | /** | |
87 | * FK to Contact ID of contact the item is from | |
88 | * | |
89 | * @var int unsigned | |
90 | */ | |
91 | public $contact_id; | |
92 | /** | |
93 | * Human readable description of this item, to ease display without lookup of source item. | |
94 | * | |
95 | * @var string | |
96 | */ | |
97 | public $description; | |
98 | /** | |
99 | * Total amount of this item | |
100 | * | |
101 | * @var float | |
102 | */ | |
103 | public $amount; | |
104 | /** | |
105 | * Currency for the amount | |
106 | * | |
107 | * @var string | |
108 | */ | |
109 | public $currency; | |
110 | /** | |
111 | * FK to civicrm_financial_account | |
112 | * | |
113 | * @var int unsigned | |
114 | */ | |
115 | public $financial_account_id; | |
116 | /** | |
117 | * Payment status: test, paid, part_paid, unpaid (if empty assume unpaid) | |
118 | * | |
119 | * @var int unsigned | |
120 | */ | |
121 | public $status_id; | |
122 | /** | |
123 | * The table providing the source of this item such as civicrm_line_item | |
124 | * | |
125 | * @var string | |
126 | */ | |
127 | public $entity_table; | |
128 | /** | |
129 | * The specific source item that is responsible for the creation of this financial_item | |
130 | * | |
131 | * @var int unsigned | |
132 | */ | |
133 | public $entity_id; | |
134 | /** | |
135 | * class constructor | |
136 | * | |
137 | * @return civicrm_financial_item | |
138 | */ | |
139 | function __construct() { | |
140 | $this->__table = 'civicrm_financial_item'; | |
141 | parent::__construct(); | |
142 | } | |
143 | /** | |
144 | * Returns foreign keys and entity references | |
145 | * | |
146 | * @return array | |
147 | * [CRM_Core_Reference_Interface] | |
148 | */ | |
149 | static function getReferenceColumns() { | |
150 | if (!self::$_links) { | |
151 | self::$_links = static ::createReferenceColumns(__CLASS__); | |
152 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
153 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id'); | |
154 | self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); | |
155 | } | |
156 | return self::$_links; | |
157 | } | |
158 | /** | |
159 | * Returns all the column names of this table | |
160 | * | |
161 | * @return array | |
162 | */ | |
163 | static function &fields() { | |
164 | if (!(self::$_fields)) { | |
165 | self::$_fields = array( | |
166 | 'id' => array( | |
167 | 'name' => 'id', | |
168 | 'type' => CRM_Utils_Type::T_INT, | |
169 | 'title' => ts('Financial Item ID') , | |
170 | 'required' => true, | |
171 | ) , | |
172 | 'created_date' => array( | |
173 | 'name' => 'created_date', | |
174 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
175 | 'title' => ts('Financial Item Created Date') , | |
176 | 'description' => 'Date and time the item was created', | |
177 | 'required' => true, | |
178 | 'default' => 'CURRENT_TIMESTAMP', | |
179 | ) , | |
180 | 'transaction_date' => array( | |
181 | 'name' => 'transaction_date', | |
182 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
183 | 'title' => ts('Financial Item Transaction Date') , | |
184 | 'description' => 'Date and time of the source transaction', | |
185 | 'required' => true, | |
186 | ) , | |
187 | 'contact_id' => array( | |
188 | 'name' => 'contact_id', | |
189 | 'type' => CRM_Utils_Type::T_INT, | |
190 | 'title' => ts('Financial Item Contact ID') , | |
191 | 'description' => 'FK to Contact ID of contact the item is from', | |
192 | 'required' => true, | |
193 | 'export' => true, | |
194 | 'where' => 'civicrm_financial_item.contact_id', | |
195 | 'headerPattern' => '', | |
196 | 'dataPattern' => '', | |
197 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
198 | ) , | |
199 | 'description' => array( | |
200 | 'name' => 'description', | |
201 | 'type' => CRM_Utils_Type::T_STRING, | |
202 | 'title' => ts('Financial Item Description') , | |
203 | 'description' => 'Human readable description of this item, to ease display without lookup of source item.', | |
204 | 'maxlength' => 255, | |
205 | 'size' => CRM_Utils_Type::HUGE, | |
206 | ) , | |
207 | 'amount' => array( | |
208 | 'name' => 'amount', | |
209 | 'type' => CRM_Utils_Type::T_MONEY, | |
210 | 'title' => ts('Amount') , | |
211 | 'description' => 'Total amount of this item', | |
212 | 'required' => true, | |
213 | 'precision' => array( | |
214 | 20, | |
215 | 2 | |
216 | ) , | |
217 | ) , | |
218 | 'currency' => array( | |
219 | 'name' => 'currency', | |
220 | 'type' => CRM_Utils_Type::T_STRING, | |
221 | 'title' => ts('Financial Item Currency') , | |
222 | 'description' => 'Currency for the amount', | |
223 | 'maxlength' => 3, | |
224 | 'size' => CRM_Utils_Type::FOUR, | |
225 | 'export' => true, | |
226 | 'where' => 'civicrm_financial_item.currency', | |
227 | 'headerPattern' => '', | |
228 | 'dataPattern' => '', | |
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 | 'financial_account_id' => array( | |
240 | 'name' => 'financial_account_id', | |
241 | 'type' => CRM_Utils_Type::T_INT, | |
242 | 'title' => ts('Financial Account ID') , | |
243 | 'description' => 'FK to civicrm_financial_account', | |
244 | 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', | |
245 | 'html' => array( | |
246 | 'type' => 'Select', | |
247 | ) , | |
248 | 'pseudoconstant' => array( | |
249 | 'table' => 'civicrm_financial_account', | |
250 | 'keyColumn' => 'id', | |
251 | 'labelColumn' => 'name', | |
252 | ) | |
253 | ) , | |
254 | 'status_id' => array( | |
255 | 'name' => 'status_id', | |
256 | 'type' => CRM_Utils_Type::T_INT, | |
257 | 'title' => ts('Financial Item Status ID') , | |
258 | 'description' => 'Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)', | |
259 | 'export' => true, | |
260 | 'where' => 'civicrm_financial_item.status_id', | |
261 | 'headerPattern' => '', | |
262 | 'dataPattern' => '', | |
263 | 'html' => array( | |
264 | 'type' => 'Select', | |
265 | ) , | |
266 | 'pseudoconstant' => array( | |
267 | 'optionGroupName' => 'financial_item_status', | |
268 | 'optionEditPath' => 'civicrm/admin/options/financial_item_status', | |
269 | ) | |
270 | ) , | |
271 | 'entity_table' => array( | |
272 | 'name' => 'entity_table', | |
273 | 'type' => CRM_Utils_Type::T_STRING, | |
274 | 'title' => ts('Entity Table') , | |
275 | 'description' => 'The table providing the source of this item such as civicrm_line_item', | |
276 | 'maxlength' => 64, | |
277 | 'size' => CRM_Utils_Type::BIG, | |
278 | ) , | |
279 | 'entity_id' => array( | |
280 | 'name' => 'entity_id', | |
281 | 'type' => CRM_Utils_Type::T_INT, | |
282 | 'title' => ts('Entity ID') , | |
283 | 'description' => 'The specific source item that is responsible for the creation of this financial_item', | |
284 | ) , | |
285 | ); | |
286 | } | |
287 | return self::$_fields; | |
288 | } | |
289 | /** | |
290 | * Returns an array containing, for each field, the arary key used for that | |
291 | * field in self::$_fields. | |
292 | * | |
293 | * @return array | |
294 | */ | |
295 | static function &fieldKeys() { | |
296 | if (!(self::$_fieldKeys)) { | |
297 | self::$_fieldKeys = array( | |
298 | 'id' => 'id', | |
299 | 'created_date' => 'created_date', | |
300 | 'transaction_date' => 'transaction_date', | |
301 | 'contact_id' => 'contact_id', | |
302 | 'description' => 'description', | |
303 | 'amount' => 'amount', | |
304 | 'currency' => 'currency', | |
305 | 'financial_account_id' => 'financial_account_id', | |
306 | 'status_id' => 'status_id', | |
307 | 'entity_table' => 'entity_table', | |
308 | 'entity_id' => 'entity_id', | |
309 | ); | |
310 | } | |
311 | return self::$_fieldKeys; | |
312 | } | |
313 | /** | |
314 | * Returns the names of this table | |
315 | * | |
316 | * @return string | |
317 | */ | |
318 | static function getTableName() { | |
319 | return self::$_tableName; | |
320 | } | |
321 | /** | |
322 | * Returns if this table needs to be logged | |
323 | * | |
324 | * @return boolean | |
325 | */ | |
326 | function getLog() { | |
327 | return self::$_log; | |
328 | } | |
329 | /** | |
330 | * Returns the list of fields that can be imported | |
331 | * | |
332 | * @param bool $prefix | |
333 | * | |
334 | * @return array | |
335 | */ | |
336 | static function &import($prefix = false) { | |
60808919 TO |
337 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_item', $prefix, array()); |
338 | return $r; | |
e501603b TO |
339 | } |
340 | /** | |
341 | * Returns the list of fields that can be exported | |
342 | * | |
343 | * @param bool $prefix | |
344 | * | |
345 | * @return array | |
346 | */ | |
347 | static function &export($prefix = false) { | |
60808919 TO |
348 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_item', $prefix, array()); |
349 | return $r; | |
e501603b TO |
350 | } |
351 | } |