3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Grant/Grant.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:2abbee941ab414e5e67978a55a5bb2ee)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Grant_DAO_Grant constructor.
40 class CRM_Grant_DAO_Grant
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_grant';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * Contact ID of contact record given grant belongs to.
66 * Date on which grant application was received by donor.
70 public $application_received_date;
72 * Date on which grant decision was made.
76 public $decision_date;
78 * Date on which grant money transfer was made.
82 public $money_transfer_date;
84 * Date on which grant report is due.
88 public $grant_due_date;
90 * Yes/No field stating whether grant report was received by donor.
94 public $grant_report_received;
96 * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.
100 public $grant_type_id;
102 * Requested grant amount, in default currency.
106 public $amount_total;
108 * Requested grant amount, in original currency (optional).
112 public $amount_requested;
114 * Granted amount, in default currency.
118 public $amount_granted;
120 * 3 character string, value from config setting or input via user.
132 * Id of Grant status.
138 * FK to Financial Type.
142 public $financial_type_id;
146 function __construct() {
147 $this->__table
= 'civicrm_grant';
148 parent
::__construct();
151 * Returns foreign keys and entity references.
154 * [CRM_Core_Reference_Interface]
156 static function getReferenceColumns() {
157 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
158 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
159 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id', 'civicrm_contact', 'id');
160 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
161 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
163 return Civi
::$statics[__CLASS__
]['links'];
166 * Returns all the column names of this table
170 static function &fields() {
171 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
172 Civi
::$statics[__CLASS__
]['fields'] = array(
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Grant ID') ,
177 'description' => 'Unique Grant id',
180 'where' => 'civicrm_grant.id',
181 'headerPattern' => '',
184 'table_name' => 'civicrm_grant',
186 'bao' => 'CRM_Grant_BAO_Grant',
189 'grant_contact_id' => array(
190 'name' => 'contact_id',
191 'type' => CRM_Utils_Type
::T_INT
,
192 'title' => ts('Contact ID') ,
193 'description' => 'Contact ID of contact record given grant belongs to.',
196 'where' => 'civicrm_grant.contact_id',
197 'headerPattern' => '',
199 'table_name' => 'civicrm_grant',
201 'bao' => 'CRM_Grant_BAO_Grant',
203 'FKClassName' => 'CRM_Contact_DAO_Contact',
205 'type' => 'EntityRef',
208 'application_received_date' => array(
209 'name' => 'application_received_date',
210 'type' => CRM_Utils_Type
::T_DATE
,
211 'title' => ts('Application received date') ,
212 'description' => 'Date on which grant application was received by donor.',
214 'where' => 'civicrm_grant.application_received_date',
215 'headerPattern' => '',
217 'table_name' => 'civicrm_grant',
219 'bao' => 'CRM_Grant_BAO_Grant',
222 'decision_date' => array(
223 'name' => 'decision_date',
224 'type' => CRM_Utils_Type
::T_DATE
,
225 'title' => ts('Decision date') ,
226 'description' => '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',
240 'grant_money_transfer_date' => array(
241 'name' => 'money_transfer_date',
242 'type' => CRM_Utils_Type
::T_DATE
,
243 'title' => ts('Grant Money transfer date') ,
244 'description' => 'Date on which grant money transfer was made.',
246 'where' => 'civicrm_grant.money_transfer_date',
247 'headerPattern' => '',
250 'table_name' => 'civicrm_grant',
252 'bao' => 'CRM_Grant_BAO_Grant',
255 'type' => 'Select Date',
258 'grant_due_date' => array(
259 'name' => 'grant_due_date',
260 'type' => CRM_Utils_Type
::T_DATE
,
261 'title' => ts('Grant Due Date') ,
262 'description' => 'Date on which grant report is due.',
263 'table_name' => 'civicrm_grant',
265 'bao' => 'CRM_Grant_BAO_Grant',
268 'type' => 'Select Date',
271 'grant_report_received' => array(
272 'name' => 'grant_report_received',
273 'type' => CRM_Utils_Type
::T_BOOLEAN
,
274 'title' => ts('Grant report received') ,
275 'description' => 'Yes/No field stating whether grant report was received by donor.',
277 'where' => 'civicrm_grant.grant_report_received',
278 'headerPattern' => '',
281 'table_name' => 'civicrm_grant',
283 'bao' => 'CRM_Grant_BAO_Grant',
286 'type' => 'CheckBox',
289 'grant_type_id' => array(
290 'name' => 'grant_type_id',
291 'type' => CRM_Utils_Type
::T_INT
,
292 'title' => ts('Grant Type') ,
293 'description' => 'Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.',
296 'where' => 'civicrm_grant.grant_type_id',
297 'headerPattern' => '',
299 'table_name' => 'civicrm_grant',
301 'bao' => 'CRM_Grant_BAO_Grant',
306 'pseudoconstant' => array(
307 'optionGroupName' => 'grant_type',
308 'optionEditPath' => 'civicrm/admin/options/grant_type',
311 'amount_total' => array(
312 'name' => 'amount_total',
313 'type' => CRM_Utils_Type
::T_MONEY
,
314 'title' => ts('Total Amount') ,
315 'description' => 'Requested grant amount, in default currency.',
317 'precision' => array(
322 'where' => 'civicrm_grant.amount_total',
323 'headerPattern' => '',
324 'dataPattern' => '/^\d+(\.\d{2})?$/',
326 'table_name' => 'civicrm_grant',
328 'bao' => 'CRM_Grant_BAO_Grant',
334 'amount_requested' => array(
335 'name' => 'amount_requested',
336 'type' => CRM_Utils_Type
::T_MONEY
,
337 'title' => ts('Amount Requested') ,
338 'description' => 'Requested grant amount, in original currency (optional).',
339 'precision' => array(
343 'table_name' => 'civicrm_grant',
345 'bao' => 'CRM_Grant_BAO_Grant',
351 'amount_granted' => array(
352 'name' => 'amount_granted',
353 'type' => CRM_Utils_Type
::T_MONEY
,
354 'title' => ts('Amount granted') ,
355 'description' => 'Granted amount, in default currency.',
356 'precision' => array(
361 'where' => 'civicrm_grant.amount_granted',
362 'headerPattern' => '',
363 'dataPattern' => '/^\d+(\.\d{2})?$/',
365 'table_name' => 'civicrm_grant',
367 'bao' => 'CRM_Grant_BAO_Grant',
374 'name' => 'currency',
375 'type' => CRM_Utils_Type
::T_STRING
,
376 'title' => ts('Grant Currency') ,
377 'description' => '3 character string, value from config setting or input via user.',
380 'size' => CRM_Utils_Type
::FOUR
,
381 'table_name' => 'civicrm_grant',
383 'bao' => 'CRM_Grant_BAO_Grant',
388 'pseudoconstant' => array(
389 'table' => 'civicrm_currency',
390 'keyColumn' => 'name',
391 'labelColumn' => 'full_name',
392 'nameColumn' => 'name',
395 'rationale' => array(
396 'name' => 'rationale',
397 'type' => CRM_Utils_Type
::T_TEXT
,
398 'title' => ts('Grant Rationale') ,
399 'description' => 'Grant rationale.',
403 'where' => 'civicrm_grant.rationale',
404 'headerPattern' => '',
407 'table_name' => 'civicrm_grant',
409 'bao' => 'CRM_Grant_BAO_Grant',
412 'type' => 'TextArea',
415 'grant_status_id' => array(
416 'name' => 'status_id',
417 'type' => CRM_Utils_Type
::T_INT
,
418 'title' => ts('Grant Status') ,
419 'description' => 'Id of Grant status.',
422 'where' => 'civicrm_grant.status_id',
423 'headerPattern' => '',
426 'table_name' => 'civicrm_grant',
428 'bao' => 'CRM_Grant_BAO_Grant',
433 'pseudoconstant' => array(
434 'optionGroupName' => 'grant_status',
435 'optionEditPath' => 'civicrm/admin/options/grant_status',
438 'financial_type_id' => array(
439 'name' => 'financial_type_id',
440 'type' => CRM_Utils_Type
::T_INT
,
441 'title' => ts('Financial Type') ,
442 'description' => 'FK to Financial Type.',
444 'table_name' => 'civicrm_grant',
446 'bao' => 'CRM_Grant_BAO_Grant',
448 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
449 'pseudoconstant' => array(
450 'table' => 'civicrm_financial_type',
452 'labelColumn' => 'name',
456 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
458 return Civi
::$statics[__CLASS__
]['fields'];
461 * Return a mapping from field-name to the corresponding key (as used in fields()).
464 * Array(string $name => string $uniqueName).
466 static function &fieldKeys() {
467 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
468 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
470 return Civi
::$statics[__CLASS__
]['fieldKeys'];
473 * Returns the names of this table
477 static function getTableName() {
478 return self
::$_tableName;
481 * Returns if this table needs to be logged
489 * Returns the list of fields that can be imported
491 * @param bool $prefix
495 static function &import($prefix = false) {
496 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, array());
500 * Returns the list of fields that can be exported
502 * @param bool $prefix
506 static function &export($prefix = false) {
507 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, array());