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