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