Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Case/Case.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
3ed77291 | 9 | * (GenCodeChecksum:2a046fd795b19790f45c5d9dde06a538) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Unique Case ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to civicrm_case_type.id | |
40 | * | |
41 | * @var int unsigned | |
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 TO |
66 | /** |
67 | * Details about the meeting (agenda, notes, etc). | |
68 | * | |
69 | * @var text | |
70 | */ | |
71 | public $details; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Id of case status. | |
75 | * | |
76 | * @var int unsigned | |
77 | */ | |
78 | public $status_id; | |
c3fc2621 | 79 | |
e501603b | 80 | /** |
e501603b TO |
81 | * @var boolean |
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 TO |
114 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
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 TO |
137 | 'where' => 'civicrm_case.id', |
138 | 'headerPattern' => '', | |
139 | 'dataPattern' => '', | |
c3fc2621 | 140 | 'export' => TRUE, |
522a26c9 | 141 | 'table_name' => 'civicrm_case', |
142 | 'entity' => 'Case', | |
143 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 144 | 'localizable' => 0, |
c3fc2621 CW |
145 | ], |
146 | 'case_type_id' => [ | |
e501603b TO |
147 | 'name' => 'case_type_id', |
148 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 149 | 'title' => ts('Case Type'), |
215b423e | 150 | 'description' => ts('FK to civicrm_case_type.id'), |
c3fc2621 CW |
151 | 'required' => TRUE, |
152 | 'import' => TRUE, | |
e501603b TO |
153 | 'where' => 'civicrm_case.case_type_id', |
154 | 'headerPattern' => '', | |
155 | 'dataPattern' => '', | |
c3fc2621 | 156 | 'export' => FALSE, |
522a26c9 | 157 | 'table_name' => 'civicrm_case', |
158 | 'entity' => 'Case', | |
159 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 160 | 'localizable' => 0, |
e501603b | 161 | 'FKClassName' => 'CRM_Case_DAO_CaseType', |
c3fc2621 | 162 | 'html' => [ |
e501603b | 163 | 'type' => 'Select', |
c3fc2621 CW |
164 | ], |
165 | 'pseudoconstant' => [ | |
e501603b TO |
166 | 'table' => 'civicrm_case_type', |
167 | 'keyColumn' => 'id', | |
168 | 'labelColumn' => 'title', | |
c3fc2621 CW |
169 | ] |
170 | ], | |
171 | 'case_subject' => [ | |
e501603b TO |
172 | 'name' => 'subject', |
173 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 174 | 'title' => ts('Case Subject'), |
215b423e | 175 | 'description' => ts('Short name of the case.'), |
e501603b TO |
176 | 'maxlength' => 128, |
177 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 178 | 'import' => TRUE, |
e501603b TO |
179 | 'where' => 'civicrm_case.subject', |
180 | 'headerPattern' => '', | |
181 | 'dataPattern' => '', | |
c3fc2621 | 182 | 'export' => TRUE, |
522a26c9 | 183 | 'table_name' => 'civicrm_case', |
184 | 'entity' => 'Case', | |
185 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 186 | 'localizable' => 0, |
c3fc2621 | 187 | 'html' => [ |
e501603b | 188 | 'type' => 'Text', |
c3fc2621 CW |
189 | ], |
190 | ], | |
191 | 'case_start_date' => [ | |
e501603b TO |
192 | 'name' => 'start_date', |
193 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 194 | 'title' => ts('Case Start Date'), |
215b423e | 195 | 'description' => ts('Date on which given case starts.'), |
c3fc2621 | 196 | 'import' => TRUE, |
e501603b TO |
197 | 'where' => 'civicrm_case.start_date', |
198 | 'headerPattern' => '', | |
199 | 'dataPattern' => '', | |
c3fc2621 | 200 | 'export' => TRUE, |
522a26c9 | 201 | 'table_name' => 'civicrm_case', |
202 | 'entity' => 'Case', | |
203 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 204 | 'localizable' => 0, |
c3fc2621 | 205 | 'html' => [ |
e501603b | 206 | 'type' => 'Select Date', |
c3fc2621 CW |
207 | ], |
208 | ], | |
209 | 'case_end_date' => [ | |
e501603b TO |
210 | 'name' => 'end_date', |
211 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 212 | 'title' => ts('Case End Date'), |
215b423e | 213 | 'description' => ts('Date on which given case ends.'), |
c3fc2621 | 214 | 'import' => TRUE, |
e501603b TO |
215 | 'where' => 'civicrm_case.end_date', |
216 | 'headerPattern' => '', | |
217 | 'dataPattern' => '', | |
c3fc2621 | 218 | 'export' => TRUE, |
522a26c9 | 219 | 'table_name' => 'civicrm_case', |
220 | 'entity' => 'Case', | |
221 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 222 | 'localizable' => 0, |
c3fc2621 | 223 | 'html' => [ |
e501603b | 224 | 'type' => 'Select Date', |
c3fc2621 CW |
225 | ], |
226 | ], | |
227 | 'details' => [ | |
e501603b TO |
228 | 'name' => 'details', |
229 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 230 | 'title' => ts('Details'), |
215b423e | 231 | 'description' => ts('Details about the meeting (agenda, notes, etc).'), |
e501603b TO |
232 | 'rows' => 8, |
233 | 'cols' => 60, | |
522a26c9 | 234 | 'table_name' => 'civicrm_case', |
235 | 'entity' => 'Case', | |
236 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 237 | 'localizable' => 0, |
c3fc2621 | 238 | 'html' => [ |
e501603b | 239 | 'type' => 'TextArea', |
c3fc2621 CW |
240 | ], |
241 | ], | |
242 | 'case_status_id' => [ | |
e501603b TO |
243 | 'name' => 'status_id', |
244 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 245 | 'title' => ts('Case Status'), |
215b423e | 246 | 'description' => ts('Id of case status.'), |
c3fc2621 CW |
247 | 'required' => TRUE, |
248 | 'import' => TRUE, | |
e501603b TO |
249 | 'where' => 'civicrm_case.status_id', |
250 | 'headerPattern' => '', | |
251 | 'dataPattern' => '', | |
c3fc2621 | 252 | 'export' => FALSE, |
522a26c9 | 253 | 'table_name' => 'civicrm_case', |
254 | 'entity' => 'Case', | |
255 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 256 | 'localizable' => 0, |
c3fc2621 | 257 | 'html' => [ |
e501603b | 258 | 'type' => 'Select', |
c3fc2621 CW |
259 | ], |
260 | 'pseudoconstant' => [ | |
e501603b TO |
261 | 'optionGroupName' => 'case_status', |
262 | 'optionEditPath' => 'civicrm/admin/options/case_status', | |
c3fc2621 CW |
263 | ] |
264 | ], | |
265 | 'case_deleted' => [ | |
e501603b TO |
266 | 'name' => 'is_deleted', |
267 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
268 | 'title' => ts('Case is in the Trash'), |
269 | 'import' => TRUE, | |
e501603b TO |
270 | 'where' => 'civicrm_case.is_deleted', |
271 | 'headerPattern' => '', | |
272 | 'dataPattern' => '', | |
c3fc2621 | 273 | 'export' => TRUE, |
45a83e42 | 274 | 'default' => '0', |
522a26c9 | 275 | 'table_name' => 'civicrm_case', |
276 | 'entity' => 'Case', | |
277 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 278 | 'localizable' => 0, |
c3fc2621 CW |
279 | ], |
280 | 'case_created_date' => [ | |
3ed77291 TO |
281 | 'name' => 'created_date', |
282 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 283 | 'title' => ts('Created Date'), |
215b423e | 284 | 'description' => ts('When was the case was created.'), |
c3fc2621 CW |
285 | 'required' => FALSE, |
286 | 'export' => TRUE, | |
3ed77291 TO |
287 | 'where' => 'civicrm_case.created_date', |
288 | 'headerPattern' => '', | |
289 | 'dataPattern' => '', | |
290 | 'default' => 'NULL', | |
291 | 'table_name' => 'civicrm_case', | |
292 | 'entity' => 'Case', | |
293 | 'bao' => 'CRM_Case_BAO_Case', | |
294 | 'localizable' => 0, | |
c3fc2621 CW |
295 | ], |
296 | 'case_modified_date' => [ | |
3ed77291 TO |
297 | 'name' => 'modified_date', |
298 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 299 | 'title' => ts('Modified Date'), |
215b423e | 300 | 'description' => ts('When was the case (or closely related entity) was created or modified or deleted.'), |
c3fc2621 CW |
301 | 'required' => FALSE, |
302 | 'export' => TRUE, | |
3ed77291 TO |
303 | 'where' => 'civicrm_case.modified_date', |
304 | 'headerPattern' => '', | |
305 | 'dataPattern' => '', | |
306 | 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', | |
307 | 'table_name' => 'civicrm_case', | |
308 | 'entity' => 'Case', | |
309 | 'bao' => 'CRM_Case_BAO_Case', | |
310 | 'localizable' => 0, | |
c3fc2621 CW |
311 | ], |
312 | ]; | |
346aaaba | 313 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 314 | } |
346aaaba | 315 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 316 | } |
c3fc2621 | 317 | |
e501603b | 318 | /** |
bd8e0b14 | 319 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
320 | * |
321 | * @return array | |
bd8e0b14 | 322 | * Array(string $name => string $uniqueName). |
e501603b | 323 | */ |
c3fc2621 | 324 | public static function &fieldKeys() { |
bd8e0b14 TO |
325 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
326 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 327 | } |
bd8e0b14 | 328 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 329 | } |
c3fc2621 | 330 | |
e501603b TO |
331 | /** |
332 | * Returns the names of this table | |
333 | * | |
334 | * @return string | |
335 | */ | |
c3fc2621 | 336 | public static function getTableName() { |
e501603b TO |
337 | return self::$_tableName; |
338 | } | |
c3fc2621 | 339 | |
e501603b TO |
340 | /** |
341 | * Returns if this table needs to be logged | |
342 | * | |
c3fc2621 | 343 | * @return bool |
e501603b | 344 | */ |
c3fc2621 | 345 | public function getLog() { |
e501603b TO |
346 | return self::$_log; |
347 | } | |
c3fc2621 | 348 | |
e501603b TO |
349 | /** |
350 | * Returns the list of fields that can be imported | |
351 | * | |
352 | * @param bool $prefix | |
353 | * | |
354 | * @return array | |
355 | */ | |
c3fc2621 CW |
356 | public static function &import($prefix = FALSE) { |
357 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, []); | |
60808919 | 358 | return $r; |
e501603b | 359 | } |
c3fc2621 | 360 | |
e501603b TO |
361 | /** |
362 | * Returns the list of fields that can be exported | |
363 | * | |
364 | * @param bool $prefix | |
365 | * | |
366 | * @return array | |
367 | */ | |
c3fc2621 CW |
368 | public static function &export($prefix = FALSE) { |
369 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, []); | |
60808919 | 370 | return $r; |
e501603b | 371 | } |
c3fc2621 | 372 | |
e7a6b91a AS |
373 | /** |
374 | * Returns the list of indices | |
c3fc2621 CW |
375 | * |
376 | * @param bool $localize | |
377 | * | |
378 | * @return array | |
e7a6b91a AS |
379 | */ |
380 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
381 | $indices = [ |
382 | 'index_case_type_id' => [ | |
e7a6b91a | 383 | 'name' => 'index_case_type_id', |
c3fc2621 | 384 | 'field' => [ |
e7a6b91a | 385 | 0 => 'case_type_id', |
c3fc2621 CW |
386 | ], |
387 | 'localizable' => FALSE, | |
e7a6b91a | 388 | 'sig' => 'civicrm_case::0::case_type_id', |
c3fc2621 CW |
389 | ], |
390 | 'index_is_deleted' => [ | |
e7a6b91a | 391 | 'name' => 'index_is_deleted', |
c3fc2621 | 392 | 'field' => [ |
e7a6b91a | 393 | 0 => 'is_deleted', |
c3fc2621 CW |
394 | ], |
395 | 'localizable' => FALSE, | |
e7a6b91a | 396 | 'sig' => 'civicrm_case::0::is_deleted', |
c3fc2621 CW |
397 | ], |
398 | ]; | |
e7a6b91a AS |
399 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
400 | } | |
c3fc2621 | 401 | |
e501603b | 402 | } |