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 | |
e7a6b91a | 33 | * (GenCodeChecksum:e45e7e2a53a945c4659cf393410a9d7a) |
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; | |
100 | /** | |
f41f0342 | 101 | * Class constructor. |
e501603b TO |
102 | */ |
103 | function __construct() { | |
104 | $this->__table = 'civicrm_case'; | |
105 | parent::__construct(); | |
106 | } | |
107 | /** | |
f41f0342 | 108 | * Returns foreign keys and entity references. |
e501603b TO |
109 | * |
110 | * @return array | |
111 | * [CRM_Core_Reference_Interface] | |
112 | */ | |
113 | static function getReferenceColumns() { | |
346aaaba TO |
114 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
115 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
116 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_type_id', 'civicrm_case_type', 'id'); | |
117 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 118 | } |
346aaaba | 119 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
120 | } |
121 | /** | |
122 | * Returns all the column names of this table | |
123 | * | |
124 | * @return array | |
125 | */ | |
126 | static function &fields() { | |
346aaaba TO |
127 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
128 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
129 | 'case_id' => array( |
130 | 'name' => 'id', | |
131 | 'type' => CRM_Utils_Type::T_INT, | |
132 | 'title' => ts('Case ID') , | |
133 | 'description' => 'Unique Case ID', | |
134 | 'required' => true, | |
135 | 'import' => true, | |
136 | 'where' => 'civicrm_case.id', | |
137 | 'headerPattern' => '', | |
138 | 'dataPattern' => '', | |
139 | 'export' => true, | |
522a26c9 | 140 | 'table_name' => 'civicrm_case', |
141 | 'entity' => 'Case', | |
142 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 143 | 'localizable' => 0, |
e501603b TO |
144 | ) , |
145 | 'case_type_id' => array( | |
146 | 'name' => 'case_type_id', | |
147 | 'type' => CRM_Utils_Type::T_INT, | |
148 | 'title' => ts('Case Type') , | |
149 | 'description' => 'FK to civicrm_case_type.id', | |
60a5e820 | 150 | 'required' => true, |
e501603b TO |
151 | 'import' => true, |
152 | 'where' => 'civicrm_case.case_type_id', | |
153 | 'headerPattern' => '', | |
154 | 'dataPattern' => '', | |
155 | 'export' => false, | |
522a26c9 | 156 | 'table_name' => 'civicrm_case', |
157 | 'entity' => 'Case', | |
158 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 159 | 'localizable' => 0, |
e501603b TO |
160 | 'FKClassName' => 'CRM_Case_DAO_CaseType', |
161 | 'html' => array( | |
162 | 'type' => 'Select', | |
163 | ) , | |
164 | 'pseudoconstant' => array( | |
165 | 'table' => 'civicrm_case_type', | |
166 | 'keyColumn' => 'id', | |
167 | 'labelColumn' => 'title', | |
168 | ) | |
169 | ) , | |
170 | 'case_subject' => array( | |
171 | 'name' => 'subject', | |
172 | 'type' => CRM_Utils_Type::T_STRING, | |
173 | 'title' => ts('Case Subject') , | |
174 | 'description' => 'Short name of the case.', | |
175 | 'maxlength' => 128, | |
176 | 'size' => CRM_Utils_Type::HUGE, | |
177 | 'import' => true, | |
178 | 'where' => 'civicrm_case.subject', | |
179 | 'headerPattern' => '', | |
180 | 'dataPattern' => '', | |
181 | 'export' => true, | |
522a26c9 | 182 | 'table_name' => 'civicrm_case', |
183 | 'entity' => 'Case', | |
184 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 185 | 'localizable' => 0, |
e501603b TO |
186 | 'html' => array( |
187 | 'type' => 'Text', | |
188 | ) , | |
189 | ) , | |
190 | 'case_start_date' => array( | |
191 | 'name' => 'start_date', | |
192 | 'type' => CRM_Utils_Type::T_DATE, | |
193 | 'title' => ts('Case Start Date') , | |
194 | 'description' => 'Date on which given case starts.', | |
195 | 'import' => true, | |
196 | 'where' => 'civicrm_case.start_date', | |
197 | 'headerPattern' => '', | |
198 | 'dataPattern' => '', | |
199 | 'export' => true, | |
522a26c9 | 200 | 'table_name' => 'civicrm_case', |
201 | 'entity' => 'Case', | |
202 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 203 | 'localizable' => 0, |
e501603b TO |
204 | 'html' => array( |
205 | 'type' => 'Select Date', | |
206 | ) , | |
207 | ) , | |
208 | 'case_end_date' => array( | |
209 | 'name' => 'end_date', | |
210 | 'type' => CRM_Utils_Type::T_DATE, | |
211 | 'title' => ts('Case End Date') , | |
212 | 'description' => 'Date on which given case ends.', | |
213 | 'import' => true, | |
214 | 'where' => 'civicrm_case.end_date', | |
215 | 'headerPattern' => '', | |
216 | 'dataPattern' => '', | |
217 | 'export' => true, | |
522a26c9 | 218 | 'table_name' => 'civicrm_case', |
219 | 'entity' => 'Case', | |
220 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 221 | 'localizable' => 0, |
e501603b TO |
222 | 'html' => array( |
223 | 'type' => 'Select Date', | |
224 | ) , | |
225 | ) , | |
226 | 'details' => array( | |
227 | 'name' => 'details', | |
228 | 'type' => CRM_Utils_Type::T_TEXT, | |
229 | 'title' => ts('Details') , | |
230 | 'description' => 'Details about the meeting (agenda, notes, etc).', | |
231 | 'rows' => 8, | |
232 | 'cols' => 60, | |
522a26c9 | 233 | 'table_name' => 'civicrm_case', |
234 | 'entity' => 'Case', | |
235 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 236 | 'localizable' => 0, |
e501603b TO |
237 | 'html' => array( |
238 | 'type' => 'TextArea', | |
239 | ) , | |
240 | ) , | |
241 | 'case_status_id' => array( | |
242 | 'name' => 'status_id', | |
243 | 'type' => CRM_Utils_Type::T_INT, | |
244 | 'title' => ts('Case Status') , | |
245 | 'description' => 'Id of case status.', | |
246 | 'required' => true, | |
247 | 'import' => true, | |
248 | 'where' => 'civicrm_case.status_id', | |
249 | 'headerPattern' => '', | |
250 | 'dataPattern' => '', | |
251 | 'export' => false, | |
522a26c9 | 252 | 'table_name' => 'civicrm_case', |
253 | 'entity' => 'Case', | |
254 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 255 | 'localizable' => 0, |
e501603b TO |
256 | 'html' => array( |
257 | 'type' => 'Select', | |
258 | ) , | |
259 | 'pseudoconstant' => array( | |
260 | 'optionGroupName' => 'case_status', | |
261 | 'optionEditPath' => 'civicrm/admin/options/case_status', | |
262 | ) | |
263 | ) , | |
264 | 'case_deleted' => array( | |
265 | 'name' => 'is_deleted', | |
266 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
267 | 'title' => ts('Case is in the Trash') , | |
268 | 'import' => true, | |
269 | 'where' => 'civicrm_case.is_deleted', | |
270 | 'headerPattern' => '', | |
271 | 'dataPattern' => '', | |
272 | 'export' => true, | |
522a26c9 | 273 | 'table_name' => 'civicrm_case', |
274 | 'entity' => 'Case', | |
275 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 276 | 'localizable' => 0, |
e501603b TO |
277 | ) , |
278 | ); | |
346aaaba | 279 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 280 | } |
346aaaba | 281 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
282 | } |
283 | /** | |
bd8e0b14 | 284 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
285 | * |
286 | * @return array | |
bd8e0b14 | 287 | * Array(string $name => string $uniqueName). |
e501603b TO |
288 | */ |
289 | static function &fieldKeys() { | |
bd8e0b14 TO |
290 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
291 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 292 | } |
bd8e0b14 | 293 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
294 | } |
295 | /** | |
296 | * Returns the names of this table | |
297 | * | |
298 | * @return string | |
299 | */ | |
300 | static function getTableName() { | |
301 | return self::$_tableName; | |
302 | } | |
303 | /** | |
304 | * Returns if this table needs to be logged | |
305 | * | |
306 | * @return boolean | |
307 | */ | |
308 | function getLog() { | |
309 | return self::$_log; | |
310 | } | |
311 | /** | |
312 | * Returns the list of fields that can be imported | |
313 | * | |
314 | * @param bool $prefix | |
315 | * | |
316 | * @return array | |
317 | */ | |
318 | static function &import($prefix = false) { | |
60808919 TO |
319 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, array()); |
320 | return $r; | |
e501603b TO |
321 | } |
322 | /** | |
323 | * Returns the list of fields that can be exported | |
324 | * | |
325 | * @param bool $prefix | |
326 | * | |
327 | * @return array | |
328 | */ | |
329 | static function &export($prefix = false) { | |
60808919 TO |
330 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, array()); |
331 | return $r; | |
e501603b | 332 | } |
e7a6b91a AS |
333 | /** |
334 | * Returns the list of indices | |
335 | */ | |
336 | public static function indices($localize = TRUE) { | |
337 | $indices = array( | |
338 | 'index_case_type_id' => array( | |
339 | 'name' => 'index_case_type_id', | |
340 | 'field' => array( | |
341 | 0 => 'case_type_id', | |
342 | ) , | |
343 | 'localizable' => false, | |
344 | 'sig' => 'civicrm_case::0::case_type_id', | |
345 | ) , | |
346 | 'index_is_deleted' => array( | |
347 | 'name' => 'index_is_deleted', | |
348 | 'field' => array( | |
349 | 0 => 'is_deleted', | |
350 | ) , | |
351 | 'localizable' => false, | |
352 | 'sig' => 'civicrm_case::0::is_deleted', | |
353 | ) , | |
354 | ); | |
355 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
356 | } | |
e501603b | 357 | } |