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:7c259bc89c2ee91302a9bd188f6cc3db)
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',
196 'grant_contact_id' => [
197 'name' => 'contact_id',
198 'type' => CRM_Utils_Type
::T_INT
,
199 'title' => ts('Contact ID'),
200 'description' => ts('Contact ID of contact record given grant belongs to.'),
202 'where' => 'civicrm_grant.contact_id',
204 'table_name' => 'civicrm_grant',
206 'bao' => 'CRM_Grant_BAO_Grant',
208 'FKClassName' => 'CRM_Contact_DAO_Contact',
210 'type' => 'EntityRef',
213 'grant_application_received_date' => [
214 'name' => 'application_received_date',
215 'type' => CRM_Utils_Type
::T_DATE
,
216 'title' => ts('Application received date'),
217 'description' => ts('Date on which grant application was received by donor.'),
219 'where' => 'civicrm_grant.application_received_date',
221 'table_name' => 'civicrm_grant',
223 'bao' => 'CRM_Grant_BAO_Grant',
226 'type' => 'Select Date',
227 'formatType' => 'activityDate',
230 'grant_decision_date' => [
231 'name' => 'decision_date',
232 'type' => CRM_Utils_Type
::T_DATE
,
233 'title' => ts('Decision date'),
234 'description' => ts('Date on which grant decision was made.'),
236 'where' => 'civicrm_grant.decision_date',
238 'table_name' => 'civicrm_grant',
240 'bao' => 'CRM_Grant_BAO_Grant',
243 'type' => 'Select Date',
244 'formatType' => 'activityDate',
247 'grant_money_transfer_date' => [
248 'name' => 'money_transfer_date',
249 'type' => CRM_Utils_Type
::T_DATE
,
250 'title' => ts('Grant Money transfer date'),
251 'description' => ts('Date on which grant money transfer was made.'),
253 'where' => 'civicrm_grant.money_transfer_date',
255 'table_name' => 'civicrm_grant',
257 'bao' => 'CRM_Grant_BAO_Grant',
260 'type' => 'Select Date',
261 'formatType' => 'activityDate',
264 'grant_due_date' => [
265 'name' => 'grant_due_date',
266 'type' => CRM_Utils_Type
::T_DATE
,
267 'title' => ts('Grant Report Due Date'),
268 'description' => ts('Date on which grant report is due.'),
270 'where' => 'civicrm_grant.grant_due_date',
272 'table_name' => 'civicrm_grant',
274 'bao' => 'CRM_Grant_BAO_Grant',
277 'type' => 'Select Date',
278 'formatType' => 'activityDate',
281 'grant_report_received' => [
282 'name' => 'grant_report_received',
283 'type' => CRM_Utils_Type
::T_BOOLEAN
,
284 'title' => ts('Grant report received'),
285 'description' => ts('Yes/No field stating whether grant report was received by donor.'),
287 'where' => 'civicrm_grant.grant_report_received',
289 'table_name' => 'civicrm_grant',
291 'bao' => 'CRM_Grant_BAO_Grant',
294 'type' => 'CheckBox',
298 'name' => 'grant_type_id',
299 'type' => CRM_Utils_Type
::T_INT
,
300 'title' => ts('Grant Type'),
301 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'),
303 'where' => 'civicrm_grant.grant_type_id',
305 'table_name' => 'civicrm_grant',
307 'bao' => 'CRM_Grant_BAO_Grant',
312 'pseudoconstant' => [
313 'optionGroupName' => 'grant_type',
314 'optionEditPath' => 'civicrm/admin/options/grant_type',
318 'name' => 'amount_total',
319 'type' => CRM_Utils_Type
::T_MONEY
,
320 'title' => ts('Total Amount'),
321 'description' => ts('Requested grant amount, in default currency.'),
328 'where' => 'civicrm_grant.amount_total',
329 'dataPattern' => '/^\d+(\.\d{2})?$/',
331 'table_name' => 'civicrm_grant',
333 'bao' => 'CRM_Grant_BAO_Grant',
339 'amount_requested' => [
340 'name' => 'amount_requested',
341 'type' => CRM_Utils_Type
::T_MONEY
,
342 'title' => ts('Amount Requested'),
343 'description' => ts('Requested grant amount, in original currency (optional).'),
348 'where' => 'civicrm_grant.amount_requested',
349 'dataPattern' => '/^\d+(\.\d{2})?$/',
350 'table_name' => 'civicrm_grant',
352 'bao' => 'CRM_Grant_BAO_Grant',
358 'amount_granted' => [
359 'name' => 'amount_granted',
360 'type' => CRM_Utils_Type
::T_MONEY
,
361 'title' => ts('Amount granted'),
362 'description' => ts('Granted amount, in default currency.'),
368 'where' => 'civicrm_grant.amount_granted',
369 'dataPattern' => '/^\d+(\.\d{2})?$/',
371 'table_name' => 'civicrm_grant',
373 'bao' => 'CRM_Grant_BAO_Grant',
380 'name' => 'currency',
381 'type' => CRM_Utils_Type
::T_STRING
,
382 'title' => ts('Grant Currency'),
383 'description' => ts('3 character string, value from config setting or input via user.'),
386 'size' => CRM_Utils_Type
::FOUR
,
387 'where' => 'civicrm_grant.currency',
388 'table_name' => 'civicrm_grant',
390 'bao' => 'CRM_Grant_BAO_Grant',
395 'pseudoconstant' => [
396 'table' => 'civicrm_currency',
397 'keyColumn' => 'name',
398 'labelColumn' => 'full_name',
399 'nameColumn' => 'name',
400 'abbrColumn' => 'symbol',
404 'name' => 'rationale',
405 'type' => CRM_Utils_Type
::T_TEXT
,
406 'title' => ts('Grant Rationale'),
407 'description' => ts('Grant rationale.'),
411 'where' => 'civicrm_grant.rationale',
413 'table_name' => 'civicrm_grant',
415 'bao' => 'CRM_Grant_BAO_Grant',
418 'type' => 'TextArea',
421 'grant_status_id' => [
422 'name' => 'status_id',
423 'type' => CRM_Utils_Type
::T_INT
,
424 'title' => ts('Grant Status'),
425 'description' => ts('Id of Grant status.'),
428 'where' => 'civicrm_grant.status_id',
430 'table_name' => 'civicrm_grant',
432 'bao' => 'CRM_Grant_BAO_Grant',
437 'pseudoconstant' => [
438 'optionGroupName' => 'grant_status',
439 'optionEditPath' => 'civicrm/admin/options/grant_status',
442 'financial_type_id' => [
443 'name' => 'financial_type_id',
444 'type' => CRM_Utils_Type
::T_INT
,
445 'title' => ts('Financial Type'),
446 'description' => ts('FK to Financial Type.'),
447 'where' => 'civicrm_grant.financial_type_id',
449 'table_name' => 'civicrm_grant',
451 'bao' => 'CRM_Grant_BAO_Grant',
453 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
454 'pseudoconstant' => [
455 'table' => 'civicrm_financial_type',
457 'labelColumn' => 'name',
461 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
463 return Civi
::$statics[__CLASS__
]['fields'];
467 * Return a mapping from field-name to the corresponding key (as used in fields()).
470 * Array(string $name => string $uniqueName).
472 public static function &fieldKeys() {
473 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
474 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
476 return Civi
::$statics[__CLASS__
]['fieldKeys'];
480 * Returns the names of this table
484 public static function getTableName() {
485 return self
::$_tableName;
489 * Returns if this table needs to be logged
493 public function getLog() {
498 * Returns the list of fields that can be imported
500 * @param bool $prefix
504 public static function &import($prefix = FALSE) {
505 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, []);
510 * Returns the list of fields that can be exported
512 * @param bool $prefix
516 public static function &export($prefix = FALSE) {
517 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, []);
522 * Returns the list of indices
524 * @param bool $localize
528 public static function indices($localize = TRUE) {
530 'index_grant_type_id' => [
531 'name' => 'index_grant_type_id',
533 0 => 'grant_type_id',
535 'localizable' => FALSE,
536 'sig' => 'civicrm_grant::0::grant_type_id',
538 'index_status_id' => [
539 'name' => 'index_status_id',
543 'localizable' => FALSE,
544 'sig' => 'civicrm_grant::0::status_id',
547 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;