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:91aecd5b45ba8c5cd6636bb95ddbbfee)
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 * @param bool $plural
157 * Whether to return the plural version of the title.
159 public static function getEntityTitle($plural = FALSE) {
160 return $plural ?
ts('Grants') : ts('Grant');
164 * Returns foreign keys and entity references.
167 * [CRM_Core_Reference_Interface]
169 public static function getReferenceColumns() {
170 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
171 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
172 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
173 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
174 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
176 return Civi
::$statics[__CLASS__
]['links'];
180 * Returns all the column names of this table
184 public static function &fields() {
185 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
186 Civi
::$statics[__CLASS__
]['fields'] = [
189 'type' => CRM_Utils_Type
::T_INT
,
190 'title' => ts('Grant ID'),
191 'description' => ts('Unique Grant id'),
194 'where' => 'civicrm_grant.id',
196 'table_name' => 'civicrm_grant',
198 'bao' => 'CRM_Grant_BAO_Grant',
202 'grant_contact_id' => [
203 'name' => 'contact_id',
204 'type' => CRM_Utils_Type
::T_INT
,
205 'title' => ts('Contact ID'),
206 'description' => ts('Contact ID of contact record given grant belongs to.'),
208 'where' => 'civicrm_grant.contact_id',
210 'table_name' => 'civicrm_grant',
212 'bao' => 'CRM_Grant_BAO_Grant',
214 'FKClassName' => 'CRM_Contact_DAO_Contact',
216 'type' => 'EntityRef',
220 'grant_application_received_date' => [
221 'name' => 'application_received_date',
222 'type' => CRM_Utils_Type
::T_DATE
,
223 'title' => ts('Application received date'),
224 'description' => ts('Date on which grant application was received by donor.'),
226 'where' => 'civicrm_grant.application_received_date',
228 'table_name' => 'civicrm_grant',
230 'bao' => 'CRM_Grant_BAO_Grant',
233 'type' => 'Select Date',
234 'formatType' => 'activityDate',
238 'grant_decision_date' => [
239 'name' => 'decision_date',
240 'type' => CRM_Utils_Type
::T_DATE
,
241 'title' => ts('Decision date'),
242 'description' => ts('Date on which grant decision was made.'),
244 'where' => 'civicrm_grant.decision_date',
246 'table_name' => 'civicrm_grant',
248 'bao' => 'CRM_Grant_BAO_Grant',
251 'type' => 'Select Date',
252 'formatType' => 'activityDate',
256 'grant_money_transfer_date' => [
257 'name' => 'money_transfer_date',
258 'type' => CRM_Utils_Type
::T_DATE
,
259 'title' => ts('Grant Money transfer date'),
260 'description' => ts('Date on which grant money transfer was made.'),
262 'where' => 'civicrm_grant.money_transfer_date',
264 'table_name' => 'civicrm_grant',
266 'bao' => 'CRM_Grant_BAO_Grant',
269 'type' => 'Select Date',
270 'formatType' => 'activityDate',
274 'grant_due_date' => [
275 'name' => 'grant_due_date',
276 'type' => CRM_Utils_Type
::T_DATE
,
277 'title' => ts('Grant Report Due Date'),
278 'description' => ts('Date on which grant report is due.'),
280 'where' => 'civicrm_grant.grant_due_date',
282 'table_name' => 'civicrm_grant',
284 'bao' => 'CRM_Grant_BAO_Grant',
287 'type' => 'Select Date',
288 'formatType' => 'activityDate',
292 'grant_report_received' => [
293 'name' => 'grant_report_received',
294 'type' => CRM_Utils_Type
::T_BOOLEAN
,
295 'title' => ts('Grant report received'),
296 'description' => ts('Yes/No field stating whether grant report was received by donor.'),
298 'where' => 'civicrm_grant.grant_report_received',
300 'table_name' => 'civicrm_grant',
302 'bao' => 'CRM_Grant_BAO_Grant',
305 'type' => 'CheckBox',
310 'name' => 'grant_type_id',
311 'type' => CRM_Utils_Type
::T_INT
,
312 'title' => ts('Grant Type'),
313 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'),
315 'where' => 'civicrm_grant.grant_type_id',
317 'table_name' => 'civicrm_grant',
319 'bao' => 'CRM_Grant_BAO_Grant',
324 'pseudoconstant' => [
325 'optionGroupName' => 'grant_type',
326 'optionEditPath' => 'civicrm/admin/options/grant_type',
331 'name' => 'amount_total',
332 'type' => CRM_Utils_Type
::T_MONEY
,
333 'title' => ts('Total Amount'),
334 'description' => ts('Requested grant amount, in default currency.'),
341 'where' => 'civicrm_grant.amount_total',
342 'dataPattern' => '/^\d+(\.\d{2})?$/',
344 'table_name' => 'civicrm_grant',
346 'bao' => 'CRM_Grant_BAO_Grant',
353 'amount_requested' => [
354 'name' => 'amount_requested',
355 'type' => CRM_Utils_Type
::T_MONEY
,
356 'title' => ts('Amount Requested'),
357 'description' => ts('Requested grant amount, in original currency (optional).'),
362 'where' => 'civicrm_grant.amount_requested',
363 'dataPattern' => '/^\d+(\.\d{2})?$/',
364 'table_name' => 'civicrm_grant',
366 'bao' => 'CRM_Grant_BAO_Grant',
373 'amount_granted' => [
374 'name' => 'amount_granted',
375 'type' => CRM_Utils_Type
::T_MONEY
,
376 'title' => ts('Amount granted'),
377 'description' => ts('Granted amount, in default currency.'),
383 'where' => 'civicrm_grant.amount_granted',
384 'dataPattern' => '/^\d+(\.\d{2})?$/',
386 'table_name' => 'civicrm_grant',
388 'bao' => 'CRM_Grant_BAO_Grant',
396 'name' => 'currency',
397 'type' => CRM_Utils_Type
::T_STRING
,
398 'title' => ts('Grant Currency'),
399 'description' => ts('3 character string, value from config setting or input via user.'),
402 'size' => CRM_Utils_Type
::FOUR
,
403 'where' => 'civicrm_grant.currency',
404 'table_name' => 'civicrm_grant',
406 'bao' => 'CRM_Grant_BAO_Grant',
411 'pseudoconstant' => [
412 'table' => 'civicrm_currency',
413 'keyColumn' => 'name',
414 'labelColumn' => 'full_name',
415 'nameColumn' => 'name',
416 'abbrColumn' => 'symbol',
421 'name' => 'rationale',
422 'type' => CRM_Utils_Type
::T_TEXT
,
423 'title' => ts('Grant Rationale'),
424 'description' => ts('Grant rationale.'),
428 'where' => 'civicrm_grant.rationale',
430 'table_name' => 'civicrm_grant',
432 'bao' => 'CRM_Grant_BAO_Grant',
435 'type' => 'TextArea',
439 'grant_status_id' => [
440 'name' => 'status_id',
441 'type' => CRM_Utils_Type
::T_INT
,
442 'title' => ts('Grant Status'),
443 'description' => ts('Id of Grant status.'),
446 'where' => 'civicrm_grant.status_id',
448 'table_name' => 'civicrm_grant',
450 'bao' => 'CRM_Grant_BAO_Grant',
455 'pseudoconstant' => [
456 'optionGroupName' => 'grant_status',
457 'optionEditPath' => 'civicrm/admin/options/grant_status',
461 'financial_type_id' => [
462 'name' => 'financial_type_id',
463 'type' => CRM_Utils_Type
::T_INT
,
464 'title' => ts('Financial Type'),
465 'description' => ts('FK to Financial Type.'),
466 'where' => 'civicrm_grant.financial_type_id',
468 'table_name' => 'civicrm_grant',
470 'bao' => 'CRM_Grant_BAO_Grant',
472 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
473 'pseudoconstant' => [
474 'table' => 'civicrm_financial_type',
476 'labelColumn' => 'name',
481 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
483 return Civi
::$statics[__CLASS__
]['fields'];
487 * Return a mapping from field-name to the corresponding key (as used in fields()).
490 * Array(string $name => string $uniqueName).
492 public static function &fieldKeys() {
493 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
494 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
496 return Civi
::$statics[__CLASS__
]['fieldKeys'];
500 * Returns the names of this table
504 public static function getTableName() {
505 return self
::$_tableName;
509 * Returns if this table needs to be logged
513 public function getLog() {
518 * Returns the list of fields that can be imported
520 * @param bool $prefix
524 public static function &import($prefix = FALSE) {
525 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, []);
530 * Returns the list of fields that can be exported
532 * @param bool $prefix
536 public static function &export($prefix = FALSE) {
537 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, []);
542 * Returns the list of indices
544 * @param bool $localize
548 public static function indices($localize = TRUE) {
550 'index_grant_type_id' => [
551 'name' => 'index_grant_type_id',
553 0 => 'grant_type_id',
555 'localizable' => FALSE,
556 'sig' => 'civicrm_grant::0::grant_type_id',
558 'index_status_id' => [
559 'name' => 'index_status_id',
563 'localizable' => FALSE,
564 'sig' => 'civicrm_grant::0::status_id',
567 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;