5 * @copyright CiviCRM LLC (c) 2004-2017
7 * Generated from xml/schema/CRM/Grant/Grant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:600fc71093543f1c7b31ad663f2325c6)
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' => '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' => '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 'application_received_date' => [
204 'name' => 'application_received_date',
205 'type' => CRM_Utils_Type
::T_DATE
,
206 'title' => ts('Application received date'),
207 'description' => 'Date on which grant application was received by donor.',
209 'where' => 'civicrm_grant.application_received_date',
210 'headerPattern' => '',
212 'table_name' => 'civicrm_grant',
214 'bao' => 'CRM_Grant_BAO_Grant',
218 'name' => 'decision_date',
219 'type' => CRM_Utils_Type
::T_DATE
,
220 'title' => ts('Decision date'),
221 'description' => 'Date on which grant decision was made.',
223 'where' => 'civicrm_grant.decision_date',
224 'headerPattern' => '',
227 'table_name' => 'civicrm_grant',
229 'bao' => 'CRM_Grant_BAO_Grant',
232 'type' => 'Select Date',
235 'grant_money_transfer_date' => [
236 'name' => 'money_transfer_date',
237 'type' => CRM_Utils_Type
::T_DATE
,
238 'title' => ts('Grant Money transfer date'),
239 'description' => 'Date on which grant money transfer was made.',
241 'where' => 'civicrm_grant.money_transfer_date',
242 'headerPattern' => '',
245 'table_name' => 'civicrm_grant',
247 'bao' => 'CRM_Grant_BAO_Grant',
250 'type' => 'Select Date',
253 'grant_due_date' => [
254 'name' => 'grant_due_date',
255 'type' => CRM_Utils_Type
::T_DATE
,
256 'title' => ts('Grant Due Date'),
257 'description' => 'Date on which grant report is due.',
258 'table_name' => 'civicrm_grant',
260 'bao' => 'CRM_Grant_BAO_Grant',
263 'type' => 'Select Date',
266 'grant_report_received' => [
267 'name' => 'grant_report_received',
268 'type' => CRM_Utils_Type
::T_BOOLEAN
,
269 'title' => ts('Grant report received'),
270 'description' => 'Yes/No field stating whether grant report was received by donor.',
272 'where' => 'civicrm_grant.grant_report_received',
273 'headerPattern' => '',
276 'table_name' => 'civicrm_grant',
278 'bao' => 'CRM_Grant_BAO_Grant',
281 'type' => 'CheckBox',
285 'name' => 'grant_type_id',
286 'type' => CRM_Utils_Type
::T_INT
,
287 'title' => ts('Grant Type'),
288 'description' => 'Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.',
291 'where' => 'civicrm_grant.grant_type_id',
292 'headerPattern' => '',
294 'table_name' => 'civicrm_grant',
296 'bao' => 'CRM_Grant_BAO_Grant',
301 'pseudoconstant' => [
302 'optionGroupName' => 'grant_type',
303 'optionEditPath' => 'civicrm/admin/options/grant_type',
307 'name' => 'amount_total',
308 'type' => CRM_Utils_Type
::T_MONEY
,
309 'title' => ts('Total Amount'),
310 'description' => 'Requested grant amount, in default currency.',
317 'where' => 'civicrm_grant.amount_total',
318 'headerPattern' => '',
319 'dataPattern' => '/^\d+(\.\d{2})?$/',
321 'table_name' => 'civicrm_grant',
323 'bao' => 'CRM_Grant_BAO_Grant',
329 'amount_requested' => [
330 'name' => 'amount_requested',
331 'type' => CRM_Utils_Type
::T_MONEY
,
332 'title' => ts('Amount Requested'),
333 'description' => 'Requested grant amount, in original currency (optional).',
338 'table_name' => 'civicrm_grant',
340 'bao' => 'CRM_Grant_BAO_Grant',
346 'amount_granted' => [
347 'name' => 'amount_granted',
348 'type' => CRM_Utils_Type
::T_MONEY
,
349 'title' => ts('Amount granted'),
350 'description' => 'Granted amount, in default currency.',
356 'where' => 'civicrm_grant.amount_granted',
357 'headerPattern' => '',
358 'dataPattern' => '/^\d+(\.\d{2})?$/',
360 'table_name' => 'civicrm_grant',
362 'bao' => 'CRM_Grant_BAO_Grant',
369 'name' => 'currency',
370 'type' => CRM_Utils_Type
::T_STRING
,
371 'title' => ts('Grant Currency'),
372 'description' => '3 character string, value from config setting or input via user.',
375 'size' => CRM_Utils_Type
::FOUR
,
376 'table_name' => 'civicrm_grant',
378 'bao' => 'CRM_Grant_BAO_Grant',
383 'pseudoconstant' => [
384 'table' => 'civicrm_currency',
385 'keyColumn' => 'name',
386 'labelColumn' => 'full_name',
387 'nameColumn' => 'name',
391 'name' => 'rationale',
392 'type' => CRM_Utils_Type
::T_TEXT
,
393 'title' => ts('Grant Rationale'),
394 'description' => 'Grant rationale.',
398 'where' => 'civicrm_grant.rationale',
399 'headerPattern' => '',
402 'table_name' => 'civicrm_grant',
404 'bao' => 'CRM_Grant_BAO_Grant',
407 'type' => 'TextArea',
410 'grant_status_id' => [
411 'name' => 'status_id',
412 'type' => CRM_Utils_Type
::T_INT
,
413 'title' => ts('Grant Status'),
414 'description' => 'Id of Grant status.',
417 'where' => 'civicrm_grant.status_id',
418 'headerPattern' => '',
421 'table_name' => 'civicrm_grant',
423 'bao' => 'CRM_Grant_BAO_Grant',
428 'pseudoconstant' => [
429 'optionGroupName' => 'grant_status',
430 'optionEditPath' => 'civicrm/admin/options/grant_status',
433 'financial_type_id' => [
434 'name' => 'financial_type_id',
435 'type' => CRM_Utils_Type
::T_INT
,
436 'title' => ts('Financial Type'),
437 'description' => 'FK to Financial Type.',
439 'table_name' => 'civicrm_grant',
441 'bao' => 'CRM_Grant_BAO_Grant',
443 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
444 'pseudoconstant' => [
445 'table' => 'civicrm_financial_type',
447 'labelColumn' => 'name',
451 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
453 return Civi
::$statics[__CLASS__
]['fields'];
457 * Return a mapping from field-name to the corresponding key (as used in fields()).
460 * Array(string $name => string $uniqueName).
462 public static function &fieldKeys() {
463 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
464 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
466 return Civi
::$statics[__CLASS__
]['fieldKeys'];
470 * Returns the names of this table
474 public static function getTableName() {
475 return self
::$_tableName;
479 * Returns if this table needs to be logged
483 public function getLog() {
488 * Returns the list of fields that can be imported
490 * @param bool $prefix
494 public static function &import($prefix = FALSE) {
495 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, []);
500 * Returns the list of fields that can be exported
502 * @param bool $prefix
506 public static function &export($prefix = FALSE) {
507 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, []);
512 * Returns the list of indices
514 * @param bool $localize
518 public static function indices($localize = TRUE) {
520 'index_grant_type_id' => [
521 'name' => 'index_grant_type_id',
523 0 => 'grant_type_id',
525 'localizable' => FALSE,
526 'sig' => 'civicrm_grant::0::grant_type_id',
528 'index_status_id' => [
529 'name' => 'index_status_id',
533 'localizable' => FALSE,
534 'sig' => 'civicrm_grant::0::status_id',
537 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;