Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Grant/Grant.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
5c385299 | 9 | * (GenCodeChecksum:febf55259ea92f4dd6a7d1ee4b5ea93a) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Grant entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Grant_DAO_Grant extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.8'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_grant'; |
c3fc2621 | 25 | |
449c4e6b CW |
26 | /** |
27 | * Icon associated with this entity. | |
28 | * | |
29 | * @var string | |
30 | */ | |
31 | public static $_icon = 'fa-money'; | |
32 | ||
e501603b | 33 | /** |
f41f0342 | 34 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 35 | * |
c3fc2621 | 36 | * @var bool |
e501603b | 37 | */ |
fa45b5b9 | 38 | public static $_log = TRUE; |
c3fc2621 | 39 | |
a7bd99ff CW |
40 | /** |
41 | * Paths for accessing this entity in the UI. | |
42 | * | |
43 | * @var string[] | |
44 | */ | |
45 | protected static $_paths = [ | |
5c385299 | 46 | 'add' => 'civicrm/grant/add?reset=1&action=add&context=standalone', |
a7bd99ff | 47 | 'view' => 'contact/view/grant?reset=1&action=view&id=[id]&cid=[contact_id]', |
5c385299 | 48 | 'update' => 'civicrm/contact/view/grant?reset=1&action=update&id=[id]&cid=[contact_id]', |
a7bd99ff CW |
49 | 'delete' => 'civicrm/contact/view/grant?reset=1&action=delete&id=[id]&cid=[contact_id]', |
50 | ]; | |
51 | ||
e501603b TO |
52 | /** |
53 | * Unique Grant id | |
54 | * | |
e6ca0a57 | 55 | * @var int |
e501603b TO |
56 | */ |
57 | public $id; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Contact ID of contact record given grant belongs to. | |
61 | * | |
e6ca0a57 | 62 | * @var int |
e501603b TO |
63 | */ |
64 | public $contact_id; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Date on which grant application was received by donor. | |
68 | * | |
69 | * @var date | |
70 | */ | |
71 | public $application_received_date; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Date on which grant decision was made. | |
75 | * | |
76 | * @var date | |
77 | */ | |
78 | public $decision_date; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Date on which grant money transfer was made. | |
82 | * | |
83 | * @var date | |
84 | */ | |
85 | public $money_transfer_date; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * Date on which grant report is due. | |
89 | * | |
90 | * @var date | |
91 | */ | |
92 | public $grant_due_date; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Yes/No field stating whether grant report was received by donor. | |
96 | * | |
e6ca0a57 | 97 | * @var bool |
e501603b TO |
98 | */ |
99 | public $grant_report_received; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group. | |
103 | * | |
e6ca0a57 | 104 | * @var int |
e501603b TO |
105 | */ |
106 | public $grant_type_id; | |
c3fc2621 | 107 | |
e501603b TO |
108 | /** |
109 | * Requested grant amount, in default currency. | |
110 | * | |
111 | * @var float | |
112 | */ | |
113 | public $amount_total; | |
c3fc2621 | 114 | |
e501603b TO |
115 | /** |
116 | * Requested grant amount, in original currency (optional). | |
117 | * | |
118 | * @var float | |
119 | */ | |
120 | public $amount_requested; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Granted amount, in default currency. | |
124 | * | |
125 | * @var float | |
126 | */ | |
127 | public $amount_granted; | |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * 3 character string, value from config setting or input via user. | |
131 | * | |
132 | * @var string | |
133 | */ | |
134 | public $currency; | |
c3fc2621 | 135 | |
e501603b TO |
136 | /** |
137 | * Grant rationale. | |
138 | * | |
139 | * @var text | |
140 | */ | |
141 | public $rationale; | |
c3fc2621 | 142 | |
e501603b TO |
143 | /** |
144 | * Id of Grant status. | |
145 | * | |
e6ca0a57 | 146 | * @var int |
e501603b TO |
147 | */ |
148 | public $status_id; | |
c3fc2621 | 149 | |
e501603b TO |
150 | /** |
151 | * FK to Financial Type. | |
152 | * | |
e6ca0a57 | 153 | * @var int |
e501603b TO |
154 | */ |
155 | public $financial_type_id; | |
c3fc2621 | 156 | |
e501603b | 157 | /** |
f41f0342 | 158 | * Class constructor. |
e501603b | 159 | */ |
c3fc2621 | 160 | public function __construct() { |
e501603b TO |
161 | $this->__table = 'civicrm_grant'; |
162 | parent::__construct(); | |
163 | } | |
c3fc2621 | 164 | |
449c4e6b CW |
165 | /** |
166 | * Returns localized title of this entity. | |
7b66c3b5 AH |
167 | * |
168 | * @param bool $plural | |
169 | * Whether to return the plural version of the title. | |
449c4e6b | 170 | */ |
7b66c3b5 AH |
171 | public static function getEntityTitle($plural = FALSE) { |
172 | return $plural ? ts('Grants') : ts('Grant'); | |
449c4e6b CW |
173 | } |
174 | ||
e501603b | 175 | /** |
f41f0342 | 176 | * Returns foreign keys and entity references. |
e501603b TO |
177 | * |
178 | * @return array | |
179 | * [CRM_Core_Reference_Interface] | |
180 | */ | |
c3fc2621 | 181 | public static function getReferenceColumns() { |
346aaaba | 182 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 183 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
184 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
185 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
346aaaba | 186 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 187 | } |
346aaaba | 188 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 189 | } |
c3fc2621 | 190 | |
e501603b TO |
191 | /** |
192 | * Returns all the column names of this table | |
193 | * | |
194 | * @return array | |
195 | */ | |
c3fc2621 | 196 | public static function &fields() { |
346aaaba | 197 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
198 | Civi::$statics[__CLASS__]['fields'] = [ |
199 | 'grant_id' => [ | |
e501603b TO |
200 | 'name' => 'id', |
201 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 202 | 'title' => ts('Grant ID'), |
215b423e | 203 | 'description' => ts('Unique Grant id'), |
c3fc2621 CW |
204 | 'required' => TRUE, |
205 | 'import' => TRUE, | |
e501603b | 206 | 'where' => 'civicrm_grant.id', |
c3fc2621 | 207 | 'export' => TRUE, |
522a26c9 | 208 | 'table_name' => 'civicrm_grant', |
209 | 'entity' => 'Grant', | |
210 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 211 | 'localizable' => 0, |
a9d0587b | 212 | 'add' => '1.8', |
c3fc2621 CW |
213 | ], |
214 | 'grant_contact_id' => [ | |
e501603b TO |
215 | 'name' => 'contact_id', |
216 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 217 | 'title' => ts('Contact ID'), |
215b423e | 218 | 'description' => ts('Contact ID of contact record given grant belongs to.'), |
c3fc2621 | 219 | 'required' => TRUE, |
e501603b | 220 | 'where' => 'civicrm_grant.contact_id', |
a36434b9 | 221 | 'export' => TRUE, |
522a26c9 | 222 | 'table_name' => 'civicrm_grant', |
223 | 'entity' => 'Grant', | |
224 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 225 | 'localizable' => 0, |
e501603b | 226 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 227 | 'html' => [ |
e501603b | 228 | 'type' => 'EntityRef', |
c3fc2621 | 229 | ], |
a9d0587b | 230 | 'add' => '1.8', |
c3fc2621 | 231 | ], |
0bcac7e7 | 232 | 'grant_application_received_date' => [ |
e501603b TO |
233 | 'name' => 'application_received_date', |
234 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 235 | 'title' => ts('Application received date'), |
215b423e | 236 | 'description' => ts('Date on which grant application was received by donor.'), |
ae7f34ec | 237 | 'import' => TRUE, |
e501603b | 238 | 'where' => 'civicrm_grant.application_received_date', |
ae7f34ec | 239 | 'export' => TRUE, |
522a26c9 | 240 | 'table_name' => 'civicrm_grant', |
241 | 'entity' => 'Grant', | |
242 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 243 | 'localizable' => 0, |
ae7f34ec PN |
244 | 'html' => [ |
245 | 'type' => 'Select Date', | |
246 | 'formatType' => 'activityDate', | |
247 | ], | |
a9d0587b | 248 | 'add' => '1.8', |
c3fc2621 | 249 | ], |
0bcac7e7 | 250 | 'grant_decision_date' => [ |
e501603b TO |
251 | 'name' => 'decision_date', |
252 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 253 | 'title' => ts('Decision date'), |
215b423e | 254 | 'description' => ts('Date on which grant decision was made.'), |
c3fc2621 | 255 | 'import' => TRUE, |
e501603b | 256 | 'where' => 'civicrm_grant.decision_date', |
c3fc2621 | 257 | 'export' => TRUE, |
522a26c9 | 258 | 'table_name' => 'civicrm_grant', |
259 | 'entity' => 'Grant', | |
260 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 261 | 'localizable' => 0, |
c3fc2621 | 262 | 'html' => [ |
e501603b | 263 | 'type' => 'Select Date', |
ae7f34ec | 264 | 'formatType' => 'activityDate', |
c3fc2621 | 265 | ], |
a9d0587b | 266 | 'add' => '1.8', |
c3fc2621 CW |
267 | ], |
268 | 'grant_money_transfer_date' => [ | |
e501603b TO |
269 | 'name' => 'money_transfer_date', |
270 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 271 | 'title' => ts('Grant Money transfer date'), |
215b423e | 272 | 'description' => ts('Date on which grant money transfer was made.'), |
c3fc2621 | 273 | 'import' => TRUE, |
e501603b | 274 | 'where' => 'civicrm_grant.money_transfer_date', |
c3fc2621 | 275 | 'export' => TRUE, |
522a26c9 | 276 | 'table_name' => 'civicrm_grant', |
277 | 'entity' => 'Grant', | |
278 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 279 | 'localizable' => 0, |
c3fc2621 | 280 | 'html' => [ |
e501603b | 281 | 'type' => 'Select Date', |
ae7f34ec | 282 | 'formatType' => 'activityDate', |
c3fc2621 | 283 | ], |
a9d0587b | 284 | 'add' => '1.8', |
c3fc2621 CW |
285 | ], |
286 | 'grant_due_date' => [ | |
e501603b TO |
287 | 'name' => 'grant_due_date', |
288 | 'type' => CRM_Utils_Type::T_DATE, | |
0bcac7e7 | 289 | 'title' => ts('Grant Report Due Date'), |
215b423e | 290 | 'description' => ts('Date on which grant report is due.'), |
ae7f34ec PN |
291 | 'import' => TRUE, |
292 | 'where' => 'civicrm_grant.grant_due_date', | |
ae7f34ec | 293 | 'export' => TRUE, |
522a26c9 | 294 | 'table_name' => 'civicrm_grant', |
295 | 'entity' => 'Grant', | |
296 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 297 | 'localizable' => 0, |
c3fc2621 | 298 | 'html' => [ |
e501603b | 299 | 'type' => 'Select Date', |
ae7f34ec | 300 | 'formatType' => 'activityDate', |
c3fc2621 | 301 | ], |
a9d0587b | 302 | 'add' => '1.8', |
c3fc2621 CW |
303 | ], |
304 | 'grant_report_received' => [ | |
e501603b TO |
305 | 'name' => 'grant_report_received', |
306 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 307 | 'title' => ts('Grant report received'), |
215b423e | 308 | 'description' => ts('Yes/No field stating whether grant report was received by donor.'), |
c3fc2621 | 309 | 'import' => TRUE, |
e501603b | 310 | 'where' => 'civicrm_grant.grant_report_received', |
c3fc2621 | 311 | 'export' => TRUE, |
522a26c9 | 312 | 'table_name' => 'civicrm_grant', |
313 | 'entity' => 'Grant', | |
314 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 315 | 'localizable' => 0, |
c3fc2621 | 316 | 'html' => [ |
e501603b | 317 | 'type' => 'CheckBox', |
c3fc2621 | 318 | ], |
a9d0587b | 319 | 'add' => '1.8', |
c3fc2621 CW |
320 | ], |
321 | 'grant_type_id' => [ | |
e501603b TO |
322 | 'name' => 'grant_type_id', |
323 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 324 | 'title' => ts('Grant Type'), |
215b423e | 325 | 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'), |
c3fc2621 | 326 | 'required' => TRUE, |
e501603b | 327 | 'where' => 'civicrm_grant.grant_type_id', |
a36434b9 | 328 | 'export' => TRUE, |
522a26c9 | 329 | 'table_name' => 'civicrm_grant', |
330 | 'entity' => 'Grant', | |
331 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 332 | 'localizable' => 0, |
c3fc2621 | 333 | 'html' => [ |
e501603b | 334 | 'type' => 'Select', |
c3fc2621 CW |
335 | ], |
336 | 'pseudoconstant' => [ | |
e501603b TO |
337 | 'optionGroupName' => 'grant_type', |
338 | 'optionEditPath' => 'civicrm/admin/options/grant_type', | |
e6ca0a57 | 339 | ], |
a9d0587b | 340 | 'add' => '1.8', |
c3fc2621 CW |
341 | ], |
342 | 'amount_total' => [ | |
e501603b TO |
343 | 'name' => 'amount_total', |
344 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 345 | 'title' => ts('Total Amount'), |
215b423e | 346 | 'description' => ts('Requested grant amount, in default currency.'), |
c3fc2621 CW |
347 | 'required' => TRUE, |
348 | 'precision' => [ | |
e501603b | 349 | 20, |
fb607354 | 350 | 2, |
c3fc2621 CW |
351 | ], |
352 | 'import' => TRUE, | |
e501603b | 353 | 'where' => 'civicrm_grant.amount_total', |
e501603b | 354 | 'dataPattern' => '/^\d+(\.\d{2})?$/', |
c3fc2621 | 355 | 'export' => TRUE, |
522a26c9 | 356 | 'table_name' => 'civicrm_grant', |
357 | 'entity' => 'Grant', | |
358 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 359 | 'localizable' => 0, |
c3fc2621 | 360 | 'html' => [ |
e501603b | 361 | 'type' => 'Text', |
c3fc2621 | 362 | ], |
a9d0587b | 363 | 'add' => '1.8', |
c3fc2621 CW |
364 | ], |
365 | 'amount_requested' => [ | |
e501603b TO |
366 | 'name' => 'amount_requested', |
367 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 368 | 'title' => ts('Amount Requested'), |
215b423e | 369 | 'description' => ts('Requested grant amount, in original currency (optional).'), |
c3fc2621 | 370 | 'precision' => [ |
e501603b | 371 | 20, |
fb607354 | 372 | 2, |
c3fc2621 | 373 | ], |
a36434b9 | 374 | 'where' => 'civicrm_grant.amount_requested', |
375 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
522a26c9 | 376 | 'table_name' => 'civicrm_grant', |
377 | 'entity' => 'Grant', | |
378 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 379 | 'localizable' => 0, |
c3fc2621 | 380 | 'html' => [ |
e501603b | 381 | 'type' => 'Text', |
c3fc2621 | 382 | ], |
a9d0587b | 383 | 'add' => '1.8', |
c3fc2621 CW |
384 | ], |
385 | 'amount_granted' => [ | |
e501603b TO |
386 | 'name' => 'amount_granted', |
387 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 388 | 'title' => ts('Amount granted'), |
215b423e | 389 | 'description' => ts('Granted amount, in default currency.'), |
c3fc2621 | 390 | 'precision' => [ |
e501603b | 391 | 20, |
fb607354 | 392 | 2, |
c3fc2621 CW |
393 | ], |
394 | 'import' => TRUE, | |
e501603b | 395 | 'where' => 'civicrm_grant.amount_granted', |
e501603b | 396 | 'dataPattern' => '/^\d+(\.\d{2})?$/', |
c3fc2621 | 397 | 'export' => TRUE, |
522a26c9 | 398 | 'table_name' => 'civicrm_grant', |
399 | 'entity' => 'Grant', | |
400 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 401 | 'localizable' => 0, |
c3fc2621 | 402 | 'html' => [ |
e501603b | 403 | 'type' => 'Text', |
c3fc2621 | 404 | ], |
a9d0587b | 405 | 'add' => '1.8', |
c3fc2621 CW |
406 | ], |
407 | 'currency' => [ | |
e501603b TO |
408 | 'name' => 'currency', |
409 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 410 | 'title' => ts('Grant Currency'), |
215b423e | 411 | 'description' => ts('3 character string, value from config setting or input via user.'), |
c3fc2621 | 412 | 'required' => TRUE, |
e501603b TO |
413 | 'maxlength' => 3, |
414 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 415 | 'where' => 'civicrm_grant.currency', |
522a26c9 | 416 | 'table_name' => 'civicrm_grant', |
417 | 'entity' => 'Grant', | |
418 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 419 | 'localizable' => 0, |
c3fc2621 | 420 | 'html' => [ |
e501603b | 421 | 'type' => 'Select', |
c3fc2621 CW |
422 | ], |
423 | 'pseudoconstant' => [ | |
e501603b TO |
424 | 'table' => 'civicrm_currency', |
425 | 'keyColumn' => 'name', | |
426 | 'labelColumn' => 'full_name', | |
427 | 'nameColumn' => 'name', | |
a8fdb24e | 428 | 'abbrColumn' => 'symbol', |
e6ca0a57 | 429 | ], |
a9d0587b | 430 | 'add' => '3.2', |
c3fc2621 CW |
431 | ], |
432 | 'rationale' => [ | |
e501603b TO |
433 | 'name' => 'rationale', |
434 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 435 | 'title' => ts('Grant Rationale'), |
215b423e | 436 | 'description' => ts('Grant rationale.'), |
e501603b TO |
437 | 'rows' => 4, |
438 | 'cols' => 60, | |
c3fc2621 | 439 | 'import' => TRUE, |
e501603b | 440 | 'where' => 'civicrm_grant.rationale', |
c3fc2621 | 441 | 'export' => TRUE, |
522a26c9 | 442 | 'table_name' => 'civicrm_grant', |
443 | 'entity' => 'Grant', | |
444 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 445 | 'localizable' => 0, |
c3fc2621 | 446 | 'html' => [ |
e501603b | 447 | 'type' => 'TextArea', |
c3fc2621 | 448 | ], |
a9d0587b | 449 | 'add' => '1.8', |
c3fc2621 CW |
450 | ], |
451 | 'grant_status_id' => [ | |
e501603b TO |
452 | 'name' => 'status_id', |
453 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 454 | 'title' => ts('Grant Status'), |
215b423e | 455 | 'description' => ts('Id of Grant status.'), |
c3fc2621 CW |
456 | 'required' => TRUE, |
457 | 'import' => TRUE, | |
e501603b | 458 | 'where' => 'civicrm_grant.status_id', |
c3fc2621 | 459 | 'export' => FALSE, |
522a26c9 | 460 | 'table_name' => 'civicrm_grant', |
461 | 'entity' => 'Grant', | |
462 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 463 | 'localizable' => 0, |
c3fc2621 | 464 | 'html' => [ |
e501603b | 465 | 'type' => 'Select', |
c3fc2621 CW |
466 | ], |
467 | 'pseudoconstant' => [ | |
e501603b TO |
468 | 'optionGroupName' => 'grant_status', |
469 | 'optionEditPath' => 'civicrm/admin/options/grant_status', | |
e6ca0a57 | 470 | ], |
a9d0587b | 471 | 'add' => '1.8', |
c3fc2621 CW |
472 | ], |
473 | 'financial_type_id' => [ | |
e501603b TO |
474 | 'name' => 'financial_type_id', |
475 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 476 | 'title' => ts('Financial Type'), |
215b423e | 477 | 'description' => ts('FK to Financial Type.'), |
a36434b9 | 478 | 'where' => 'civicrm_grant.financial_type_id', |
e501603b | 479 | 'default' => 'NULL', |
522a26c9 | 480 | 'table_name' => 'civicrm_grant', |
481 | 'entity' => 'Grant', | |
482 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 483 | 'localizable' => 0, |
e501603b | 484 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 485 | 'pseudoconstant' => [ |
e501603b TO |
486 | 'table' => 'civicrm_financial_type', |
487 | 'keyColumn' => 'id', | |
488 | 'labelColumn' => 'name', | |
e6ca0a57 | 489 | ], |
a9d0587b | 490 | 'add' => '4.3', |
c3fc2621 CW |
491 | ], |
492 | ]; | |
346aaaba | 493 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 494 | } |
346aaaba | 495 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 496 | } |
c3fc2621 | 497 | |
e501603b | 498 | /** |
bd8e0b14 | 499 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
500 | * |
501 | * @return array | |
bd8e0b14 | 502 | * Array(string $name => string $uniqueName). |
e501603b | 503 | */ |
c3fc2621 | 504 | public static function &fieldKeys() { |
bd8e0b14 TO |
505 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
506 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 507 | } |
bd8e0b14 | 508 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 509 | } |
c3fc2621 | 510 | |
e501603b TO |
511 | /** |
512 | * Returns the names of this table | |
513 | * | |
514 | * @return string | |
515 | */ | |
c3fc2621 | 516 | public static function getTableName() { |
e501603b TO |
517 | return self::$_tableName; |
518 | } | |
c3fc2621 | 519 | |
e501603b TO |
520 | /** |
521 | * Returns if this table needs to be logged | |
522 | * | |
c3fc2621 | 523 | * @return bool |
e501603b | 524 | */ |
c3fc2621 | 525 | public function getLog() { |
e501603b TO |
526 | return self::$_log; |
527 | } | |
c3fc2621 | 528 | |
e501603b TO |
529 | /** |
530 | * Returns the list of fields that can be imported | |
531 | * | |
532 | * @param bool $prefix | |
533 | * | |
534 | * @return array | |
535 | */ | |
c3fc2621 CW |
536 | public static function &import($prefix = FALSE) { |
537 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, []); | |
60808919 | 538 | return $r; |
e501603b | 539 | } |
c3fc2621 | 540 | |
e501603b TO |
541 | /** |
542 | * Returns the list of fields that can be exported | |
543 | * | |
544 | * @param bool $prefix | |
545 | * | |
546 | * @return array | |
547 | */ | |
c3fc2621 CW |
548 | public static function &export($prefix = FALSE) { |
549 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, []); | |
60808919 | 550 | return $r; |
e501603b | 551 | } |
c3fc2621 | 552 | |
e7a6b91a AS |
553 | /** |
554 | * Returns the list of indices | |
c3fc2621 CW |
555 | * |
556 | * @param bool $localize | |
557 | * | |
558 | * @return array | |
e7a6b91a AS |
559 | */ |
560 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
561 | $indices = [ |
562 | 'index_grant_type_id' => [ | |
e7a6b91a | 563 | 'name' => 'index_grant_type_id', |
c3fc2621 | 564 | 'field' => [ |
e7a6b91a | 565 | 0 => 'grant_type_id', |
c3fc2621 CW |
566 | ], |
567 | 'localizable' => FALSE, | |
e7a6b91a | 568 | 'sig' => 'civicrm_grant::0::grant_type_id', |
c3fc2621 CW |
569 | ], |
570 | 'index_status_id' => [ | |
e7a6b91a | 571 | 'name' => 'index_status_id', |
c3fc2621 | 572 | 'field' => [ |
e7a6b91a | 573 | 0 => 'status_id', |
c3fc2621 CW |
574 | ], |
575 | 'localizable' => FALSE, | |
e7a6b91a | 576 | 'sig' => 'civicrm_grant::0::status_id', |
c3fc2621 CW |
577 | ], |
578 | ]; | |
e7a6b91a AS |
579 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
580 | } | |
c3fc2621 | 581 | |
e501603b | 582 | } |