5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Grant/Grant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ea60d8cd875ca924d3cc34b4282c8a8a)
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 static $_tableName = 'civicrm_grant';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 * Contact ID of contact record given grant belongs to.
46 * Date on which grant application was received by donor.
50 public $application_received_date;
53 * Date on which grant decision was made.
57 public $decision_date;
60 * Date on which grant money transfer was made.
64 public $money_transfer_date;
67 * Date on which grant report is due.
71 public $grant_due_date;
74 * Yes/No field stating whether grant report was received by donor.
78 public $grant_report_received;
81 * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.
85 public $grant_type_id;
88 * Requested grant amount, in default currency.
95 * Requested grant amount, in original currency (optional).
99 public $amount_requested;
102 * Granted amount, in default currency.
106 public $amount_granted;
109 * 3 character string, value from config setting or input via user.
123 * Id of Grant status.
130 * FK to Financial Type.
134 public $financial_type_id;
139 public function __construct() {
140 $this->__table
= 'civicrm_grant';
141 parent
::__construct();
145 * Returns foreign keys and entity references.
148 * [CRM_Core_Reference_Interface]
150 public static function getReferenceColumns() {
151 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
152 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
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');
155 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
157 return Civi
::$statics[__CLASS__
]['links'];
161 * Returns all the column names of this table
165 public static function &fields() {
166 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
167 Civi
::$statics[__CLASS__
]['fields'] = [
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Grant ID'),
172 'description' => ts('Unique Grant id'),
175 'where' => 'civicrm_grant.id',
176 'headerPattern' => '',
179 'table_name' => 'civicrm_grant',
181 'bao' => 'CRM_Grant_BAO_Grant',
184 'grant_contact_id' => [
185 'name' => 'contact_id',
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Contact ID'),
188 'description' => ts('Contact ID of contact record given grant belongs to.'),
191 'where' => 'civicrm_grant.contact_id',
192 'headerPattern' => '',
194 'table_name' => 'civicrm_grant',
196 'bao' => 'CRM_Grant_BAO_Grant',
198 'FKClassName' => 'CRM_Contact_DAO_Contact',
200 'type' => 'EntityRef',
203 'grant_application_received_date' => [
204 'name' => 'application_received_date',
205 'type' => CRM_Utils_Type
::T_DATE
,
206 'title' => ts('Application received date'),
207 'description' => ts('Date on which grant application was received by donor.'),
209 'where' => 'civicrm_grant.application_received_date',
210 'headerPattern' => '',
213 'table_name' => 'civicrm_grant',
215 'bao' => 'CRM_Grant_BAO_Grant',
218 'type' => 'Select Date',
219 'formatType' => 'activityDate',
222 'grant_decision_date' => [
223 'name' => 'decision_date',
224 'type' => CRM_Utils_Type
::T_DATE
,
225 'title' => ts('Decision date'),
226 'description' => ts('Date on which grant decision was made.'),
228 'where' => 'civicrm_grant.decision_date',
229 'headerPattern' => '',
232 'table_name' => 'civicrm_grant',
234 'bao' => 'CRM_Grant_BAO_Grant',
237 'type' => 'Select Date',
238 'formatType' => 'activityDate',
241 'grant_money_transfer_date' => [
242 'name' => 'money_transfer_date',
243 'type' => CRM_Utils_Type
::T_DATE
,
244 'title' => ts('Grant Money transfer date'),
245 'description' => ts('Date on which grant money transfer was made.'),
247 'where' => 'civicrm_grant.money_transfer_date',
248 'headerPattern' => '',
251 'table_name' => 'civicrm_grant',
253 'bao' => 'CRM_Grant_BAO_Grant',
256 'type' => 'Select Date',
257 'formatType' => 'activityDate',
260 'grant_due_date' => [
261 'name' => 'grant_due_date',
262 'type' => CRM_Utils_Type
::T_DATE
,
263 'title' => ts('Grant Report Due Date'),
264 'description' => ts('Date on which grant report is due.'),
266 'where' => 'civicrm_grant.grant_due_date',
267 'headerPattern' => '',
270 'table_name' => 'civicrm_grant',
272 'bao' => 'CRM_Grant_BAO_Grant',
275 'type' => 'Select Date',
276 'formatType' => 'activityDate',
279 'grant_report_received' => [
280 'name' => 'grant_report_received',
281 'type' => CRM_Utils_Type
::T_BOOLEAN
,
282 'title' => ts('Grant report received'),
283 'description' => ts('Yes/No field stating whether grant report was received by donor.'),
285 'where' => 'civicrm_grant.grant_report_received',
286 'headerPattern' => '',
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.'),
304 'where' => 'civicrm_grant.grant_type_id',
305 'headerPattern' => '',
307 'table_name' => 'civicrm_grant',
309 'bao' => 'CRM_Grant_BAO_Grant',
314 'pseudoconstant' => [
315 'optionGroupName' => 'grant_type',
316 'optionEditPath' => 'civicrm/admin/options/grant_type',
320 'name' => 'amount_total',
321 'type' => CRM_Utils_Type
::T_MONEY
,
322 'title' => ts('Total Amount'),
323 'description' => ts('Requested grant amount, in default currency.'),
330 'where' => 'civicrm_grant.amount_total',
331 'headerPattern' => '',
332 'dataPattern' => '/^\d+(\.\d{2})?$/',
334 'table_name' => 'civicrm_grant',
336 'bao' => 'CRM_Grant_BAO_Grant',
342 'amount_requested' => [
343 'name' => 'amount_requested',
344 'type' => CRM_Utils_Type
::T_MONEY
,
345 'title' => ts('Amount Requested'),
346 'description' => ts('Requested grant amount, in original currency (optional).'),
351 'table_name' => 'civicrm_grant',
353 'bao' => 'CRM_Grant_BAO_Grant',
359 'amount_granted' => [
360 'name' => 'amount_granted',
361 'type' => CRM_Utils_Type
::T_MONEY
,
362 'title' => ts('Amount granted'),
363 'description' => ts('Granted amount, in default currency.'),
369 'where' => 'civicrm_grant.amount_granted',
370 'headerPattern' => '',
371 'dataPattern' => '/^\d+(\.\d{2})?$/',
373 'table_name' => 'civicrm_grant',
375 'bao' => 'CRM_Grant_BAO_Grant',
382 'name' => 'currency',
383 'type' => CRM_Utils_Type
::T_STRING
,
384 'title' => ts('Grant Currency'),
385 'description' => ts('3 character string, value from config setting or input via user.'),
388 'size' => CRM_Utils_Type
::FOUR
,
389 'table_name' => 'civicrm_grant',
391 'bao' => 'CRM_Grant_BAO_Grant',
396 'pseudoconstant' => [
397 'table' => 'civicrm_currency',
398 'keyColumn' => 'name',
399 'labelColumn' => 'full_name',
400 'nameColumn' => 'name',
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',
412 'headerPattern' => '',
415 'table_name' => 'civicrm_grant',
417 'bao' => 'CRM_Grant_BAO_Grant',
420 'type' => 'TextArea',
423 'grant_status_id' => [
424 'name' => 'status_id',
425 'type' => CRM_Utils_Type
::T_INT
,
426 'title' => ts('Grant Status'),
427 'description' => ts('Id of Grant status.'),
430 'where' => 'civicrm_grant.status_id',
431 'headerPattern' => '',
434 'table_name' => 'civicrm_grant',
436 'bao' => 'CRM_Grant_BAO_Grant',
441 'pseudoconstant' => [
442 'optionGroupName' => 'grant_status',
443 'optionEditPath' => 'civicrm/admin/options/grant_status',
446 'financial_type_id' => [
447 'name' => 'financial_type_id',
448 'type' => CRM_Utils_Type
::T_INT
,
449 'title' => ts('Financial Type'),
450 'description' => ts('FK to Financial Type.'),
452 'table_name' => 'civicrm_grant',
454 'bao' => 'CRM_Grant_BAO_Grant',
456 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
457 'pseudoconstant' => [
458 'table' => 'civicrm_financial_type',
460 'labelColumn' => 'name',
464 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
466 return Civi
::$statics[__CLASS__
]['fields'];
470 * Return a mapping from field-name to the corresponding key (as used in fields()).
473 * Array(string $name => string $uniqueName).
475 public static function &fieldKeys() {
476 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
477 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
479 return Civi
::$statics[__CLASS__
]['fieldKeys'];
483 * Returns the names of this table
487 public static function getTableName() {
488 return self
::$_tableName;
492 * Returns if this table needs to be logged
496 public function getLog() {
501 * Returns the list of fields that can be imported
503 * @param bool $prefix
507 public static function &import($prefix = FALSE) {
508 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, []);
513 * Returns the list of fields that can be exported
515 * @param bool $prefix
519 public static function &export($prefix = FALSE) {
520 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, []);
525 * Returns the list of indices
527 * @param bool $localize
531 public static function indices($localize = TRUE) {
533 'index_grant_type_id' => [
534 'name' => 'index_grant_type_id',
536 0 => 'grant_type_id',
538 'localizable' => FALSE,
539 'sig' => 'civicrm_grant::0::grant_type_id',
541 'index_status_id' => [
542 'name' => 'index_status_id',
546 'localizable' => FALSE,
547 'sig' => 'civicrm_grant::0::status_id',
550 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;