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