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