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 | |
2562d09a | 9 | * (GenCodeChecksum:36856b7ed6b7fc04e812c92fd42df94f) |
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', |
811ee1a9 | 48 | 'view' => 'civicrm/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 | 144 | /** |
2cbbebe8 | 145 | * ID of Grant status. |
e501603b | 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 | ||
2562d09a CW |
176 | /** |
177 | * Returns user-friendly description of this entity. | |
178 | * | |
179 | * @return string | |
180 | */ | |
181 | public static function getEntityDescription() { | |
182 | return ts('Funds applied for and given out by this organization.'); | |
183 | } | |
184 | ||
e501603b | 185 | /** |
f41f0342 | 186 | * Returns foreign keys and entity references. |
e501603b TO |
187 | * |
188 | * @return array | |
189 | * [CRM_Core_Reference_Interface] | |
190 | */ | |
c3fc2621 | 191 | public static function getReferenceColumns() { |
346aaaba | 192 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 193 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
194 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
195 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
346aaaba | 196 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 197 | } |
346aaaba | 198 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 199 | } |
c3fc2621 | 200 | |
e501603b TO |
201 | /** |
202 | * Returns all the column names of this table | |
203 | * | |
204 | * @return array | |
205 | */ | |
c3fc2621 | 206 | public static function &fields() { |
346aaaba | 207 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
208 | Civi::$statics[__CLASS__]['fields'] = [ |
209 | 'grant_id' => [ | |
e501603b TO |
210 | 'name' => 'id', |
211 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 212 | 'title' => ts('Grant ID'), |
215b423e | 213 | 'description' => ts('Unique Grant id'), |
c3fc2621 CW |
214 | 'required' => TRUE, |
215 | 'import' => TRUE, | |
e501603b | 216 | 'where' => 'civicrm_grant.id', |
c3fc2621 | 217 | 'export' => TRUE, |
522a26c9 | 218 | 'table_name' => 'civicrm_grant', |
219 | 'entity' => 'Grant', | |
220 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 221 | 'localizable' => 0, |
2cbbebe8 A |
222 | 'html' => [ |
223 | 'type' => 'Number', | |
224 | ], | |
1fe423d6 | 225 | 'readonly' => TRUE, |
a9d0587b | 226 | 'add' => '1.8', |
c3fc2621 CW |
227 | ], |
228 | 'grant_contact_id' => [ | |
e501603b TO |
229 | 'name' => 'contact_id', |
230 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 231 | 'title' => ts('Contact ID'), |
215b423e | 232 | 'description' => ts('Contact ID of contact record given grant belongs to.'), |
c3fc2621 | 233 | 'required' => TRUE, |
e501603b | 234 | 'where' => 'civicrm_grant.contact_id', |
a36434b9 | 235 | 'export' => TRUE, |
522a26c9 | 236 | 'table_name' => 'civicrm_grant', |
237 | 'entity' => 'Grant', | |
238 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 239 | 'localizable' => 0, |
e501603b | 240 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 241 | 'html' => [ |
e501603b | 242 | 'type' => 'EntityRef', |
2cbbebe8 | 243 | 'label' => ts("Contact"), |
c3fc2621 | 244 | ], |
a9d0587b | 245 | 'add' => '1.8', |
c3fc2621 | 246 | ], |
0bcac7e7 | 247 | 'grant_application_received_date' => [ |
e501603b TO |
248 | 'name' => 'application_received_date', |
249 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 250 | 'title' => ts('Application received date'), |
215b423e | 251 | 'description' => ts('Date on which grant application was received by donor.'), |
ae7f34ec | 252 | 'import' => TRUE, |
e501603b | 253 | 'where' => 'civicrm_grant.application_received_date', |
ae7f34ec | 254 | 'export' => TRUE, |
522a26c9 | 255 | 'table_name' => 'civicrm_grant', |
256 | 'entity' => 'Grant', | |
257 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 258 | 'localizable' => 0, |
ae7f34ec PN |
259 | 'html' => [ |
260 | 'type' => 'Select Date', | |
261 | 'formatType' => 'activityDate', | |
262 | ], | |
a9d0587b | 263 | 'add' => '1.8', |
c3fc2621 | 264 | ], |
0bcac7e7 | 265 | 'grant_decision_date' => [ |
e501603b TO |
266 | 'name' => 'decision_date', |
267 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 268 | 'title' => ts('Decision date'), |
215b423e | 269 | 'description' => ts('Date on which grant decision was made.'), |
c3fc2621 | 270 | 'import' => TRUE, |
e501603b | 271 | 'where' => 'civicrm_grant.decision_date', |
c3fc2621 | 272 | 'export' => TRUE, |
522a26c9 | 273 | 'table_name' => 'civicrm_grant', |
274 | 'entity' => 'Grant', | |
275 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 276 | 'localizable' => 0, |
c3fc2621 | 277 | 'html' => [ |
e501603b | 278 | 'type' => 'Select Date', |
ae7f34ec | 279 | 'formatType' => 'activityDate', |
c3fc2621 | 280 | ], |
a9d0587b | 281 | 'add' => '1.8', |
c3fc2621 CW |
282 | ], |
283 | 'grant_money_transfer_date' => [ | |
e501603b TO |
284 | 'name' => 'money_transfer_date', |
285 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 286 | 'title' => ts('Grant Money transfer date'), |
215b423e | 287 | 'description' => ts('Date on which grant money transfer was made.'), |
c3fc2621 | 288 | 'import' => TRUE, |
e501603b | 289 | 'where' => 'civicrm_grant.money_transfer_date', |
c3fc2621 | 290 | 'export' => TRUE, |
522a26c9 | 291 | 'table_name' => 'civicrm_grant', |
292 | 'entity' => 'Grant', | |
293 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 294 | 'localizable' => 0, |
c3fc2621 | 295 | 'html' => [ |
e501603b | 296 | 'type' => 'Select Date', |
ae7f34ec | 297 | 'formatType' => 'activityDate', |
c3fc2621 | 298 | ], |
a9d0587b | 299 | 'add' => '1.8', |
c3fc2621 CW |
300 | ], |
301 | 'grant_due_date' => [ | |
e501603b TO |
302 | 'name' => 'grant_due_date', |
303 | 'type' => CRM_Utils_Type::T_DATE, | |
0bcac7e7 | 304 | 'title' => ts('Grant Report Due Date'), |
215b423e | 305 | 'description' => ts('Date on which grant report is due.'), |
ae7f34ec PN |
306 | 'import' => TRUE, |
307 | 'where' => 'civicrm_grant.grant_due_date', | |
ae7f34ec | 308 | 'export' => TRUE, |
522a26c9 | 309 | 'table_name' => 'civicrm_grant', |
310 | 'entity' => 'Grant', | |
311 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 312 | 'localizable' => 0, |
c3fc2621 | 313 | 'html' => [ |
e501603b | 314 | 'type' => 'Select Date', |
ae7f34ec | 315 | 'formatType' => 'activityDate', |
c3fc2621 | 316 | ], |
a9d0587b | 317 | 'add' => '1.8', |
c3fc2621 CW |
318 | ], |
319 | 'grant_report_received' => [ | |
e501603b TO |
320 | 'name' => 'grant_report_received', |
321 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 322 | 'title' => ts('Grant report received'), |
215b423e | 323 | 'description' => ts('Yes/No field stating whether grant report was received by donor.'), |
c3fc2621 | 324 | 'import' => TRUE, |
e501603b | 325 | 'where' => 'civicrm_grant.grant_report_received', |
c3fc2621 | 326 | 'export' => TRUE, |
522a26c9 | 327 | 'table_name' => 'civicrm_grant', |
328 | 'entity' => 'Grant', | |
329 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 330 | 'localizable' => 0, |
c3fc2621 | 331 | 'html' => [ |
e501603b | 332 | 'type' => 'CheckBox', |
c3fc2621 | 333 | ], |
a9d0587b | 334 | 'add' => '1.8', |
c3fc2621 CW |
335 | ], |
336 | 'grant_type_id' => [ | |
e501603b TO |
337 | 'name' => 'grant_type_id', |
338 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 339 | 'title' => ts('Grant Type'), |
215b423e | 340 | 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'), |
c3fc2621 | 341 | 'required' => TRUE, |
e501603b | 342 | 'where' => 'civicrm_grant.grant_type_id', |
a36434b9 | 343 | 'export' => TRUE, |
522a26c9 | 344 | 'table_name' => 'civicrm_grant', |
345 | 'entity' => 'Grant', | |
346 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 347 | 'localizable' => 0, |
c3fc2621 | 348 | 'html' => [ |
e501603b | 349 | 'type' => 'Select', |
c3fc2621 CW |
350 | ], |
351 | 'pseudoconstant' => [ | |
e501603b TO |
352 | 'optionGroupName' => 'grant_type', |
353 | 'optionEditPath' => 'civicrm/admin/options/grant_type', | |
e6ca0a57 | 354 | ], |
a9d0587b | 355 | 'add' => '1.8', |
c3fc2621 CW |
356 | ], |
357 | 'amount_total' => [ | |
e501603b TO |
358 | 'name' => 'amount_total', |
359 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 360 | 'title' => ts('Total Amount'), |
215b423e | 361 | 'description' => ts('Requested grant amount, in default currency.'), |
c3fc2621 CW |
362 | 'required' => TRUE, |
363 | 'precision' => [ | |
e501603b | 364 | 20, |
fb607354 | 365 | 2, |
c3fc2621 CW |
366 | ], |
367 | 'import' => TRUE, | |
e501603b | 368 | 'where' => 'civicrm_grant.amount_total', |
e501603b | 369 | 'dataPattern' => '/^\d+(\.\d{2})?$/', |
c3fc2621 | 370 | 'export' => TRUE, |
522a26c9 | 371 | 'table_name' => 'civicrm_grant', |
372 | 'entity' => 'Grant', | |
373 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 374 | 'localizable' => 0, |
c3fc2621 | 375 | 'html' => [ |
e501603b | 376 | 'type' => 'Text', |
c3fc2621 | 377 | ], |
a9d0587b | 378 | 'add' => '1.8', |
c3fc2621 CW |
379 | ], |
380 | 'amount_requested' => [ | |
e501603b TO |
381 | 'name' => 'amount_requested', |
382 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 383 | 'title' => ts('Amount Requested'), |
215b423e | 384 | 'description' => ts('Requested grant amount, in original currency (optional).'), |
c3fc2621 | 385 | 'precision' => [ |
e501603b | 386 | 20, |
fb607354 | 387 | 2, |
c3fc2621 | 388 | ], |
a36434b9 | 389 | 'where' => 'civicrm_grant.amount_requested', |
390 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
522a26c9 | 391 | 'table_name' => 'civicrm_grant', |
392 | 'entity' => 'Grant', | |
393 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 394 | 'localizable' => 0, |
c3fc2621 | 395 | 'html' => [ |
e501603b | 396 | 'type' => 'Text', |
c3fc2621 | 397 | ], |
a9d0587b | 398 | 'add' => '1.8', |
c3fc2621 CW |
399 | ], |
400 | 'amount_granted' => [ | |
e501603b TO |
401 | 'name' => 'amount_granted', |
402 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 403 | 'title' => ts('Amount granted'), |
215b423e | 404 | 'description' => ts('Granted amount, in default currency.'), |
c3fc2621 | 405 | 'precision' => [ |
e501603b | 406 | 20, |
fb607354 | 407 | 2, |
c3fc2621 CW |
408 | ], |
409 | 'import' => TRUE, | |
e501603b | 410 | 'where' => 'civicrm_grant.amount_granted', |
e501603b | 411 | 'dataPattern' => '/^\d+(\.\d{2})?$/', |
c3fc2621 | 412 | 'export' => TRUE, |
522a26c9 | 413 | 'table_name' => 'civicrm_grant', |
414 | 'entity' => 'Grant', | |
415 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 416 | 'localizable' => 0, |
c3fc2621 | 417 | 'html' => [ |
e501603b | 418 | 'type' => 'Text', |
c3fc2621 | 419 | ], |
a9d0587b | 420 | 'add' => '1.8', |
c3fc2621 CW |
421 | ], |
422 | 'currency' => [ | |
e501603b TO |
423 | 'name' => 'currency', |
424 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 425 | 'title' => ts('Grant Currency'), |
215b423e | 426 | 'description' => ts('3 character string, value from config setting or input via user.'), |
c3fc2621 | 427 | 'required' => TRUE, |
e501603b TO |
428 | 'maxlength' => 3, |
429 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 430 | 'where' => 'civicrm_grant.currency', |
522a26c9 | 431 | 'table_name' => 'civicrm_grant', |
432 | 'entity' => 'Grant', | |
433 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 434 | 'localizable' => 0, |
c3fc2621 | 435 | 'html' => [ |
e501603b | 436 | 'type' => 'Select', |
c3fc2621 CW |
437 | ], |
438 | 'pseudoconstant' => [ | |
e501603b TO |
439 | 'table' => 'civicrm_currency', |
440 | 'keyColumn' => 'name', | |
441 | 'labelColumn' => 'full_name', | |
442 | 'nameColumn' => 'name', | |
a8fdb24e | 443 | 'abbrColumn' => 'symbol', |
e6ca0a57 | 444 | ], |
a9d0587b | 445 | 'add' => '3.2', |
c3fc2621 CW |
446 | ], |
447 | 'rationale' => [ | |
e501603b TO |
448 | 'name' => 'rationale', |
449 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 450 | 'title' => ts('Grant Rationale'), |
215b423e | 451 | 'description' => ts('Grant rationale.'), |
e501603b TO |
452 | 'rows' => 4, |
453 | 'cols' => 60, | |
c3fc2621 | 454 | 'import' => TRUE, |
e501603b | 455 | 'where' => 'civicrm_grant.rationale', |
c3fc2621 | 456 | 'export' => TRUE, |
522a26c9 | 457 | 'table_name' => 'civicrm_grant', |
458 | 'entity' => 'Grant', | |
459 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 460 | 'localizable' => 0, |
c3fc2621 | 461 | 'html' => [ |
e501603b | 462 | 'type' => 'TextArea', |
c3fc2621 | 463 | ], |
a9d0587b | 464 | 'add' => '1.8', |
c3fc2621 CW |
465 | ], |
466 | 'grant_status_id' => [ | |
e501603b TO |
467 | 'name' => 'status_id', |
468 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 469 | 'title' => ts('Grant Status'), |
2cbbebe8 | 470 | 'description' => ts('ID of Grant status.'), |
c3fc2621 CW |
471 | 'required' => TRUE, |
472 | 'import' => TRUE, | |
e501603b | 473 | 'where' => 'civicrm_grant.status_id', |
c3fc2621 | 474 | 'export' => FALSE, |
522a26c9 | 475 | 'table_name' => 'civicrm_grant', |
476 | 'entity' => 'Grant', | |
477 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 478 | 'localizable' => 0, |
c3fc2621 | 479 | 'html' => [ |
e501603b | 480 | 'type' => 'Select', |
c3fc2621 CW |
481 | ], |
482 | 'pseudoconstant' => [ | |
e501603b TO |
483 | 'optionGroupName' => 'grant_status', |
484 | 'optionEditPath' => 'civicrm/admin/options/grant_status', | |
e6ca0a57 | 485 | ], |
a9d0587b | 486 | 'add' => '1.8', |
c3fc2621 CW |
487 | ], |
488 | 'financial_type_id' => [ | |
e501603b TO |
489 | 'name' => 'financial_type_id', |
490 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 491 | 'title' => ts('Financial Type ID'), |
215b423e | 492 | 'description' => ts('FK to Financial Type.'), |
a36434b9 | 493 | 'where' => 'civicrm_grant.financial_type_id', |
5fb0de1f | 494 | 'default' => NULL, |
522a26c9 | 495 | 'table_name' => 'civicrm_grant', |
496 | 'entity' => 'Grant', | |
497 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 498 | 'localizable' => 0, |
e501603b | 499 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
2cbbebe8 A |
500 | 'html' => [ |
501 | 'label' => ts("Financial Type"), | |
502 | ], | |
c3fc2621 | 503 | 'pseudoconstant' => [ |
e501603b TO |
504 | 'table' => 'civicrm_financial_type', |
505 | 'keyColumn' => 'id', | |
506 | 'labelColumn' => 'name', | |
e6ca0a57 | 507 | ], |
a9d0587b | 508 | 'add' => '4.3', |
c3fc2621 CW |
509 | ], |
510 | ]; | |
346aaaba | 511 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 512 | } |
346aaaba | 513 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 514 | } |
c3fc2621 | 515 | |
e501603b | 516 | /** |
bd8e0b14 | 517 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
518 | * |
519 | * @return array | |
bd8e0b14 | 520 | * Array(string $name => string $uniqueName). |
e501603b | 521 | */ |
c3fc2621 | 522 | public static function &fieldKeys() { |
bd8e0b14 TO |
523 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
524 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 525 | } |
bd8e0b14 | 526 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 527 | } |
c3fc2621 | 528 | |
e501603b TO |
529 | /** |
530 | * Returns the names of this table | |
531 | * | |
532 | * @return string | |
533 | */ | |
c3fc2621 | 534 | public static function getTableName() { |
e501603b TO |
535 | return self::$_tableName; |
536 | } | |
c3fc2621 | 537 | |
e501603b TO |
538 | /** |
539 | * Returns if this table needs to be logged | |
540 | * | |
c3fc2621 | 541 | * @return bool |
e501603b | 542 | */ |
c3fc2621 | 543 | public function getLog() { |
e501603b TO |
544 | return self::$_log; |
545 | } | |
c3fc2621 | 546 | |
e501603b TO |
547 | /** |
548 | * Returns the list of fields that can be imported | |
549 | * | |
550 | * @param bool $prefix | |
551 | * | |
552 | * @return array | |
553 | */ | |
c3fc2621 CW |
554 | public static function &import($prefix = FALSE) { |
555 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, []); | |
60808919 | 556 | return $r; |
e501603b | 557 | } |
c3fc2621 | 558 | |
e501603b TO |
559 | /** |
560 | * Returns the list of fields that can be exported | |
561 | * | |
562 | * @param bool $prefix | |
563 | * | |
564 | * @return array | |
565 | */ | |
c3fc2621 CW |
566 | public static function &export($prefix = FALSE) { |
567 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, []); | |
60808919 | 568 | return $r; |
e501603b | 569 | } |
c3fc2621 | 570 | |
e7a6b91a AS |
571 | /** |
572 | * Returns the list of indices | |
c3fc2621 CW |
573 | * |
574 | * @param bool $localize | |
575 | * | |
576 | * @return array | |
e7a6b91a AS |
577 | */ |
578 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
579 | $indices = [ |
580 | 'index_grant_type_id' => [ | |
e7a6b91a | 581 | 'name' => 'index_grant_type_id', |
c3fc2621 | 582 | 'field' => [ |
e7a6b91a | 583 | 0 => 'grant_type_id', |
c3fc2621 CW |
584 | ], |
585 | 'localizable' => FALSE, | |
e7a6b91a | 586 | 'sig' => 'civicrm_grant::0::grant_type_id', |
c3fc2621 CW |
587 | ], |
588 | 'index_status_id' => [ | |
e7a6b91a | 589 | 'name' => 'index_status_id', |
c3fc2621 | 590 | 'field' => [ |
e7a6b91a | 591 | 0 => 'status_id', |
c3fc2621 CW |
592 | ], |
593 | 'localizable' => FALSE, | |
e7a6b91a | 594 | 'sig' => 'civicrm_grant::0::status_id', |
c3fc2621 CW |
595 | ], |
596 | ]; | |
e7a6b91a AS |
597 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
598 | } | |
c3fc2621 | 599 | |
e501603b | 600 | } |