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/Grant/Grant.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:38ec42e92df1109ae3a0fe337852fbd5) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Grant_DAO_Grant extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_grant'; | |
44 | /** | |
45 | * static instance to hold the field values | |
46 | * | |
47 | * @var array | |
48 | */ | |
49 | static $_fields = null; | |
e501603b TO |
50 | /** |
51 | * static instance to hold the FK relationships | |
52 | * | |
53 | * @var string | |
54 | */ | |
55 | static $_links = null; | |
e501603b TO |
56 | /** |
57 | * static value to see if we should log any modifications to | |
58 | * this table in the civicrm_log table | |
59 | * | |
60 | * @var boolean | |
61 | */ | |
62 | static $_log = true; | |
63 | /** | |
64 | * Unique Grant id | |
65 | * | |
66 | * @var int unsigned | |
67 | */ | |
68 | public $id; | |
69 | /** | |
70 | * Contact ID of contact record given grant belongs to. | |
71 | * | |
72 | * @var int unsigned | |
73 | */ | |
74 | public $contact_id; | |
75 | /** | |
76 | * Date on which grant application was received by donor. | |
77 | * | |
78 | * @var date | |
79 | */ | |
80 | public $application_received_date; | |
81 | /** | |
82 | * Date on which grant decision was made. | |
83 | * | |
84 | * @var date | |
85 | */ | |
86 | public $decision_date; | |
87 | /** | |
88 | * Date on which grant money transfer was made. | |
89 | * | |
90 | * @var date | |
91 | */ | |
92 | public $money_transfer_date; | |
93 | /** | |
94 | * Date on which grant report is due. | |
95 | * | |
96 | * @var date | |
97 | */ | |
98 | public $grant_due_date; | |
99 | /** | |
100 | * Yes/No field stating whether grant report was received by donor. | |
101 | * | |
102 | * @var boolean | |
103 | */ | |
104 | public $grant_report_received; | |
105 | /** | |
106 | * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group. | |
107 | * | |
108 | * @var int unsigned | |
109 | */ | |
110 | public $grant_type_id; | |
111 | /** | |
112 | * Requested grant amount, in default currency. | |
113 | * | |
114 | * @var float | |
115 | */ | |
116 | public $amount_total; | |
117 | /** | |
118 | * Requested grant amount, in original currency (optional). | |
119 | * | |
120 | * @var float | |
121 | */ | |
122 | public $amount_requested; | |
123 | /** | |
124 | * Granted amount, in default currency. | |
125 | * | |
126 | * @var float | |
127 | */ | |
128 | public $amount_granted; | |
129 | /** | |
130 | * 3 character string, value from config setting or input via user. | |
131 | * | |
132 | * @var string | |
133 | */ | |
134 | public $currency; | |
135 | /** | |
136 | * Grant rationale. | |
137 | * | |
138 | * @var text | |
139 | */ | |
140 | public $rationale; | |
141 | /** | |
142 | * Id of Grant status. | |
143 | * | |
144 | * @var int unsigned | |
145 | */ | |
146 | public $status_id; | |
147 | /** | |
148 | * FK to Financial Type. | |
149 | * | |
150 | * @var int unsigned | |
151 | */ | |
152 | public $financial_type_id; | |
153 | /** | |
154 | * class constructor | |
155 | * | |
156 | * @return civicrm_grant | |
157 | */ | |
158 | function __construct() { | |
159 | $this->__table = 'civicrm_grant'; | |
160 | parent::__construct(); | |
161 | } | |
162 | /** | |
163 | * Returns foreign keys and entity references | |
164 | * | |
165 | * @return array | |
166 | * [CRM_Core_Reference_Interface] | |
167 | */ | |
168 | static function getReferenceColumns() { | |
169 | if (!self::$_links) { | |
170 | self::$_links = static ::createReferenceColumns(__CLASS__); | |
171 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); | |
172 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); | |
173 | } | |
174 | return self::$_links; | |
175 | } | |
176 | /** | |
177 | * Returns all the column names of this table | |
178 | * | |
179 | * @return array | |
180 | */ | |
181 | static function &fields() { | |
182 | if (!(self::$_fields)) { | |
183 | self::$_fields = array( | |
184 | 'grant_id' => array( | |
185 | 'name' => 'id', | |
186 | 'type' => CRM_Utils_Type::T_INT, | |
187 | 'title' => ts('Grant ID') , | |
188 | 'description' => 'Unique Grant id', | |
189 | 'required' => true, | |
190 | 'import' => true, | |
191 | 'where' => 'civicrm_grant.id', | |
192 | 'headerPattern' => '', | |
193 | 'dataPattern' => '', | |
194 | 'export' => true, | |
195 | ) , | |
196 | 'grant_contact_id' => array( | |
197 | 'name' => 'contact_id', | |
198 | 'type' => CRM_Utils_Type::T_INT, | |
199 | 'title' => ts('Contact ID') , | |
200 | 'description' => 'Contact ID of contact record given grant belongs to.', | |
201 | 'required' => true, | |
202 | 'export' => true, | |
203 | 'where' => 'civicrm_grant.contact_id', | |
204 | 'headerPattern' => '', | |
205 | 'dataPattern' => '', | |
206 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
207 | 'html' => array( | |
208 | 'type' => 'EntityRef', | |
209 | ) , | |
210 | ) , | |
211 | 'application_received_date' => array( | |
212 | 'name' => 'application_received_date', | |
213 | 'type' => CRM_Utils_Type::T_DATE, | |
214 | 'title' => ts('Application received date') , | |
215 | 'description' => 'Date on which grant application was received by donor.', | |
216 | 'export' => true, | |
217 | 'where' => 'civicrm_grant.application_received_date', | |
218 | 'headerPattern' => '', | |
219 | 'dataPattern' => '', | |
220 | ) , | |
221 | 'decision_date' => array( | |
222 | 'name' => 'decision_date', | |
223 | 'type' => CRM_Utils_Type::T_DATE, | |
224 | 'title' => ts('Decision date') , | |
225 | 'description' => 'Date on which grant decision was made.', | |
226 | 'import' => true, | |
227 | 'where' => 'civicrm_grant.decision_date', | |
228 | 'headerPattern' => '', | |
229 | 'dataPattern' => '', | |
230 | 'export' => true, | |
231 | 'html' => array( | |
232 | 'type' => 'Select Date', | |
233 | ) , | |
234 | ) , | |
235 | 'grant_money_transfer_date' => array( | |
236 | 'name' => 'money_transfer_date', | |
237 | 'type' => CRM_Utils_Type::T_DATE, | |
238 | 'title' => ts('Grant Money transfer date') , | |
239 | 'description' => 'Date on which grant money transfer was made.', | |
240 | 'import' => true, | |
241 | 'where' => 'civicrm_grant.money_transfer_date', | |
242 | 'headerPattern' => '', | |
243 | 'dataPattern' => '', | |
244 | 'export' => true, | |
245 | 'html' => array( | |
246 | 'type' => 'Select Date', | |
247 | ) , | |
248 | ) , | |
249 | 'grant_due_date' => array( | |
250 | 'name' => 'grant_due_date', | |
251 | 'type' => CRM_Utils_Type::T_DATE, | |
252 | 'title' => ts('Grant Due Date') , | |
253 | 'description' => 'Date on which grant report is due.', | |
254 | 'html' => array( | |
255 | 'type' => 'Select Date', | |
256 | ) , | |
257 | ) , | |
258 | 'grant_report_received' => array( | |
259 | 'name' => 'grant_report_received', | |
260 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
261 | 'title' => ts('Grant report received') , | |
262 | 'description' => 'Yes/No field stating whether grant report was received by donor.', | |
263 | 'import' => true, | |
264 | 'where' => 'civicrm_grant.grant_report_received', | |
265 | 'headerPattern' => '', | |
266 | 'dataPattern' => '', | |
267 | 'export' => true, | |
268 | 'html' => array( | |
269 | 'type' => 'CheckBox', | |
270 | ) , | |
271 | ) , | |
272 | 'grant_type_id' => array( | |
273 | 'name' => 'grant_type_id', | |
274 | 'type' => CRM_Utils_Type::T_INT, | |
275 | 'title' => ts('Grant Type') , | |
276 | 'description' => 'Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.', | |
277 | 'required' => true, | |
278 | 'export' => true, | |
279 | 'where' => 'civicrm_grant.grant_type_id', | |
280 | 'headerPattern' => '', | |
281 | 'dataPattern' => '', | |
282 | 'html' => array( | |
283 | 'type' => 'Select', | |
284 | ) , | |
285 | 'pseudoconstant' => array( | |
286 | 'optionGroupName' => 'grant_type', | |
287 | 'optionEditPath' => 'civicrm/admin/options/grant_type', | |
288 | ) | |
289 | ) , | |
290 | 'amount_total' => array( | |
291 | 'name' => 'amount_total', | |
292 | 'type' => CRM_Utils_Type::T_MONEY, | |
293 | 'title' => ts('Total Amount') , | |
294 | 'description' => 'Requested grant amount, in default currency.', | |
295 | 'required' => true, | |
296 | 'precision' => array( | |
297 | 20, | |
298 | 2 | |
299 | ) , | |
300 | 'import' => true, | |
301 | 'where' => 'civicrm_grant.amount_total', | |
302 | 'headerPattern' => '', | |
303 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
304 | 'export' => true, | |
305 | 'html' => array( | |
306 | 'type' => 'Text', | |
307 | ) , | |
308 | ) , | |
309 | 'amount_requested' => array( | |
310 | 'name' => 'amount_requested', | |
311 | 'type' => CRM_Utils_Type::T_MONEY, | |
312 | 'title' => ts('Amount Requested') , | |
313 | 'description' => 'Requested grant amount, in original currency (optional).', | |
314 | 'precision' => array( | |
315 | 20, | |
316 | 2 | |
317 | ) , | |
318 | 'html' => array( | |
319 | 'type' => 'Text', | |
320 | ) , | |
321 | ) , | |
322 | 'amount_granted' => array( | |
323 | 'name' => 'amount_granted', | |
324 | 'type' => CRM_Utils_Type::T_MONEY, | |
325 | 'title' => ts('Amount granted') , | |
326 | 'description' => 'Granted amount, in default currency.', | |
327 | 'precision' => array( | |
328 | 20, | |
329 | 2 | |
330 | ) , | |
331 | 'import' => true, | |
332 | 'where' => 'civicrm_grant.amount_granted', | |
333 | 'headerPattern' => '', | |
334 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
335 | 'export' => true, | |
336 | 'html' => array( | |
337 | 'type' => 'Text', | |
338 | ) , | |
339 | ) , | |
340 | 'currency' => array( | |
341 | 'name' => 'currency', | |
342 | 'type' => CRM_Utils_Type::T_STRING, | |
343 | 'title' => ts('Grant Currency') , | |
344 | 'description' => '3 character string, value from config setting or input via user.', | |
345 | 'required' => true, | |
346 | 'maxlength' => 3, | |
347 | 'size' => CRM_Utils_Type::FOUR, | |
348 | 'html' => array( | |
349 | 'type' => 'Select', | |
350 | ) , | |
351 | 'pseudoconstant' => array( | |
352 | 'table' => 'civicrm_currency', | |
353 | 'keyColumn' => 'name', | |
354 | 'labelColumn' => 'full_name', | |
355 | 'nameColumn' => 'name', | |
356 | ) | |
357 | ) , | |
358 | 'rationale' => array( | |
359 | 'name' => 'rationale', | |
360 | 'type' => CRM_Utils_Type::T_TEXT, | |
361 | 'title' => ts('Grant Rationale') , | |
362 | 'description' => 'Grant rationale.', | |
363 | 'rows' => 4, | |
364 | 'cols' => 60, | |
365 | 'import' => true, | |
366 | 'where' => 'civicrm_grant.rationale', | |
367 | 'headerPattern' => '', | |
368 | 'dataPattern' => '', | |
369 | 'export' => true, | |
370 | 'html' => array( | |
371 | 'type' => 'TextArea', | |
372 | ) , | |
373 | ) , | |
374 | 'grant_status_id' => array( | |
375 | 'name' => 'status_id', | |
376 | 'type' => CRM_Utils_Type::T_INT, | |
377 | 'title' => ts('Grant Status') , | |
378 | 'description' => 'Id of Grant status.', | |
379 | 'required' => true, | |
380 | 'import' => true, | |
381 | 'where' => 'civicrm_grant.status_id', | |
382 | 'headerPattern' => '', | |
383 | 'dataPattern' => '', | |
384 | 'export' => false, | |
385 | 'html' => array( | |
386 | 'type' => 'Select', | |
387 | ) , | |
388 | 'pseudoconstant' => array( | |
389 | 'optionGroupName' => 'grant_status', | |
390 | 'optionEditPath' => 'civicrm/admin/options/grant_status', | |
391 | ) | |
392 | ) , | |
393 | 'financial_type_id' => array( | |
394 | 'name' => 'financial_type_id', | |
395 | 'type' => CRM_Utils_Type::T_INT, | |
396 | 'title' => ts('Financial Type') , | |
397 | 'description' => 'FK to Financial Type.', | |
398 | 'default' => 'NULL', | |
399 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', | |
400 | 'pseudoconstant' => array( | |
401 | 'table' => 'civicrm_financial_type', | |
402 | 'keyColumn' => 'id', | |
403 | 'labelColumn' => 'name', | |
404 | ) | |
405 | ) , | |
406 | ); | |
407 | } | |
408 | return self::$_fields; | |
409 | } | |
410 | /** | |
bd8e0b14 | 411 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
412 | * |
413 | * @return array | |
bd8e0b14 | 414 | * Array(string $name => string $uniqueName). |
e501603b TO |
415 | */ |
416 | static function &fieldKeys() { | |
bd8e0b14 TO |
417 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
418 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 419 | } |
bd8e0b14 | 420 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
421 | } |
422 | /** | |
423 | * Returns the names of this table | |
424 | * | |
425 | * @return string | |
426 | */ | |
427 | static function getTableName() { | |
428 | return self::$_tableName; | |
429 | } | |
430 | /** | |
431 | * Returns if this table needs to be logged | |
432 | * | |
433 | * @return boolean | |
434 | */ | |
435 | function getLog() { | |
436 | return self::$_log; | |
437 | } | |
438 | /** | |
439 | * Returns the list of fields that can be imported | |
440 | * | |
441 | * @param bool $prefix | |
442 | * | |
443 | * @return array | |
444 | */ | |
445 | static function &import($prefix = false) { | |
60808919 TO |
446 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, array()); |
447 | return $r; | |
e501603b TO |
448 | } |
449 | /** | |
450 | * Returns the list of fields that can be exported | |
451 | * | |
452 | * @param bool $prefix | |
453 | * | |
454 | * @return array | |
455 | */ | |
456 | static function &export($prefix = false) { | |
60808919 TO |
457 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, array()); |
458 | return $r; | |
e501603b TO |
459 | } |
460 | } |