CRM-20312 regenerated DAO with localisation
[civicrm-core.git] / CRM / Grant / DAO / Grant.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Grant/Grant.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:2abbee941ab414e5e67978a55a5bb2ee)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Grant_DAO_Grant constructor.
39 */
40 class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_grant';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Unique Grant id
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Contact ID of contact record given grant belongs to.
61 *
62 * @var int unsigned
63 */
64 public $contact_id;
65 /**
66 * Date on which grant application was received by donor.
67 *
68 * @var date
69 */
70 public $application_received_date;
71 /**
72 * Date on which grant decision was made.
73 *
74 * @var date
75 */
76 public $decision_date;
77 /**
78 * Date on which grant money transfer was made.
79 *
80 * @var date
81 */
82 public $money_transfer_date;
83 /**
84 * Date on which grant report is due.
85 *
86 * @var date
87 */
88 public $grant_due_date;
89 /**
90 * Yes/No field stating whether grant report was received by donor.
91 *
92 * @var boolean
93 */
94 public $grant_report_received;
95 /**
96 * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.
97 *
98 * @var int unsigned
99 */
100 public $grant_type_id;
101 /**
102 * Requested grant amount, in default currency.
103 *
104 * @var float
105 */
106 public $amount_total;
107 /**
108 * Requested grant amount, in original currency (optional).
109 *
110 * @var float
111 */
112 public $amount_requested;
113 /**
114 * Granted amount, in default currency.
115 *
116 * @var float
117 */
118 public $amount_granted;
119 /**
120 * 3 character string, value from config setting or input via user.
121 *
122 * @var string
123 */
124 public $currency;
125 /**
126 * Grant rationale.
127 *
128 * @var text
129 */
130 public $rationale;
131 /**
132 * Id of Grant status.
133 *
134 * @var int unsigned
135 */
136 public $status_id;
137 /**
138 * FK to Financial Type.
139 *
140 * @var int unsigned
141 */
142 public $financial_type_id;
143 /**
144 * Class constructor.
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() {
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']);
162 }
163 return Civi::$statics[__CLASS__]['links'];
164 }
165 /**
166 * Returns all the column names of this table
167 *
168 * @return array
169 */
170 static function &fields() {
171 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
172 Civi::$statics[__CLASS__]['fields'] = array(
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 'table_name' => 'civicrm_grant',
185 'entity' => 'Grant',
186 'bao' => 'CRM_Grant_BAO_Grant',
187 'localizable' => 0,
188 ) ,
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.',
194 'required' => true,
195 'export' => true,
196 'where' => 'civicrm_grant.contact_id',
197 'headerPattern' => '',
198 'dataPattern' => '',
199 'table_name' => 'civicrm_grant',
200 'entity' => 'Grant',
201 'bao' => 'CRM_Grant_BAO_Grant',
202 'localizable' => 0,
203 'FKClassName' => 'CRM_Contact_DAO_Contact',
204 'html' => array(
205 'type' => 'EntityRef',
206 ) ,
207 ) ,
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.',
213 'export' => true,
214 'where' => 'civicrm_grant.application_received_date',
215 'headerPattern' => '',
216 'dataPattern' => '',
217 'table_name' => 'civicrm_grant',
218 'entity' => 'Grant',
219 'bao' => 'CRM_Grant_BAO_Grant',
220 'localizable' => 0,
221 ) ,
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.',
227 'import' => true,
228 'where' => 'civicrm_grant.decision_date',
229 'headerPattern' => '',
230 'dataPattern' => '',
231 'export' => true,
232 'table_name' => 'civicrm_grant',
233 'entity' => 'Grant',
234 'bao' => 'CRM_Grant_BAO_Grant',
235 'localizable' => 0,
236 'html' => array(
237 'type' => 'Select Date',
238 ) ,
239 ) ,
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.',
245 'import' => true,
246 'where' => 'civicrm_grant.money_transfer_date',
247 'headerPattern' => '',
248 'dataPattern' => '',
249 'export' => true,
250 'table_name' => 'civicrm_grant',
251 'entity' => 'Grant',
252 'bao' => 'CRM_Grant_BAO_Grant',
253 'localizable' => 0,
254 'html' => array(
255 'type' => 'Select Date',
256 ) ,
257 ) ,
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',
264 'entity' => 'Grant',
265 'bao' => 'CRM_Grant_BAO_Grant',
266 'localizable' => 0,
267 'html' => array(
268 'type' => 'Select Date',
269 ) ,
270 ) ,
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.',
276 'import' => true,
277 'where' => 'civicrm_grant.grant_report_received',
278 'headerPattern' => '',
279 'dataPattern' => '',
280 'export' => true,
281 'table_name' => 'civicrm_grant',
282 'entity' => 'Grant',
283 'bao' => 'CRM_Grant_BAO_Grant',
284 'localizable' => 0,
285 'html' => array(
286 'type' => 'CheckBox',
287 ) ,
288 ) ,
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.',
294 'required' => true,
295 'export' => true,
296 'where' => 'civicrm_grant.grant_type_id',
297 'headerPattern' => '',
298 'dataPattern' => '',
299 'table_name' => 'civicrm_grant',
300 'entity' => 'Grant',
301 'bao' => 'CRM_Grant_BAO_Grant',
302 'localizable' => 0,
303 'html' => array(
304 'type' => 'Select',
305 ) ,
306 'pseudoconstant' => array(
307 'optionGroupName' => 'grant_type',
308 'optionEditPath' => 'civicrm/admin/options/grant_type',
309 )
310 ) ,
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.',
316 'required' => true,
317 'precision' => array(
318 20,
319 2
320 ) ,
321 'import' => true,
322 'where' => 'civicrm_grant.amount_total',
323 'headerPattern' => '',
324 'dataPattern' => '/^\d+(\.\d{2})?$/',
325 'export' => true,
326 'table_name' => 'civicrm_grant',
327 'entity' => 'Grant',
328 'bao' => 'CRM_Grant_BAO_Grant',
329 'localizable' => 0,
330 'html' => array(
331 'type' => 'Text',
332 ) ,
333 ) ,
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(
340 20,
341 2
342 ) ,
343 'table_name' => 'civicrm_grant',
344 'entity' => 'Grant',
345 'bao' => 'CRM_Grant_BAO_Grant',
346 'localizable' => 0,
347 'html' => array(
348 'type' => 'Text',
349 ) ,
350 ) ,
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(
357 20,
358 2
359 ) ,
360 'import' => true,
361 'where' => 'civicrm_grant.amount_granted',
362 'headerPattern' => '',
363 'dataPattern' => '/^\d+(\.\d{2})?$/',
364 'export' => true,
365 'table_name' => 'civicrm_grant',
366 'entity' => 'Grant',
367 'bao' => 'CRM_Grant_BAO_Grant',
368 'localizable' => 0,
369 'html' => array(
370 'type' => 'Text',
371 ) ,
372 ) ,
373 'currency' => array(
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.',
378 'required' => true,
379 'maxlength' => 3,
380 'size' => CRM_Utils_Type::FOUR,
381 'table_name' => 'civicrm_grant',
382 'entity' => 'Grant',
383 'bao' => 'CRM_Grant_BAO_Grant',
384 'localizable' => 0,
385 'html' => array(
386 'type' => 'Select',
387 ) ,
388 'pseudoconstant' => array(
389 'table' => 'civicrm_currency',
390 'keyColumn' => 'name',
391 'labelColumn' => 'full_name',
392 'nameColumn' => 'name',
393 )
394 ) ,
395 'rationale' => array(
396 'name' => 'rationale',
397 'type' => CRM_Utils_Type::T_TEXT,
398 'title' => ts('Grant Rationale') ,
399 'description' => 'Grant rationale.',
400 'rows' => 4,
401 'cols' => 60,
402 'import' => true,
403 'where' => 'civicrm_grant.rationale',
404 'headerPattern' => '',
405 'dataPattern' => '',
406 'export' => true,
407 'table_name' => 'civicrm_grant',
408 'entity' => 'Grant',
409 'bao' => 'CRM_Grant_BAO_Grant',
410 'localizable' => 0,
411 'html' => array(
412 'type' => 'TextArea',
413 ) ,
414 ) ,
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.',
420 'required' => true,
421 'import' => true,
422 'where' => 'civicrm_grant.status_id',
423 'headerPattern' => '',
424 'dataPattern' => '',
425 'export' => false,
426 'table_name' => 'civicrm_grant',
427 'entity' => 'Grant',
428 'bao' => 'CRM_Grant_BAO_Grant',
429 'localizable' => 0,
430 'html' => array(
431 'type' => 'Select',
432 ) ,
433 'pseudoconstant' => array(
434 'optionGroupName' => 'grant_status',
435 'optionEditPath' => 'civicrm/admin/options/grant_status',
436 )
437 ) ,
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.',
443 'default' => 'NULL',
444 'table_name' => 'civicrm_grant',
445 'entity' => 'Grant',
446 'bao' => 'CRM_Grant_BAO_Grant',
447 'localizable' => 0,
448 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
449 'pseudoconstant' => array(
450 'table' => 'civicrm_financial_type',
451 'keyColumn' => 'id',
452 'labelColumn' => 'name',
453 )
454 ) ,
455 );
456 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
457 }
458 return Civi::$statics[__CLASS__]['fields'];
459 }
460 /**
461 * Return a mapping from field-name to the corresponding key (as used in fields()).
462 *
463 * @return array
464 * Array(string $name => string $uniqueName).
465 */
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()));
469 }
470 return Civi::$statics[__CLASS__]['fieldKeys'];
471 }
472 /**
473 * Returns the names of this table
474 *
475 * @return string
476 */
477 static function getTableName() {
478 return self::$_tableName;
479 }
480 /**
481 * Returns if this table needs to be logged
482 *
483 * @return boolean
484 */
485 function getLog() {
486 return self::$_log;
487 }
488 /**
489 * Returns the list of fields that can be imported
490 *
491 * @param bool $prefix
492 *
493 * @return array
494 */
495 static function &import($prefix = false) {
496 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, array());
497 return $r;
498 }
499 /**
500 * Returns the list of fields that can be exported
501 *
502 * @param bool $prefix
503 *
504 * @return array
505 */
506 static function &export($prefix = false) {
507 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, array());
508 return $r;
509 }
510 }