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/Case/Case.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
17f78bae | 9 | * (GenCodeChecksum:02b3ed592b9c45f74b0d398c8cf25efd) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Case entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Case_DAO_Case extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_case'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Unique Case ID | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to civicrm_case_type.id | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $case_type_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Short name of the case. | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $subject; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Date on which given case starts. | |
54 | * | |
55 | * @var date | |
56 | */ | |
57 | public $start_date; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Date on which given case ends. | |
61 | * | |
62 | * @var date | |
63 | */ | |
64 | public $end_date; | |
c3fc2621 | 65 | |
e501603b | 66 | /** |
17f78bae | 67 | * Details populated from Open Case. Only used in the CiviCase extension. |
e501603b TO |
68 | * |
69 | * @var text | |
70 | */ | |
71 | public $details; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Id of case status. | |
75 | * | |
e6ca0a57 | 76 | * @var int |
e501603b TO |
77 | */ |
78 | public $status_id; | |
c3fc2621 | 79 | |
e501603b | 80 | /** |
e6ca0a57 | 81 | * @var bool |
e501603b TO |
82 | */ |
83 | public $is_deleted; | |
c3fc2621 | 84 | |
3ed77291 TO |
85 | /** |
86 | * When was the case was created. | |
87 | * | |
88 | * @var timestamp | |
89 | */ | |
90 | public $created_date; | |
c3fc2621 | 91 | |
3ed77291 TO |
92 | /** |
93 | * When was the case (or closely related entity) was created or modified or deleted. | |
94 | * | |
95 | * @var timestamp | |
96 | */ | |
97 | public $modified_date; | |
c3fc2621 | 98 | |
e501603b | 99 | /** |
f41f0342 | 100 | * Class constructor. |
e501603b | 101 | */ |
c3fc2621 | 102 | public function __construct() { |
e501603b TO |
103 | $this->__table = 'civicrm_case'; |
104 | parent::__construct(); | |
105 | } | |
c3fc2621 | 106 | |
e501603b | 107 | /** |
f41f0342 | 108 | * Returns foreign keys and entity references. |
e501603b TO |
109 | * |
110 | * @return array | |
111 | * [CRM_Core_Reference_Interface] | |
112 | */ | |
c3fc2621 | 113 | public static function getReferenceColumns() { |
346aaaba | 114 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 115 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 116 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_type_id', 'civicrm_case_type', 'id'); |
346aaaba | 117 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 118 | } |
346aaaba | 119 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 120 | } |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Returns all the column names of this table | |
124 | * | |
125 | * @return array | |
126 | */ | |
c3fc2621 | 127 | public static function &fields() { |
346aaaba | 128 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
129 | Civi::$statics[__CLASS__]['fields'] = [ |
130 | 'case_id' => [ | |
e501603b TO |
131 | 'name' => 'id', |
132 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 133 | 'title' => ts('Case ID'), |
215b423e | 134 | 'description' => ts('Unique Case ID'), |
c3fc2621 CW |
135 | 'required' => TRUE, |
136 | 'import' => TRUE, | |
e501603b | 137 | 'where' => 'civicrm_case.id', |
c3fc2621 | 138 | 'export' => TRUE, |
522a26c9 | 139 | 'table_name' => 'civicrm_case', |
140 | 'entity' => 'Case', | |
141 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 142 | 'localizable' => 0, |
b62aa188 MD |
143 | 'html' => [ |
144 | 'type' => 'Text', | |
145 | ], | |
c3fc2621 CW |
146 | ], |
147 | 'case_type_id' => [ | |
e501603b TO |
148 | 'name' => 'case_type_id', |
149 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 150 | 'title' => ts('Case Type'), |
215b423e | 151 | 'description' => ts('FK to civicrm_case_type.id'), |
c3fc2621 CW |
152 | 'required' => TRUE, |
153 | 'import' => TRUE, | |
e501603b | 154 | 'where' => 'civicrm_case.case_type_id', |
c3fc2621 | 155 | 'export' => FALSE, |
522a26c9 | 156 | 'table_name' => 'civicrm_case', |
157 | 'entity' => 'Case', | |
158 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 159 | 'localizable' => 0, |
e501603b | 160 | 'FKClassName' => 'CRM_Case_DAO_CaseType', |
c3fc2621 | 161 | 'html' => [ |
e501603b | 162 | 'type' => 'Select', |
c3fc2621 CW |
163 | ], |
164 | 'pseudoconstant' => [ | |
e501603b TO |
165 | 'table' => 'civicrm_case_type', |
166 | 'keyColumn' => 'id', | |
167 | 'labelColumn' => 'title', | |
e6ca0a57 | 168 | ], |
c3fc2621 CW |
169 | ], |
170 | 'case_subject' => [ | |
e501603b TO |
171 | 'name' => 'subject', |
172 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 173 | 'title' => ts('Case Subject'), |
215b423e | 174 | 'description' => ts('Short name of the case.'), |
e501603b TO |
175 | 'maxlength' => 128, |
176 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 177 | 'import' => TRUE, |
e501603b | 178 | 'where' => 'civicrm_case.subject', |
c3fc2621 | 179 | 'export' => TRUE, |
522a26c9 | 180 | 'table_name' => 'civicrm_case', |
181 | 'entity' => 'Case', | |
182 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 183 | 'localizable' => 0, |
c3fc2621 | 184 | 'html' => [ |
e501603b | 185 | 'type' => 'Text', |
c3fc2621 CW |
186 | ], |
187 | ], | |
188 | 'case_start_date' => [ | |
e501603b TO |
189 | 'name' => 'start_date', |
190 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 191 | 'title' => ts('Case Start Date'), |
215b423e | 192 | 'description' => ts('Date on which given case starts.'), |
c3fc2621 | 193 | 'import' => TRUE, |
e501603b | 194 | 'where' => 'civicrm_case.start_date', |
c3fc2621 | 195 | 'export' => TRUE, |
522a26c9 | 196 | 'table_name' => 'civicrm_case', |
197 | 'entity' => 'Case', | |
198 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 199 | 'localizable' => 0, |
c3fc2621 | 200 | 'html' => [ |
e501603b | 201 | 'type' => 'Select Date', |
e0d4ddde | 202 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
203 | ], |
204 | ], | |
205 | 'case_end_date' => [ | |
e501603b TO |
206 | 'name' => 'end_date', |
207 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 208 | 'title' => ts('Case End Date'), |
215b423e | 209 | 'description' => ts('Date on which given case ends.'), |
c3fc2621 | 210 | 'import' => TRUE, |
e501603b | 211 | 'where' => 'civicrm_case.end_date', |
c3fc2621 | 212 | 'export' => TRUE, |
522a26c9 | 213 | 'table_name' => 'civicrm_case', |
214 | 'entity' => 'Case', | |
215 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 216 | 'localizable' => 0, |
c3fc2621 | 217 | 'html' => [ |
e501603b | 218 | 'type' => 'Select Date', |
e0d4ddde | 219 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
220 | ], |
221 | ], | |
222 | 'details' => [ | |
e501603b TO |
223 | 'name' => 'details', |
224 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 225 | 'title' => ts('Details'), |
17f78bae | 226 | 'description' => ts('Details populated from Open Case. Only used in the CiviCase extension.'), |
e501603b TO |
227 | 'rows' => 8, |
228 | 'cols' => 60, | |
a36434b9 | 229 | 'where' => 'civicrm_case.details', |
522a26c9 | 230 | 'table_name' => 'civicrm_case', |
231 | 'entity' => 'Case', | |
232 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 233 | 'localizable' => 0, |
c3fc2621 | 234 | 'html' => [ |
e501603b | 235 | 'type' => 'TextArea', |
c3fc2621 CW |
236 | ], |
237 | ], | |
238 | 'case_status_id' => [ | |
e501603b TO |
239 | 'name' => 'status_id', |
240 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 241 | 'title' => ts('Case Status'), |
215b423e | 242 | 'description' => ts('Id of case status.'), |
c3fc2621 CW |
243 | 'required' => TRUE, |
244 | 'import' => TRUE, | |
e501603b | 245 | 'where' => 'civicrm_case.status_id', |
c3fc2621 | 246 | 'export' => FALSE, |
522a26c9 | 247 | 'table_name' => 'civicrm_case', |
248 | 'entity' => 'Case', | |
249 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 250 | 'localizable' => 0, |
c3fc2621 | 251 | 'html' => [ |
e501603b | 252 | 'type' => 'Select', |
c3fc2621 CW |
253 | ], |
254 | 'pseudoconstant' => [ | |
e501603b TO |
255 | 'optionGroupName' => 'case_status', |
256 | 'optionEditPath' => 'civicrm/admin/options/case_status', | |
e6ca0a57 | 257 | ], |
c3fc2621 CW |
258 | ], |
259 | 'case_deleted' => [ | |
e501603b TO |
260 | 'name' => 'is_deleted', |
261 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
262 | 'title' => ts('Case is in the Trash'), |
263 | 'import' => TRUE, | |
e501603b | 264 | 'where' => 'civicrm_case.is_deleted', |
c3fc2621 | 265 | 'export' => TRUE, |
45a83e42 | 266 | 'default' => '0', |
522a26c9 | 267 | 'table_name' => 'civicrm_case', |
268 | 'entity' => 'Case', | |
269 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 270 | 'localizable' => 0, |
b62aa188 MD |
271 | 'html' => [ |
272 | 'type' => 'CheckBox', | |
273 | ], | |
c3fc2621 CW |
274 | ], |
275 | 'case_created_date' => [ | |
3ed77291 TO |
276 | 'name' => 'created_date', |
277 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 278 | 'title' => ts('Created Date'), |
215b423e | 279 | 'description' => ts('When was the case was created.'), |
c3fc2621 | 280 | 'required' => FALSE, |
3ed77291 | 281 | 'where' => 'civicrm_case.created_date', |
a36434b9 | 282 | 'export' => TRUE, |
3ed77291 TO |
283 | 'default' => 'NULL', |
284 | 'table_name' => 'civicrm_case', | |
285 | 'entity' => 'Case', | |
286 | 'bao' => 'CRM_Case_BAO_Case', | |
287 | 'localizable' => 0, | |
c3fc2621 CW |
288 | ], |
289 | 'case_modified_date' => [ | |
3ed77291 TO |
290 | 'name' => 'modified_date', |
291 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 292 | 'title' => ts('Modified Date'), |
215b423e | 293 | 'description' => ts('When was the case (or closely related entity) was created or modified or deleted.'), |
c3fc2621 | 294 | 'required' => FALSE, |
3ed77291 | 295 | 'where' => 'civicrm_case.modified_date', |
a36434b9 | 296 | 'export' => TRUE, |
3ed77291 TO |
297 | 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', |
298 | 'table_name' => 'civicrm_case', | |
299 | 'entity' => 'Case', | |
300 | 'bao' => 'CRM_Case_BAO_Case', | |
301 | 'localizable' => 0, | |
c3fc2621 CW |
302 | ], |
303 | ]; | |
346aaaba | 304 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 305 | } |
346aaaba | 306 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 307 | } |
c3fc2621 | 308 | |
e501603b | 309 | /** |
bd8e0b14 | 310 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
311 | * |
312 | * @return array | |
bd8e0b14 | 313 | * Array(string $name => string $uniqueName). |
e501603b | 314 | */ |
c3fc2621 | 315 | public static function &fieldKeys() { |
bd8e0b14 TO |
316 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
317 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 318 | } |
bd8e0b14 | 319 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 320 | } |
c3fc2621 | 321 | |
e501603b TO |
322 | /** |
323 | * Returns the names of this table | |
324 | * | |
325 | * @return string | |
326 | */ | |
c3fc2621 | 327 | public static function getTableName() { |
e501603b TO |
328 | return self::$_tableName; |
329 | } | |
c3fc2621 | 330 | |
e501603b TO |
331 | /** |
332 | * Returns if this table needs to be logged | |
333 | * | |
c3fc2621 | 334 | * @return bool |
e501603b | 335 | */ |
c3fc2621 | 336 | public function getLog() { |
e501603b TO |
337 | return self::$_log; |
338 | } | |
c3fc2621 | 339 | |
e501603b TO |
340 | /** |
341 | * Returns the list of fields that can be imported | |
342 | * | |
343 | * @param bool $prefix | |
344 | * | |
345 | * @return array | |
346 | */ | |
c3fc2621 CW |
347 | public static function &import($prefix = FALSE) { |
348 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, []); | |
60808919 | 349 | return $r; |
e501603b | 350 | } |
c3fc2621 | 351 | |
e501603b TO |
352 | /** |
353 | * Returns the list of fields that can be exported | |
354 | * | |
355 | * @param bool $prefix | |
356 | * | |
357 | * @return array | |
358 | */ | |
c3fc2621 CW |
359 | public static function &export($prefix = FALSE) { |
360 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, []); | |
60808919 | 361 | return $r; |
e501603b | 362 | } |
c3fc2621 | 363 | |
e7a6b91a AS |
364 | /** |
365 | * Returns the list of indices | |
c3fc2621 CW |
366 | * |
367 | * @param bool $localize | |
368 | * | |
369 | * @return array | |
e7a6b91a AS |
370 | */ |
371 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
372 | $indices = [ |
373 | 'index_case_type_id' => [ | |
e7a6b91a | 374 | 'name' => 'index_case_type_id', |
c3fc2621 | 375 | 'field' => [ |
e7a6b91a | 376 | 0 => 'case_type_id', |
c3fc2621 CW |
377 | ], |
378 | 'localizable' => FALSE, | |
e7a6b91a | 379 | 'sig' => 'civicrm_case::0::case_type_id', |
c3fc2621 CW |
380 | ], |
381 | 'index_is_deleted' => [ | |
e7a6b91a | 382 | 'name' => 'index_is_deleted', |
c3fc2621 | 383 | 'field' => [ |
e7a6b91a | 384 | 0 => 'is_deleted', |
c3fc2621 CW |
385 | ], |
386 | 'localizable' => FALSE, | |
e7a6b91a | 387 | 'sig' => 'civicrm_case::0::is_deleted', |
c3fc2621 CW |
388 | ], |
389 | ]; | |
e7a6b91a AS |
390 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
391 | } | |
c3fc2621 | 392 | |
e501603b | 393 | } |