Merge pull request #9560 from aydun/CRM-19754
[civicrm-core.git] / CRM / Grant / DAO / Grant.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
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. |
13| |
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. |
18| |
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+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Grant/Grant.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:38ec42e92df1109ae3a0fe337852fbd5)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_grant';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = true;
51 /**
52 * Unique Grant id
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Contact ID of contact record given grant belongs to.
59 *
60 * @var int unsigned
61 */
62 public $contact_id;
63 /**
64 * Date on which grant application was received by donor.
65 *
66 * @var date
67 */
68 public $application_received_date;
69 /**
70 * Date on which grant decision was made.
71 *
72 * @var date
73 */
74 public $decision_date;
75 /**
76 * Date on which grant money transfer was made.
77 *
78 * @var date
79 */
80 public $money_transfer_date;
81 /**
82 * Date on which grant report is due.
83 *
84 * @var date
85 */
86 public $grant_due_date;
87 /**
88 * Yes/No field stating whether grant report was received by donor.
89 *
90 * @var boolean
91 */
92 public $grant_report_received;
93 /**
94 * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.
95 *
96 * @var int unsigned
97 */
98 public $grant_type_id;
99 /**
100 * Requested grant amount, in default currency.
101 *
102 * @var float
103 */
104 public $amount_total;
105 /**
106 * Requested grant amount, in original currency (optional).
107 *
108 * @var float
109 */
110 public $amount_requested;
111 /**
112 * Granted amount, in default currency.
113 *
114 * @var float
115 */
116 public $amount_granted;
117 /**
118 * 3 character string, value from config setting or input via user.
119 *
120 * @var string
121 */
122 public $currency;
123 /**
124 * Grant rationale.
125 *
126 * @var text
127 */
128 public $rationale;
129 /**
130 * Id of Grant status.
131 *
132 * @var int unsigned
133 */
134 public $status_id;
135 /**
136 * FK to Financial Type.
137 *
138 * @var int unsigned
139 */
140 public $financial_type_id;
141 /**
142 * class constructor
143 *
144 * @return civicrm_grant
145 */
146 function __construct() {
147 $this->__table = 'civicrm_grant';
148 parent::__construct();
149 }
150 /**
151 * Returns foreign keys and entity references
152 *
153 * @return array
154 * [CRM_Core_Reference_Interface]
155 */
156 static function getReferenceColumns() {
346aaaba
TO
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']);
e501603b 162 }
346aaaba 163 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
164 }
165 /**
166 * Returns all the column names of this table
167 *
168 * @return array
169 */
170 static function &fields() {
346aaaba
TO
171 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
172 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
173 'grant_id' => array(
174 'name' => 'id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Grant ID') ,
177 'description' => 'Unique Grant id',
178 'required' => true,
179 'import' => true,
180 'where' => 'civicrm_grant.id',
181 'headerPattern' => '',
182 'dataPattern' => '',
183 'export' => true,
184 ) ,
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.',
190 'required' => true,
191 'export' => true,
192 'where' => 'civicrm_grant.contact_id',
193 'headerPattern' => '',
194 'dataPattern' => '',
195 'FKClassName' => 'CRM_Contact_DAO_Contact',
196 'html' => array(
197 'type' => 'EntityRef',
198 ) ,
199 ) ,
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.',
205 'export' => true,
206 'where' => 'civicrm_grant.application_received_date',
207 'headerPattern' => '',
208 'dataPattern' => '',
209 ) ,
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.',
215 'import' => true,
216 'where' => 'civicrm_grant.decision_date',
217 'headerPattern' => '',
218 'dataPattern' => '',
219 'export' => true,
220 'html' => array(
221 'type' => 'Select Date',
222 ) ,
223 ) ,
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.',
229 'import' => true,
230 'where' => 'civicrm_grant.money_transfer_date',
231 'headerPattern' => '',
232 'dataPattern' => '',
233 'export' => true,
234 'html' => array(
235 'type' => 'Select Date',
236 ) ,
237 ) ,
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.',
243 'html' => array(
244 'type' => 'Select Date',
245 ) ,
246 ) ,
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.',
252 'import' => true,
253 'where' => 'civicrm_grant.grant_report_received',
254 'headerPattern' => '',
255 'dataPattern' => '',
256 'export' => true,
257 'html' => array(
258 'type' => 'CheckBox',
259 ) ,
260 ) ,
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.',
266 'required' => true,
267 'export' => true,
268 'where' => 'civicrm_grant.grant_type_id',
269 'headerPattern' => '',
270 'dataPattern' => '',
271 'html' => array(
272 'type' => 'Select',
273 ) ,
274 'pseudoconstant' => array(
275 'optionGroupName' => 'grant_type',
276 'optionEditPath' => 'civicrm/admin/options/grant_type',
277 )
278 ) ,
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.',
284 'required' => true,
285 'precision' => array(
286 20,
287 2
288 ) ,
289 'import' => true,
290 'where' => 'civicrm_grant.amount_total',
291 'headerPattern' => '',
292 'dataPattern' => '/^\d+(\.\d{2})?$/',
293 'export' => true,
294 'html' => array(
295 'type' => 'Text',
296 ) ,
297 ) ,
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(
304 20,
305 2
306 ) ,
307 'html' => array(
308 'type' => 'Text',
309 ) ,
310 ) ,
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(
317 20,
318 2
319 ) ,
320 'import' => true,
321 'where' => 'civicrm_grant.amount_granted',
322 'headerPattern' => '',
323 'dataPattern' => '/^\d+(\.\d{2})?$/',
324 'export' => true,
325 'html' => array(
326 'type' => 'Text',
327 ) ,
328 ) ,
329 'currency' => array(
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.',
334 'required' => true,
335 'maxlength' => 3,
336 'size' => CRM_Utils_Type::FOUR,
337 'html' => array(
338 'type' => 'Select',
339 ) ,
340 'pseudoconstant' => array(
341 'table' => 'civicrm_currency',
342 'keyColumn' => 'name',
343 'labelColumn' => 'full_name',
344 'nameColumn' => 'name',
345 )
346 ) ,
347 'rationale' => array(
348 'name' => 'rationale',
349 'type' => CRM_Utils_Type::T_TEXT,
350 'title' => ts('Grant Rationale') ,
351 'description' => 'Grant rationale.',
352 'rows' => 4,
353 'cols' => 60,
354 'import' => true,
355 'where' => 'civicrm_grant.rationale',
356 'headerPattern' => '',
357 'dataPattern' => '',
358 'export' => true,
359 'html' => array(
360 'type' => 'TextArea',
361 ) ,
362 ) ,
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.',
368 'required' => true,
369 'import' => true,
370 'where' => 'civicrm_grant.status_id',
371 'headerPattern' => '',
372 'dataPattern' => '',
373 'export' => false,
374 'html' => array(
375 'type' => 'Select',
376 ) ,
377 'pseudoconstant' => array(
378 'optionGroupName' => 'grant_status',
379 'optionEditPath' => 'civicrm/admin/options/grant_status',
380 )
381 ) ,
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.',
387 'default' => 'NULL',
388 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
389 'pseudoconstant' => array(
390 'table' => 'civicrm_financial_type',
391 'keyColumn' => 'id',
392 'labelColumn' => 'name',
393 )
394 ) ,
395 );
346aaaba 396 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 397 }
346aaaba 398 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
399 }
400 /**
bd8e0b14 401 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
402 *
403 * @return array
bd8e0b14 404 * Array(string $name => string $uniqueName).
e501603b
TO
405 */
406 static function &fieldKeys() {
bd8e0b14
TO
407 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
408 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 409 }
bd8e0b14 410 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
411 }
412 /**
413 * Returns the names of this table
414 *
415 * @return string
416 */
417 static function getTableName() {
418 return self::$_tableName;
419 }
420 /**
421 * Returns if this table needs to be logged
422 *
423 * @return boolean
424 */
425 function getLog() {
426 return self::$_log;
427 }
428 /**
429 * Returns the list of fields that can be imported
430 *
431 * @param bool $prefix
432 *
433 * @return array
434 */
435 static function &import($prefix = false) {
60808919
TO
436 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, array());
437 return $r;
e501603b
TO
438 }
439 /**
440 * Returns the list of fields that can be exported
441 *
442 * @param bool $prefix
443 *
444 * @return array
445 */
446 static function &export($prefix = false) {
60808919
TO
447 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, array());
448 return $r;
e501603b
TO
449 }
450}