5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Grant/Grant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b09a04b8edb982e838510dfb9d7dbc35)
13 * Database access object for the Grant entity.
15 class CRM_Grant_DAO_Grant
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_grant';
25 * Icon associated with this entity.
29 public static $_icon = 'fa-money';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = TRUE;
46 * Contact ID of contact record given grant belongs to.
53 * Date on which grant application was received by donor.
57 public $application_received_date;
60 * Date on which grant decision was made.
64 public $decision_date;
67 * Date on which grant money transfer was made.
71 public $money_transfer_date;
74 * Date on which grant report is due.
78 public $grant_due_date;
81 * Yes/No field stating whether grant report was received by donor.
85 public $grant_report_received;
88 * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.
92 public $grant_type_id;
95 * Requested grant amount, in default currency.
102 * Requested grant amount, in original currency (optional).
106 public $amount_requested;
109 * Granted amount, in default currency.
113 public $amount_granted;
116 * 3 character string, value from config setting or input via user.
130 * Id of Grant status.
137 * FK to Financial Type.
141 public $financial_type_id;
146 public function __construct() {
147 $this->__table
= 'civicrm_grant';
148 parent
::__construct();
152 * Returns localized title of this entity.
154 public static function getEntityTitle() {
159 * Returns foreign keys and entity references.
162 * [CRM_Core_Reference_Interface]
164 public static function getReferenceColumns() {
165 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
166 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
167 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
168 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
169 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
171 return Civi
::$statics[__CLASS__
]['links'];
175 * Returns all the column names of this table
179 public static function &fields() {
180 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
181 Civi
::$statics[__CLASS__
]['fields'] = [
184 'type' => CRM_Utils_Type
::T_INT
,
185 'title' => ts('Grant ID'),
186 'description' => ts('Unique Grant id'),
189 'where' => 'civicrm_grant.id',
191 'table_name' => 'civicrm_grant',
193 'bao' => 'CRM_Grant_BAO_Grant',
197 'grant_contact_id' => [
198 'name' => 'contact_id',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Contact ID'),
201 'description' => ts('Contact ID of contact record given grant belongs to.'),
203 'where' => 'civicrm_grant.contact_id',
205 'table_name' => 'civicrm_grant',
207 'bao' => 'CRM_Grant_BAO_Grant',
209 'FKClassName' => 'CRM_Contact_DAO_Contact',
211 'type' => 'EntityRef',
215 'grant_application_received_date' => [
216 'name' => 'application_received_date',
217 'type' => CRM_Utils_Type
::T_DATE
,
218 'title' => ts('Application received date'),
219 'description' => ts('Date on which grant application was received by donor.'),
221 'where' => 'civicrm_grant.application_received_date',
223 'table_name' => 'civicrm_grant',
225 'bao' => 'CRM_Grant_BAO_Grant',
228 'type' => 'Select Date',
229 'formatType' => 'activityDate',
233 'grant_decision_date' => [
234 'name' => 'decision_date',
235 'type' => CRM_Utils_Type
::T_DATE
,
236 'title' => ts('Decision date'),
237 'description' => ts('Date on which grant decision was made.'),
239 'where' => 'civicrm_grant.decision_date',
241 'table_name' => 'civicrm_grant',
243 'bao' => 'CRM_Grant_BAO_Grant',
246 'type' => 'Select Date',
247 'formatType' => 'activityDate',
251 'grant_money_transfer_date' => [
252 'name' => 'money_transfer_date',
253 'type' => CRM_Utils_Type
::T_DATE
,
254 'title' => ts('Grant Money transfer date'),
255 'description' => ts('Date on which grant money transfer was made.'),
257 'where' => 'civicrm_grant.money_transfer_date',
259 'table_name' => 'civicrm_grant',
261 'bao' => 'CRM_Grant_BAO_Grant',
264 'type' => 'Select Date',
265 'formatType' => 'activityDate',
269 'grant_due_date' => [
270 'name' => 'grant_due_date',
271 'type' => CRM_Utils_Type
::T_DATE
,
272 'title' => ts('Grant Report Due Date'),
273 'description' => ts('Date on which grant report is due.'),
275 'where' => 'civicrm_grant.grant_due_date',
277 'table_name' => 'civicrm_grant',
279 'bao' => 'CRM_Grant_BAO_Grant',
282 'type' => 'Select Date',
283 'formatType' => 'activityDate',
287 'grant_report_received' => [
288 'name' => 'grant_report_received',
289 'type' => CRM_Utils_Type
::T_BOOLEAN
,
290 'title' => ts('Grant report received'),
291 'description' => ts('Yes/No field stating whether grant report was received by donor.'),
293 'where' => 'civicrm_grant.grant_report_received',
295 'table_name' => 'civicrm_grant',
297 'bao' => 'CRM_Grant_BAO_Grant',
300 'type' => 'CheckBox',
305 'name' => 'grant_type_id',
306 'type' => CRM_Utils_Type
::T_INT
,
307 'title' => ts('Grant Type'),
308 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'),
310 'where' => 'civicrm_grant.grant_type_id',
312 'table_name' => 'civicrm_grant',
314 'bao' => 'CRM_Grant_BAO_Grant',
319 'pseudoconstant' => [
320 'optionGroupName' => 'grant_type',
321 'optionEditPath' => 'civicrm/admin/options/grant_type',
326 'name' => 'amount_total',
327 'type' => CRM_Utils_Type
::T_MONEY
,
328 'title' => ts('Total Amount'),
329 'description' => ts('Requested grant amount, in default currency.'),
336 'where' => 'civicrm_grant.amount_total',
337 'dataPattern' => '/^\d+(\.\d{2})?$/',
339 'table_name' => 'civicrm_grant',
341 'bao' => 'CRM_Grant_BAO_Grant',
348 'amount_requested' => [
349 'name' => 'amount_requested',
350 'type' => CRM_Utils_Type
::T_MONEY
,
351 'title' => ts('Amount Requested'),
352 'description' => ts('Requested grant amount, in original currency (optional).'),
357 'where' => 'civicrm_grant.amount_requested',
358 'dataPattern' => '/^\d+(\.\d{2})?$/',
359 'table_name' => 'civicrm_grant',
361 'bao' => 'CRM_Grant_BAO_Grant',
368 'amount_granted' => [
369 'name' => 'amount_granted',
370 'type' => CRM_Utils_Type
::T_MONEY
,
371 'title' => ts('Amount granted'),
372 'description' => ts('Granted amount, in default currency.'),
378 'where' => 'civicrm_grant.amount_granted',
379 'dataPattern' => '/^\d+(\.\d{2})?$/',
381 'table_name' => 'civicrm_grant',
383 'bao' => 'CRM_Grant_BAO_Grant',
391 'name' => 'currency',
392 'type' => CRM_Utils_Type
::T_STRING
,
393 'title' => ts('Grant Currency'),
394 'description' => ts('3 character string, value from config setting or input via user.'),
397 'size' => CRM_Utils_Type
::FOUR
,
398 'where' => 'civicrm_grant.currency',
399 'table_name' => 'civicrm_grant',
401 'bao' => 'CRM_Grant_BAO_Grant',
406 'pseudoconstant' => [
407 'table' => 'civicrm_currency',
408 'keyColumn' => 'name',
409 'labelColumn' => 'full_name',
410 'nameColumn' => 'name',
411 'abbrColumn' => 'symbol',
416 'name' => 'rationale',
417 'type' => CRM_Utils_Type
::T_TEXT
,
418 'title' => ts('Grant Rationale'),
419 'description' => ts('Grant rationale.'),
423 'where' => 'civicrm_grant.rationale',
425 'table_name' => 'civicrm_grant',
427 'bao' => 'CRM_Grant_BAO_Grant',
430 'type' => 'TextArea',
434 'grant_status_id' => [
435 'name' => 'status_id',
436 'type' => CRM_Utils_Type
::T_INT
,
437 'title' => ts('Grant Status'),
438 'description' => ts('Id of Grant status.'),
441 'where' => 'civicrm_grant.status_id',
443 'table_name' => 'civicrm_grant',
445 'bao' => 'CRM_Grant_BAO_Grant',
450 'pseudoconstant' => [
451 'optionGroupName' => 'grant_status',
452 'optionEditPath' => 'civicrm/admin/options/grant_status',
456 'financial_type_id' => [
457 'name' => 'financial_type_id',
458 'type' => CRM_Utils_Type
::T_INT
,
459 'title' => ts('Financial Type'),
460 'description' => ts('FK to Financial Type.'),
461 'where' => 'civicrm_grant.financial_type_id',
463 'table_name' => 'civicrm_grant',
465 'bao' => 'CRM_Grant_BAO_Grant',
467 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
468 'pseudoconstant' => [
469 'table' => 'civicrm_financial_type',
471 'labelColumn' => 'name',
476 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
478 return Civi
::$statics[__CLASS__
]['fields'];
482 * Return a mapping from field-name to the corresponding key (as used in fields()).
485 * Array(string $name => string $uniqueName).
487 public static function &fieldKeys() {
488 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
489 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
491 return Civi
::$statics[__CLASS__
]['fieldKeys'];
495 * Returns the names of this table
499 public static function getTableName() {
500 return self
::$_tableName;
504 * Returns if this table needs to be logged
508 public function getLog() {
513 * Returns the list of fields that can be imported
515 * @param bool $prefix
519 public static function &import($prefix = FALSE) {
520 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, []);
525 * Returns the list of fields that can be exported
527 * @param bool $prefix
531 public static function &export($prefix = FALSE) {
532 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, []);
537 * Returns the list of indices
539 * @param bool $localize
543 public static function indices($localize = TRUE) {
545 'index_grant_type_id' => [
546 'name' => 'index_grant_type_id',
548 0 => 'grant_type_id',
550 'localizable' => FALSE,
551 'sig' => 'civicrm_grant::0::grant_type_id',
553 'index_status_id' => [
554 'name' => 'index_status_id',
558 'localizable' => FALSE,
559 'sig' => 'civicrm_grant::0::status_id',
562 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;