Translate description in DAO files
[civicrm-core.git] / CRM / Grant / DAO / Grant.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Grant/Grant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
ae7f34ec 9 * (GenCodeChecksum:13652dd0ca88b2b29b17df240790eece)
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 */
22 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 */
c3fc2621
CW
29 static $_log = TRUE;
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
TO
151 if (!isset(Civi::$statics[__CLASS__]['links'])) {
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
TO
175 'where' => 'civicrm_grant.id',
176 'headerPattern' => '',
177 'dataPattern' => '',
c3fc2621 178 'export' => TRUE,
522a26c9 179 'table_name' => 'civicrm_grant',
180 'entity' => 'Grant',
181 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 182 'localizable' => 0,
c3fc2621
CW
183 ],
184 'grant_contact_id' => [
e501603b
TO
185 'name' => 'contact_id',
186 'type' => CRM_Utils_Type::T_INT,
c3fc2621 187 'title' => ts('Contact ID'),
215b423e 188 'description' => ts('Contact ID of contact record given grant belongs to.'),
c3fc2621
CW
189 'required' => TRUE,
190 'export' => TRUE,
e501603b
TO
191 'where' => 'civicrm_grant.contact_id',
192 'headerPattern' => '',
193 'dataPattern' => '',
522a26c9 194 'table_name' => 'civicrm_grant',
195 'entity' => 'Grant',
196 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 197 'localizable' => 0,
e501603b 198 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 199 'html' => [
e501603b 200 'type' => 'EntityRef',
c3fc2621
CW
201 ],
202 ],
203 'application_received_date' => [
e501603b
TO
204 'name' => 'application_received_date',
205 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 206 'title' => ts('Application received date'),
215b423e 207 'description' => ts('Date on which grant application was received by donor.'),
ae7f34ec 208 'import' => TRUE,
e501603b
TO
209 'where' => 'civicrm_grant.application_received_date',
210 'headerPattern' => '',
211 'dataPattern' => '',
ae7f34ec 212 'export' => TRUE,
522a26c9 213 'table_name' => 'civicrm_grant',
214 'entity' => 'Grant',
215 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 216 'localizable' => 0,
ae7f34ec
PN
217 'html' => [
218 'type' => 'Select Date',
219 'formatType' => 'activityDate',
220 ],
c3fc2621
CW
221 ],
222 'decision_date' => [
e501603b
TO
223 'name' => 'decision_date',
224 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 225 'title' => ts('Decision date'),
215b423e 226 'description' => ts('Date on which grant decision was made.'),
c3fc2621 227 'import' => TRUE,
e501603b
TO
228 'where' => 'civicrm_grant.decision_date',
229 'headerPattern' => '',
230 'dataPattern' => '',
c3fc2621 231 'export' => TRUE,
522a26c9 232 'table_name' => 'civicrm_grant',
233 'entity' => 'Grant',
234 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 235 'localizable' => 0,
c3fc2621 236 'html' => [
e501603b 237 'type' => 'Select Date',
ae7f34ec 238 'formatType' => 'activityDate',
c3fc2621
CW
239 ],
240 ],
241 'grant_money_transfer_date' => [
e501603b
TO
242 'name' => 'money_transfer_date',
243 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 244 'title' => ts('Grant Money transfer date'),
215b423e 245 'description' => ts('Date on which grant money transfer was made.'),
c3fc2621 246 'import' => TRUE,
e501603b
TO
247 'where' => 'civicrm_grant.money_transfer_date',
248 'headerPattern' => '',
249 'dataPattern' => '',
c3fc2621 250 'export' => TRUE,
522a26c9 251 'table_name' => 'civicrm_grant',
252 'entity' => 'Grant',
253 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 254 'localizable' => 0,
c3fc2621 255 'html' => [
e501603b 256 'type' => 'Select Date',
ae7f34ec 257 'formatType' => 'activityDate',
c3fc2621
CW
258 ],
259 ],
260 'grant_due_date' => [
e501603b
TO
261 'name' => 'grant_due_date',
262 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 263 'title' => ts('Grant Due Date'),
215b423e 264 'description' => ts('Date on which grant report is due.'),
ae7f34ec
PN
265 'import' => TRUE,
266 'where' => 'civicrm_grant.grant_due_date',
267 'headerPattern' => '',
268 'dataPattern' => '',
269 'export' => TRUE,
522a26c9 270 'table_name' => 'civicrm_grant',
271 'entity' => 'Grant',
272 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 273 'localizable' => 0,
c3fc2621 274 'html' => [
e501603b 275 'type' => 'Select Date',
ae7f34ec 276 'formatType' => 'activityDate',
c3fc2621
CW
277 ],
278 ],
279 'grant_report_received' => [
e501603b
TO
280 'name' => 'grant_report_received',
281 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 282 'title' => ts('Grant report received'),
215b423e 283 'description' => ts('Yes/No field stating whether grant report was received by donor.'),
c3fc2621 284 'import' => TRUE,
e501603b
TO
285 'where' => 'civicrm_grant.grant_report_received',
286 'headerPattern' => '',
287 'dataPattern' => '',
c3fc2621 288 'export' => TRUE,
522a26c9 289 'table_name' => 'civicrm_grant',
290 'entity' => 'Grant',
291 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 292 'localizable' => 0,
c3fc2621 293 'html' => [
e501603b 294 'type' => 'CheckBox',
c3fc2621
CW
295 ],
296 ],
297 'grant_type_id' => [
e501603b
TO
298 'name' => 'grant_type_id',
299 'type' => CRM_Utils_Type::T_INT,
c3fc2621 300 'title' => ts('Grant Type'),
215b423e 301 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'),
c3fc2621
CW
302 'required' => TRUE,
303 'export' => TRUE,
e501603b
TO
304 'where' => 'civicrm_grant.grant_type_id',
305 'headerPattern' => '',
306 'dataPattern' => '',
522a26c9 307 'table_name' => 'civicrm_grant',
308 'entity' => 'Grant',
309 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 310 'localizable' => 0,
c3fc2621 311 'html' => [
e501603b 312 'type' => 'Select',
c3fc2621
CW
313 ],
314 'pseudoconstant' => [
e501603b
TO
315 'optionGroupName' => 'grant_type',
316 'optionEditPath' => 'civicrm/admin/options/grant_type',
c3fc2621
CW
317 ]
318 ],
319 'amount_total' => [
e501603b
TO
320 'name' => 'amount_total',
321 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 322 'title' => ts('Total Amount'),
215b423e 323 'description' => ts('Requested grant amount, in default currency.'),
c3fc2621
CW
324 'required' => TRUE,
325 'precision' => [
e501603b
TO
326 20,
327 2
c3fc2621
CW
328 ],
329 'import' => TRUE,
e501603b
TO
330 'where' => 'civicrm_grant.amount_total',
331 'headerPattern' => '',
332 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 333 'export' => TRUE,
522a26c9 334 'table_name' => 'civicrm_grant',
335 'entity' => 'Grant',
336 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 337 'localizable' => 0,
c3fc2621 338 'html' => [
e501603b 339 'type' => 'Text',
c3fc2621
CW
340 ],
341 ],
342 'amount_requested' => [
e501603b
TO
343 'name' => 'amount_requested',
344 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 345 'title' => ts('Amount Requested'),
215b423e 346 'description' => ts('Requested grant amount, in original currency (optional).'),
c3fc2621 347 'precision' => [
e501603b
TO
348 20,
349 2
c3fc2621 350 ],
522a26c9 351 'table_name' => 'civicrm_grant',
352 'entity' => 'Grant',
353 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 354 'localizable' => 0,
c3fc2621 355 'html' => [
e501603b 356 'type' => 'Text',
c3fc2621
CW
357 ],
358 ],
359 'amount_granted' => [
e501603b
TO
360 'name' => 'amount_granted',
361 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 362 'title' => ts('Amount granted'),
215b423e 363 'description' => ts('Granted amount, in default currency.'),
c3fc2621 364 'precision' => [
e501603b
TO
365 20,
366 2
c3fc2621
CW
367 ],
368 'import' => TRUE,
e501603b
TO
369 'where' => 'civicrm_grant.amount_granted',
370 'headerPattern' => '',
371 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 372 'export' => TRUE,
522a26c9 373 'table_name' => 'civicrm_grant',
374 'entity' => 'Grant',
375 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 376 'localizable' => 0,
c3fc2621 377 'html' => [
e501603b 378 'type' => 'Text',
c3fc2621
CW
379 ],
380 ],
381 'currency' => [
e501603b
TO
382 'name' => 'currency',
383 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 384 'title' => ts('Grant Currency'),
215b423e 385 'description' => ts('3 character string, value from config setting or input via user.'),
c3fc2621 386 'required' => TRUE,
e501603b
TO
387 'maxlength' => 3,
388 'size' => CRM_Utils_Type::FOUR,
522a26c9 389 'table_name' => 'civicrm_grant',
390 'entity' => 'Grant',
391 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 392 'localizable' => 0,
c3fc2621 393 'html' => [
e501603b 394 'type' => 'Select',
c3fc2621
CW
395 ],
396 'pseudoconstant' => [
e501603b
TO
397 'table' => 'civicrm_currency',
398 'keyColumn' => 'name',
399 'labelColumn' => 'full_name',
400 'nameColumn' => 'name',
c3fc2621
CW
401 ]
402 ],
403 'rationale' => [
e501603b
TO
404 'name' => 'rationale',
405 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 406 'title' => ts('Grant Rationale'),
215b423e 407 'description' => ts('Grant rationale.'),
e501603b
TO
408 'rows' => 4,
409 'cols' => 60,
c3fc2621 410 'import' => TRUE,
e501603b
TO
411 'where' => 'civicrm_grant.rationale',
412 'headerPattern' => '',
413 'dataPattern' => '',
c3fc2621 414 'export' => TRUE,
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' => 'TextArea',
c3fc2621
CW
421 ],
422 ],
423 'grant_status_id' => [
e501603b
TO
424 'name' => 'status_id',
425 'type' => CRM_Utils_Type::T_INT,
c3fc2621 426 'title' => ts('Grant Status'),
215b423e 427 'description' => ts('Id of Grant status.'),
c3fc2621
CW
428 'required' => TRUE,
429 'import' => TRUE,
e501603b
TO
430 'where' => 'civicrm_grant.status_id',
431 'headerPattern' => '',
432 'dataPattern' => '',
c3fc2621 433 'export' => FALSE,
522a26c9 434 'table_name' => 'civicrm_grant',
435 'entity' => 'Grant',
436 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 437 'localizable' => 0,
c3fc2621 438 'html' => [
e501603b 439 'type' => 'Select',
c3fc2621
CW
440 ],
441 'pseudoconstant' => [
e501603b
TO
442 'optionGroupName' => 'grant_status',
443 'optionEditPath' => 'civicrm/admin/options/grant_status',
c3fc2621
CW
444 ]
445 ],
446 'financial_type_id' => [
e501603b
TO
447 'name' => 'financial_type_id',
448 'type' => CRM_Utils_Type::T_INT,
c3fc2621 449 'title' => ts('Financial Type'),
215b423e 450 'description' => ts('FK to Financial Type.'),
e501603b 451 'default' => 'NULL',
522a26c9 452 'table_name' => 'civicrm_grant',
453 'entity' => 'Grant',
454 'bao' => 'CRM_Grant_BAO_Grant',
6a7e5e5d 455 'localizable' => 0,
e501603b 456 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 457 'pseudoconstant' => [
e501603b
TO
458 'table' => 'civicrm_financial_type',
459 'keyColumn' => 'id',
460 'labelColumn' => 'name',
c3fc2621
CW
461 ]
462 ],
463 ];
346aaaba 464 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 465 }
346aaaba 466 return Civi::$statics[__CLASS__]['fields'];
e501603b 467 }
c3fc2621 468
e501603b 469 /**
bd8e0b14 470 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
471 *
472 * @return array
bd8e0b14 473 * Array(string $name => string $uniqueName).
e501603b 474 */
c3fc2621 475 public static function &fieldKeys() {
bd8e0b14
TO
476 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
477 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 478 }
bd8e0b14 479 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 480 }
c3fc2621 481
e501603b
TO
482 /**
483 * Returns the names of this table
484 *
485 * @return string
486 */
c3fc2621 487 public static function getTableName() {
e501603b
TO
488 return self::$_tableName;
489 }
c3fc2621 490
e501603b
TO
491 /**
492 * Returns if this table needs to be logged
493 *
c3fc2621 494 * @return bool
e501603b 495 */
c3fc2621 496 public function getLog() {
e501603b
TO
497 return self::$_log;
498 }
c3fc2621 499
e501603b
TO
500 /**
501 * Returns the list of fields that can be imported
502 *
503 * @param bool $prefix
504 *
505 * @return array
506 */
c3fc2621
CW
507 public static function &import($prefix = FALSE) {
508 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, []);
60808919 509 return $r;
e501603b 510 }
c3fc2621 511
e501603b
TO
512 /**
513 * Returns the list of fields that can be exported
514 *
515 * @param bool $prefix
516 *
517 * @return array
518 */
c3fc2621
CW
519 public static function &export($prefix = FALSE) {
520 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, []);
60808919 521 return $r;
e501603b 522 }
c3fc2621 523
e7a6b91a
AS
524 /**
525 * Returns the list of indices
c3fc2621
CW
526 *
527 * @param bool $localize
528 *
529 * @return array
e7a6b91a
AS
530 */
531 public static function indices($localize = TRUE) {
c3fc2621
CW
532 $indices = [
533 'index_grant_type_id' => [
e7a6b91a 534 'name' => 'index_grant_type_id',
c3fc2621 535 'field' => [
e7a6b91a 536 0 => 'grant_type_id',
c3fc2621
CW
537 ],
538 'localizable' => FALSE,
e7a6b91a 539 'sig' => 'civicrm_grant::0::grant_type_id',
c3fc2621
CW
540 ],
541 'index_status_id' => [
e7a6b91a 542 'name' => 'index_status_id',
c3fc2621 543 'field' => [
e7a6b91a 544 0 => 'status_id',
c3fc2621
CW
545 ],
546 'localizable' => FALSE,
e7a6b91a 547 'sig' => 'civicrm_grant::0::status_id',
c3fc2621
CW
548 ],
549 ];
e7a6b91a
AS
550 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
551 }
c3fc2621 552
e501603b 553}