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',
188 'grant_contact_id' => array(
189 'name' => 'contact_id',
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Contact ID') ,
192 'description' => 'Contact ID of contact record given grant belongs to.',
195 'where' => 'civicrm_grant.contact_id',
196 'headerPattern' => '',
198 'table_name' => 'civicrm_grant',
200 'bao' => 'CRM_Grant_BAO_Grant',
201 'FKClassName' => 'CRM_Contact_DAO_Contact',
203 'type' => 'EntityRef',
206 'application_received_date' => array(
207 'name' => 'application_received_date',
208 'type' => CRM_Utils_Type
::T_DATE
,
209 'title' => ts('Application received date') ,
210 'description' => 'Date on which grant application was received by donor.',
212 'where' => 'civicrm_grant.application_received_date',
213 'headerPattern' => '',
215 'table_name' => 'civicrm_grant',
217 'bao' => 'CRM_Grant_BAO_Grant',
219 'decision_date' => array(
220 'name' => 'decision_date',
221 'type' => CRM_Utils_Type
::T_DATE
,
222 'title' => ts('Decision date') ,
223 'description' => 'Date on which grant decision was made.',
225 'where' => 'civicrm_grant.decision_date',
226 'headerPattern' => '',
229 'table_name' => 'civicrm_grant',
231 'bao' => 'CRM_Grant_BAO_Grant',
233 'type' => 'Select Date',
236 'grant_money_transfer_date' => array(
237 'name' => 'money_transfer_date',
238 'type' => CRM_Utils_Type
::T_DATE
,
239 'title' => ts('Grant Money transfer date') ,
240 'description' => 'Date on which grant money transfer was made.',
242 'where' => 'civicrm_grant.money_transfer_date',
243 'headerPattern' => '',
246 'table_name' => 'civicrm_grant',
248 'bao' => 'CRM_Grant_BAO_Grant',
250 'type' => 'Select Date',
253 'grant_due_date' => array(
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',
262 'type' => 'Select Date',
265 'grant_report_received' => array(
266 'name' => 'grant_report_received',
267 'type' => CRM_Utils_Type
::T_BOOLEAN
,
268 'title' => ts('Grant report received') ,
269 'description' => 'Yes/No field stating whether grant report was received by donor.',
271 'where' => 'civicrm_grant.grant_report_received',
272 'headerPattern' => '',
275 'table_name' => 'civicrm_grant',
277 'bao' => 'CRM_Grant_BAO_Grant',
279 'type' => 'CheckBox',
282 'grant_type_id' => array(
283 'name' => 'grant_type_id',
284 'type' => CRM_Utils_Type
::T_INT
,
285 'title' => ts('Grant Type') ,
286 'description' => 'Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.',
289 'where' => 'civicrm_grant.grant_type_id',
290 'headerPattern' => '',
292 'table_name' => 'civicrm_grant',
294 'bao' => 'CRM_Grant_BAO_Grant',
298 'pseudoconstant' => array(
299 'optionGroupName' => 'grant_type',
300 'optionEditPath' => 'civicrm/admin/options/grant_type',
303 'amount_total' => array(
304 'name' => 'amount_total',
305 'type' => CRM_Utils_Type
::T_MONEY
,
306 'title' => ts('Total Amount') ,
307 'description' => 'Requested grant amount, in default currency.',
309 'precision' => array(
314 'where' => 'civicrm_grant.amount_total',
315 'headerPattern' => '',
316 'dataPattern' => '/^\d+(\.\d{2})?$/',
318 'table_name' => 'civicrm_grant',
320 'bao' => 'CRM_Grant_BAO_Grant',
325 'amount_requested' => array(
326 'name' => 'amount_requested',
327 'type' => CRM_Utils_Type
::T_MONEY
,
328 'title' => ts('Amount Requested') ,
329 'description' => 'Requested grant amount, in original currency (optional).',
330 'precision' => array(
334 'table_name' => 'civicrm_grant',
336 'bao' => 'CRM_Grant_BAO_Grant',
341 'amount_granted' => array(
342 'name' => 'amount_granted',
343 'type' => CRM_Utils_Type
::T_MONEY
,
344 'title' => ts('Amount granted') ,
345 'description' => 'Granted amount, in default currency.',
346 'precision' => array(
351 'where' => 'civicrm_grant.amount_granted',
352 'headerPattern' => '',
353 'dataPattern' => '/^\d+(\.\d{2})?$/',
355 'table_name' => 'civicrm_grant',
357 'bao' => 'CRM_Grant_BAO_Grant',
363 'name' => 'currency',
364 'type' => CRM_Utils_Type
::T_STRING
,
365 'title' => ts('Grant Currency') ,
366 'description' => '3 character string, value from config setting or input via user.',
369 'size' => CRM_Utils_Type
::FOUR
,
370 'table_name' => 'civicrm_grant',
372 'bao' => 'CRM_Grant_BAO_Grant',
376 'pseudoconstant' => array(
377 'table' => 'civicrm_currency',
378 'keyColumn' => 'name',
379 'labelColumn' => 'full_name',
380 'nameColumn' => 'name',
383 'rationale' => array(
384 'name' => 'rationale',
385 'type' => CRM_Utils_Type
::T_TEXT
,
386 'title' => ts('Grant Rationale') ,
387 'description' => 'Grant rationale.',
391 'where' => 'civicrm_grant.rationale',
392 'headerPattern' => '',
395 'table_name' => 'civicrm_grant',
397 'bao' => 'CRM_Grant_BAO_Grant',
399 'type' => 'TextArea',
402 'grant_status_id' => array(
403 'name' => 'status_id',
404 'type' => CRM_Utils_Type
::T_INT
,
405 'title' => ts('Grant Status') ,
406 'description' => 'Id of Grant status.',
409 'where' => 'civicrm_grant.status_id',
410 'headerPattern' => '',
413 'table_name' => 'civicrm_grant',
415 'bao' => 'CRM_Grant_BAO_Grant',
419 'pseudoconstant' => array(
420 'optionGroupName' => 'grant_status',
421 'optionEditPath' => 'civicrm/admin/options/grant_status',
424 'financial_type_id' => array(
425 'name' => 'financial_type_id',
426 'type' => CRM_Utils_Type
::T_INT
,
427 'title' => ts('Financial Type') ,
428 'description' => 'FK to Financial Type.',
430 'table_name' => 'civicrm_grant',
432 'bao' => 'CRM_Grant_BAO_Grant',
433 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
434 'pseudoconstant' => array(
435 'table' => 'civicrm_financial_type',
437 'labelColumn' => 'name',
441 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
443 return Civi
::$statics[__CLASS__
]['fields'];
446 * Return a mapping from field-name to the corresponding key (as used in fields()).
449 * Array(string $name => string $uniqueName).
451 static function &fieldKeys() {
452 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
453 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
455 return Civi
::$statics[__CLASS__
]['fieldKeys'];
458 * Returns the names of this table
462 static function getTableName() {
463 return self
::$_tableName;
466 * Returns if this table needs to be logged
474 * Returns the list of fields that can be imported
476 * @param bool $prefix
480 static function &import($prefix = false) {
481 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, array());
485 * Returns the list of fields that can be exported
487 * @param bool $prefix
491 static function &export($prefix = false) {
492 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, array());