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:38ec42e92df1109ae3a0fe337852fbd5)
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' => '',
185 'grant_contact_id' => array(
186 'name' => 'contact_id',
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Contact ID') ,
189 'description' => 'Contact ID of contact record given grant belongs to.',
192 'where' => 'civicrm_grant.contact_id',
193 'headerPattern' => '',
195 'FKClassName' => 'CRM_Contact_DAO_Contact',
197 'type' => 'EntityRef',
200 'application_received_date' => array(
201 'name' => 'application_received_date',
202 'type' => CRM_Utils_Type
::T_DATE
,
203 'title' => ts('Application received date') ,
204 'description' => 'Date on which grant application was received by donor.',
206 'where' => 'civicrm_grant.application_received_date',
207 'headerPattern' => '',
210 'decision_date' => array(
211 'name' => 'decision_date',
212 'type' => CRM_Utils_Type
::T_DATE
,
213 'title' => ts('Decision date') ,
214 'description' => 'Date on which grant decision was made.',
216 'where' => 'civicrm_grant.decision_date',
217 'headerPattern' => '',
221 'type' => 'Select Date',
224 'grant_money_transfer_date' => array(
225 'name' => 'money_transfer_date',
226 'type' => CRM_Utils_Type
::T_DATE
,
227 'title' => ts('Grant Money transfer date') ,
228 'description' => 'Date on which grant money transfer was made.',
230 'where' => 'civicrm_grant.money_transfer_date',
231 'headerPattern' => '',
235 'type' => 'Select Date',
238 'grant_due_date' => array(
239 'name' => 'grant_due_date',
240 'type' => CRM_Utils_Type
::T_DATE
,
241 'title' => ts('Grant Due Date') ,
242 'description' => 'Date on which grant report is due.',
244 'type' => 'Select Date',
247 'grant_report_received' => array(
248 'name' => 'grant_report_received',
249 'type' => CRM_Utils_Type
::T_BOOLEAN
,
250 'title' => ts('Grant report received') ,
251 'description' => 'Yes/No field stating whether grant report was received by donor.',
253 'where' => 'civicrm_grant.grant_report_received',
254 'headerPattern' => '',
258 'type' => 'CheckBox',
261 'grant_type_id' => array(
262 'name' => 'grant_type_id',
263 'type' => CRM_Utils_Type
::T_INT
,
264 'title' => ts('Grant Type') ,
265 'description' => 'Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.',
268 'where' => 'civicrm_grant.grant_type_id',
269 'headerPattern' => '',
274 'pseudoconstant' => array(
275 'optionGroupName' => 'grant_type',
276 'optionEditPath' => 'civicrm/admin/options/grant_type',
279 'amount_total' => array(
280 'name' => 'amount_total',
281 'type' => CRM_Utils_Type
::T_MONEY
,
282 'title' => ts('Total Amount') ,
283 'description' => 'Requested grant amount, in default currency.',
285 'precision' => array(
290 'where' => 'civicrm_grant.amount_total',
291 'headerPattern' => '',
292 'dataPattern' => '/^\d+(\.\d{2})?$/',
298 'amount_requested' => array(
299 'name' => 'amount_requested',
300 'type' => CRM_Utils_Type
::T_MONEY
,
301 'title' => ts('Amount Requested') ,
302 'description' => 'Requested grant amount, in original currency (optional).',
303 'precision' => array(
311 'amount_granted' => array(
312 'name' => 'amount_granted',
313 'type' => CRM_Utils_Type
::T_MONEY
,
314 'title' => ts('Amount granted') ,
315 'description' => 'Granted amount, in default currency.',
316 'precision' => array(
321 'where' => 'civicrm_grant.amount_granted',
322 'headerPattern' => '',
323 'dataPattern' => '/^\d+(\.\d{2})?$/',
330 'name' => 'currency',
331 'type' => CRM_Utils_Type
::T_STRING
,
332 'title' => ts('Grant Currency') ,
333 'description' => '3 character string, value from config setting or input via user.',
336 'size' => CRM_Utils_Type
::FOUR
,
340 'pseudoconstant' => array(
341 'table' => 'civicrm_currency',
342 'keyColumn' => 'name',
343 'labelColumn' => 'full_name',
344 'nameColumn' => 'name',
347 'rationale' => array(
348 'name' => 'rationale',
349 'type' => CRM_Utils_Type
::T_TEXT
,
350 'title' => ts('Grant Rationale') ,
351 'description' => 'Grant rationale.',
355 'where' => 'civicrm_grant.rationale',
356 'headerPattern' => '',
360 'type' => 'TextArea',
363 'grant_status_id' => array(
364 'name' => 'status_id',
365 'type' => CRM_Utils_Type
::T_INT
,
366 'title' => ts('Grant Status') ,
367 'description' => 'Id of Grant status.',
370 'where' => 'civicrm_grant.status_id',
371 'headerPattern' => '',
377 'pseudoconstant' => array(
378 'optionGroupName' => 'grant_status',
379 'optionEditPath' => 'civicrm/admin/options/grant_status',
382 'financial_type_id' => array(
383 'name' => 'financial_type_id',
384 'type' => CRM_Utils_Type
::T_INT
,
385 'title' => ts('Financial Type') ,
386 'description' => 'FK to Financial Type.',
388 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
389 'pseudoconstant' => array(
390 'table' => 'civicrm_financial_type',
392 'labelColumn' => 'name',
396 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
398 return Civi
::$statics[__CLASS__
]['fields'];
401 * Return a mapping from field-name to the corresponding key (as used in fields()).
404 * Array(string $name => string $uniqueName).
406 static function &fieldKeys() {
407 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
408 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
410 return Civi
::$statics[__CLASS__
]['fieldKeys'];
413 * Returns the names of this table
417 static function getTableName() {
418 return self
::$_tableName;
421 * Returns if this table needs to be logged
429 * Returns the list of fields that can be imported
431 * @param bool $prefix
435 static function &import($prefix = false) {
436 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'grant', $prefix, array());
440 * Returns the list of fields that can be exported
442 * @param bool $prefix
446 static function &export($prefix = false) {
447 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'grant', $prefix, array());