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:55398307473a631415b01f5e9b40f7dc)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
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',
177 'table_name' => 'civicrm_grant',
179 'bao' => 'CRM_Grant_BAO_Grant',
182 'grant_contact_id' => [
183 'name' => 'contact_id',
184 'type' => CRM_Utils_Type
::T_INT
,
185 'title' => ts('Contact ID'),
186 'description' => ts('Contact ID of contact record given grant belongs to.'),
188 'where' => 'civicrm_grant.contact_id',
190 'table_name' => 'civicrm_grant',
192 'bao' => 'CRM_Grant_BAO_Grant',
194 'FKClassName' => 'CRM_Contact_DAO_Contact',
196 'type' => 'EntityRef',
199 'grant_application_received_date' => [
200 'name' => 'application_received_date',
201 'type' => CRM_Utils_Type
::T_DATE
,
202 'title' => ts('Application received date'),
203 'description' => ts('Date on which grant application was received by donor.'),
205 'where' => 'civicrm_grant.application_received_date',
207 'table_name' => 'civicrm_grant',
209 'bao' => 'CRM_Grant_BAO_Grant',
212 'type' => 'Select Date',
213 'formatType' => 'activityDate',
216 'grant_decision_date' => [
217 'name' => 'decision_date',
218 'type' => CRM_Utils_Type
::T_DATE
,
219 'title' => ts('Decision date'),
220 'description' => ts('Date on which grant decision was made.'),
222 'where' => 'civicrm_grant.decision_date',
224 'table_name' => 'civicrm_grant',
226 'bao' => 'CRM_Grant_BAO_Grant',
229 'type' => 'Select Date',
230 'formatType' => 'activityDate',
233 'grant_money_transfer_date' => [
234 'name' => 'money_transfer_date',
235 'type' => CRM_Utils_Type
::T_DATE
,
236 'title' => ts('Grant Money transfer date'),
237 'description' => ts('Date on which grant money transfer was made.'),
239 'where' => 'civicrm_grant.money_transfer_date',
241 'table_name' => 'civicrm_grant',
243 'bao' => 'CRM_Grant_BAO_Grant',
246 'type' => 'Select Date',
247 'formatType' => 'activityDate',
250 'grant_due_date' => [
251 'name' => 'grant_due_date',
252 'type' => CRM_Utils_Type
::T_DATE
,
253 'title' => ts('Grant Report Due Date'),
254 'description' => ts('Date on which grant report is due.'),
256 'where' => 'civicrm_grant.grant_due_date',
258 'table_name' => 'civicrm_grant',
260 'bao' => 'CRM_Grant_BAO_Grant',
263 'type' => 'Select Date',
264 'formatType' => 'activityDate',
267 'grant_report_received' => [
268 'name' => 'grant_report_received',
269 'type' => CRM_Utils_Type
::T_BOOLEAN
,
270 'title' => ts('Grant report received'),
271 'description' => ts('Yes/No field stating whether grant report was received by donor.'),
273 'where' => 'civicrm_grant.grant_report_received',
275 'table_name' => 'civicrm_grant',
277 'bao' => 'CRM_Grant_BAO_Grant',
280 'type' => 'CheckBox',
284 'name' => 'grant_type_id',
285 'type' => CRM_Utils_Type
::T_INT
,
286 'title' => ts('Grant Type'),
287 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'),
289 'where' => 'civicrm_grant.grant_type_id',
291 'table_name' => 'civicrm_grant',
293 'bao' => 'CRM_Grant_BAO_Grant',
298 'pseudoconstant' => [
299 'optionGroupName' => 'grant_type',
300 'optionEditPath' => 'civicrm/admin/options/grant_type',
304 'name' => 'amount_total',
305 'type' => CRM_Utils_Type
::T_MONEY
,
306 'title' => ts('Total Amount'),
307 'description' => ts('Requested grant amount, in default currency.'),
314 'where' => 'civicrm_grant.amount_total',
315 'dataPattern' => '/^\d+(\.\d{2})?$/',
317 'table_name' => 'civicrm_grant',
319 'bao' => 'CRM_Grant_BAO_Grant',
325 'amount_requested' => [
326 'name' => 'amount_requested',
327 'type' => CRM_Utils_Type
::T_MONEY
,
328 'title' => ts('Amount Requested'),
329 'description' => ts('Requested grant amount, in original currency (optional).'),
334 'where' => 'civicrm_grant.amount_requested',
335 'dataPattern' => '/^\d+(\.\d{2})?$/',
336 'table_name' => 'civicrm_grant',
338 'bao' => 'CRM_Grant_BAO_Grant',
344 'amount_granted' => [
345 'name' => 'amount_granted',
346 'type' => CRM_Utils_Type
::T_MONEY
,
347 'title' => ts('Amount granted'),
348 'description' => ts('Granted amount, in default currency.'),
354 'where' => 'civicrm_grant.amount_granted',
355 'dataPattern' => '/^\d+(\.\d{2})?$/',
357 'table_name' => 'civicrm_grant',
359 'bao' => 'CRM_Grant_BAO_Grant',
366 'name' => 'currency',
367 'type' => CRM_Utils_Type
::T_STRING
,
368 'title' => ts('Grant Currency'),
369 'description' => ts('3 character string, value from config setting or input via user.'),
372 'size' => CRM_Utils_Type
::FOUR
,
373 'where' => 'civicrm_grant.currency',
374 'table_name' => 'civicrm_grant',
376 'bao' => 'CRM_Grant_BAO_Grant',
381 'pseudoconstant' => [
382 'table' => 'civicrm_currency',
383 'keyColumn' => 'name',
384 'labelColumn' => 'full_name',
385 'nameColumn' => 'name',
389 'name' => 'rationale',
390 'type' => CRM_Utils_Type
::T_TEXT
,
391 'title' => ts('Grant Rationale'),
392 'description' => ts('Grant rationale.'),
396 'where' => 'civicrm_grant.rationale',
398 'table_name' => 'civicrm_grant',
400 'bao' => 'CRM_Grant_BAO_Grant',
403 'type' => 'TextArea',
406 'grant_status_id' => [
407 'name' => 'status_id',
408 'type' => CRM_Utils_Type
::T_INT
,
409 'title' => ts('Grant Status'),
410 'description' => ts('Id of Grant status.'),
413 'where' => 'civicrm_grant.status_id',
415 'table_name' => 'civicrm_grant',
417 'bao' => 'CRM_Grant_BAO_Grant',
422 'pseudoconstant' => [
423 'optionGroupName' => 'grant_status',
424 'optionEditPath' => 'civicrm/admin/options/grant_status',
427 'financial_type_id' => [
428 'name' => 'financial_type_id',
429 'type' => CRM_Utils_Type
::T_INT
,
430 'title' => ts('Financial Type'),
431 'description' => ts('FK to Financial Type.'),
432 'where' => 'civicrm_grant.financial_type_id',
434 'table_name' => 'civicrm_grant',
436 'bao' => 'CRM_Grant_BAO_Grant',
438 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
439 'pseudoconstant' => [
440 'table' => 'civicrm_financial_type',
442 'labelColumn' => 'name',
446 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
448 return Civi
::$statics[__CLASS__
]['fields'];
452 * Return a mapping from field-name to the corresponding key (as used in fields()).
455 * Array(string $name => string $uniqueName).
457 public static function &fieldKeys() {
458 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
459 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
461 return Civi
::$statics[__CLASS__
]['fieldKeys'];
465 * Returns the names of this table
469 public static function getTableName() {
470 return self
::$_tableName;
474 * Returns if this table needs to be logged
478 public function getLog() {
483 * Returns the list of fields that can be imported
485 * @param bool $prefix
489 public static function &import($prefix = FALSE) {
490 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, []);
495 * Returns the list of fields that can be exported
497 * @param bool $prefix
501 public static function &export($prefix = FALSE) {
502 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, []);
507 * Returns the list of indices
509 * @param bool $localize
513 public static function indices($localize = TRUE) {
515 'index_grant_type_id' => [
516 'name' => 'index_grant_type_id',
518 0 => 'grant_type_id',
520 'localizable' => FALSE,
521 'sig' => 'civicrm_grant::0::grant_type_id',
523 'index_status_id' => [
524 'name' => 'index_status_id',
528 'localizable' => FALSE,
529 'sig' => 'civicrm_grant::0::status_id',
532 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;