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:a2e43b7f0fb8547daf5ed874bf6174c5)
13 * Database access object for the Grant entity.
15 class CRM_Grant_DAO_Grant
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.8';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_grant';
27 * Icon associated with this entity.
31 public static $_icon = 'fa-money';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = TRUE;
48 * Contact ID of contact record given grant belongs to.
55 * Date on which grant application was received by donor.
59 public $application_received_date;
62 * Date on which grant decision was made.
66 public $decision_date;
69 * Date on which grant money transfer was made.
73 public $money_transfer_date;
76 * Date on which grant report is due.
80 public $grant_due_date;
83 * Yes/No field stating whether grant report was received by donor.
87 public $grant_report_received;
90 * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.
94 public $grant_type_id;
97 * Requested grant amount, in default currency.
101 public $amount_total;
104 * Requested grant amount, in original currency (optional).
108 public $amount_requested;
111 * Granted amount, in default currency.
115 public $amount_granted;
118 * 3 character string, value from config setting or input via user.
132 * Id of Grant status.
139 * FK to Financial Type.
143 public $financial_type_id;
148 public function __construct() {
149 $this->__table
= 'civicrm_grant';
150 parent
::__construct();
154 * Returns localized title of this entity.
156 public static function getEntityTitle() {
161 * Returns foreign keys and entity references.
164 * [CRM_Core_Reference_Interface]
166 public static function getReferenceColumns() {
167 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
168 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
169 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
170 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
171 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
173 return Civi
::$statics[__CLASS__
]['links'];
177 * Returns all the column names of this table
181 public static function &fields() {
182 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
183 Civi
::$statics[__CLASS__
]['fields'] = [
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Grant ID'),
188 'description' => ts('Unique Grant id'),
191 'where' => 'civicrm_grant.id',
193 'table_name' => 'civicrm_grant',
195 'bao' => 'CRM_Grant_BAO_Grant',
199 'grant_contact_id' => [
200 'name' => 'contact_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Contact ID'),
203 'description' => ts('Contact ID of contact record given grant belongs to.'),
205 'where' => 'civicrm_grant.contact_id',
207 'table_name' => 'civicrm_grant',
209 'bao' => 'CRM_Grant_BAO_Grant',
211 'FKClassName' => 'CRM_Contact_DAO_Contact',
213 'type' => 'EntityRef',
217 'grant_application_received_date' => [
218 'name' => 'application_received_date',
219 'type' => CRM_Utils_Type
::T_DATE
,
220 'title' => ts('Application received date'),
221 'description' => ts('Date on which grant application was received by donor.'),
223 'where' => 'civicrm_grant.application_received_date',
225 'table_name' => 'civicrm_grant',
227 'bao' => 'CRM_Grant_BAO_Grant',
230 'type' => 'Select Date',
231 'formatType' => 'activityDate',
235 'grant_decision_date' => [
236 'name' => 'decision_date',
237 'type' => CRM_Utils_Type
::T_DATE
,
238 'title' => ts('Decision date'),
239 'description' => ts('Date on which grant decision was made.'),
241 'where' => 'civicrm_grant.decision_date',
243 'table_name' => 'civicrm_grant',
245 'bao' => 'CRM_Grant_BAO_Grant',
248 'type' => 'Select Date',
249 'formatType' => 'activityDate',
253 'grant_money_transfer_date' => [
254 'name' => 'money_transfer_date',
255 'type' => CRM_Utils_Type
::T_DATE
,
256 'title' => ts('Grant Money transfer date'),
257 'description' => ts('Date on which grant money transfer was made.'),
259 'where' => 'civicrm_grant.money_transfer_date',
261 'table_name' => 'civicrm_grant',
263 'bao' => 'CRM_Grant_BAO_Grant',
266 'type' => 'Select Date',
267 'formatType' => 'activityDate',
271 'grant_due_date' => [
272 'name' => 'grant_due_date',
273 'type' => CRM_Utils_Type
::T_DATE
,
274 'title' => ts('Grant Report Due Date'),
275 'description' => ts('Date on which grant report is due.'),
277 'where' => 'civicrm_grant.grant_due_date',
279 'table_name' => 'civicrm_grant',
281 'bao' => 'CRM_Grant_BAO_Grant',
284 'type' => 'Select Date',
285 'formatType' => 'activityDate',
289 'grant_report_received' => [
290 'name' => 'grant_report_received',
291 'type' => CRM_Utils_Type
::T_BOOLEAN
,
292 'title' => ts('Grant report received'),
293 'description' => ts('Yes/No field stating whether grant report was received by donor.'),
295 'where' => 'civicrm_grant.grant_report_received',
297 'table_name' => 'civicrm_grant',
299 'bao' => 'CRM_Grant_BAO_Grant',
302 'type' => 'CheckBox',
307 'name' => 'grant_type_id',
308 'type' => CRM_Utils_Type
::T_INT
,
309 'title' => ts('Grant Type'),
310 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'),
312 'where' => 'civicrm_grant.grant_type_id',
314 'table_name' => 'civicrm_grant',
316 'bao' => 'CRM_Grant_BAO_Grant',
321 'pseudoconstant' => [
322 'optionGroupName' => 'grant_type',
323 'optionEditPath' => 'civicrm/admin/options/grant_type',
328 'name' => 'amount_total',
329 'type' => CRM_Utils_Type
::T_MONEY
,
330 'title' => ts('Total Amount'),
331 'description' => ts('Requested grant amount, in default currency.'),
338 'where' => 'civicrm_grant.amount_total',
339 'dataPattern' => '/^\d+(\.\d{2})?$/',
341 'table_name' => 'civicrm_grant',
343 'bao' => 'CRM_Grant_BAO_Grant',
350 'amount_requested' => [
351 'name' => 'amount_requested',
352 'type' => CRM_Utils_Type
::T_MONEY
,
353 'title' => ts('Amount Requested'),
354 'description' => ts('Requested grant amount, in original currency (optional).'),
359 'where' => 'civicrm_grant.amount_requested',
360 'dataPattern' => '/^\d+(\.\d{2})?$/',
361 'table_name' => 'civicrm_grant',
363 'bao' => 'CRM_Grant_BAO_Grant',
370 'amount_granted' => [
371 'name' => 'amount_granted',
372 'type' => CRM_Utils_Type
::T_MONEY
,
373 'title' => ts('Amount granted'),
374 'description' => ts('Granted amount, in default currency.'),
380 'where' => 'civicrm_grant.amount_granted',
381 'dataPattern' => '/^\d+(\.\d{2})?$/',
383 'table_name' => 'civicrm_grant',
385 'bao' => 'CRM_Grant_BAO_Grant',
393 'name' => 'currency',
394 'type' => CRM_Utils_Type
::T_STRING
,
395 'title' => ts('Grant Currency'),
396 'description' => ts('3 character string, value from config setting or input via user.'),
399 'size' => CRM_Utils_Type
::FOUR
,
400 'where' => 'civicrm_grant.currency',
401 'table_name' => 'civicrm_grant',
403 'bao' => 'CRM_Grant_BAO_Grant',
408 'pseudoconstant' => [
409 'table' => 'civicrm_currency',
410 'keyColumn' => 'name',
411 'labelColumn' => 'full_name',
412 'nameColumn' => 'name',
413 'abbrColumn' => 'symbol',
418 'name' => 'rationale',
419 'type' => CRM_Utils_Type
::T_TEXT
,
420 'title' => ts('Grant Rationale'),
421 'description' => ts('Grant rationale.'),
425 'where' => 'civicrm_grant.rationale',
427 'table_name' => 'civicrm_grant',
429 'bao' => 'CRM_Grant_BAO_Grant',
432 'type' => 'TextArea',
436 'grant_status_id' => [
437 'name' => 'status_id',
438 'type' => CRM_Utils_Type
::T_INT
,
439 'title' => ts('Grant Status'),
440 'description' => ts('Id of Grant status.'),
443 'where' => 'civicrm_grant.status_id',
445 'table_name' => 'civicrm_grant',
447 'bao' => 'CRM_Grant_BAO_Grant',
452 'pseudoconstant' => [
453 'optionGroupName' => 'grant_status',
454 'optionEditPath' => 'civicrm/admin/options/grant_status',
458 'financial_type_id' => [
459 'name' => 'financial_type_id',
460 'type' => CRM_Utils_Type
::T_INT
,
461 'title' => ts('Financial Type'),
462 'description' => ts('FK to Financial Type.'),
463 'where' => 'civicrm_grant.financial_type_id',
465 'table_name' => 'civicrm_grant',
467 'bao' => 'CRM_Grant_BAO_Grant',
469 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
470 'pseudoconstant' => [
471 'table' => 'civicrm_financial_type',
473 'labelColumn' => 'name',
478 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
480 return Civi
::$statics[__CLASS__
]['fields'];
484 * Return a mapping from field-name to the corresponding key (as used in fields()).
487 * Array(string $name => string $uniqueName).
489 public static function &fieldKeys() {
490 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
491 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
493 return Civi
::$statics[__CLASS__
]['fieldKeys'];
497 * Returns the names of this table
501 public static function getTableName() {
502 return self
::$_tableName;
506 * Returns if this table needs to be logged
510 public function getLog() {
515 * Returns the list of fields that can be imported
517 * @param bool $prefix
521 public static function &import($prefix = FALSE) {
522 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, []);
527 * Returns the list of fields that can be exported
529 * @param bool $prefix
533 public static function &export($prefix = FALSE) {
534 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, []);
539 * Returns the list of indices
541 * @param bool $localize
545 public static function indices($localize = TRUE) {
547 'index_grant_type_id' => [
548 'name' => 'index_grant_type_id',
550 0 => 'grant_type_id',
552 'localizable' => FALSE,
553 'sig' => 'civicrm_grant::0::grant_type_id',
555 'index_status_id' => [
556 'name' => 'index_status_id',
560 'localizable' => FALSE,
561 'sig' => 'civicrm_grant::0::status_id',
564 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;