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