CRM-20312 add field localisation data to DAO.
[civicrm-core.git] / CRM / Case / DAO / Case.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Case/Case.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:ec4612a24aed71e99dae33589efc40a0)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Case_DAO_Case constructor.
39 */
40 class CRM_Case_DAO_Case extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_case';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 /**
101 * Class constructor.
102 */
103 function __construct() {
104 $this->__table = 'civicrm_case';
105 parent::__construct();
106 }
107 /**
108 * Returns foreign keys and entity references.
109 *
110 * @return array
111 * [CRM_Core_Reference_Interface]
112 */
113 static function getReferenceColumns() {
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']);
118 }
119 return Civi::$statics[__CLASS__]['links'];
120 }
121 /**
122 * Returns all the column names of this table
123 *
124 * @return array
125 */
126 static function &fields() {
127 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
128 Civi::$statics[__CLASS__]['fields'] = array(
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,
140 'table_name' => 'civicrm_case',
141 'entity' => 'Case',
142 'bao' => 'CRM_Case_BAO_Case',
143 ) ,
144 'case_type_id' => array(
145 'name' => 'case_type_id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Case Type') ,
148 'description' => 'FK to civicrm_case_type.id',
149 'required' => true,
150 'import' => true,
151 'where' => 'civicrm_case.case_type_id',
152 'headerPattern' => '',
153 'dataPattern' => '',
154 'export' => false,
155 'table_name' => 'civicrm_case',
156 'entity' => 'Case',
157 'bao' => 'CRM_Case_BAO_Case',
158 'FKClassName' => 'CRM_Case_DAO_CaseType',
159 'html' => array(
160 'type' => 'Select',
161 ) ,
162 'pseudoconstant' => array(
163 'table' => 'civicrm_case_type',
164 'keyColumn' => 'id',
165 'labelColumn' => 'title',
166 )
167 ) ,
168 'case_subject' => array(
169 'name' => 'subject',
170 'type' => CRM_Utils_Type::T_STRING,
171 'title' => ts('Case Subject') ,
172 'description' => 'Short name of the case.',
173 'maxlength' => 128,
174 'size' => CRM_Utils_Type::HUGE,
175 'import' => true,
176 'where' => 'civicrm_case.subject',
177 'headerPattern' => '',
178 'dataPattern' => '',
179 'export' => true,
180 'table_name' => 'civicrm_case',
181 'entity' => 'Case',
182 'bao' => 'CRM_Case_BAO_Case',
183 'html' => array(
184 'type' => 'Text',
185 ) ,
186 ) ,
187 'case_start_date' => array(
188 'name' => 'start_date',
189 'type' => CRM_Utils_Type::T_DATE,
190 'title' => ts('Case Start Date') ,
191 'description' => 'Date on which given case starts.',
192 'import' => true,
193 'where' => 'civicrm_case.start_date',
194 'headerPattern' => '',
195 'dataPattern' => '',
196 'export' => true,
197 'table_name' => 'civicrm_case',
198 'entity' => 'Case',
199 'bao' => 'CRM_Case_BAO_Case',
200 'html' => array(
201 'type' => 'Select Date',
202 ) ,
203 ) ,
204 'case_end_date' => array(
205 'name' => 'end_date',
206 'type' => CRM_Utils_Type::T_DATE,
207 'title' => ts('Case End Date') ,
208 'description' => 'Date on which given case ends.',
209 'import' => true,
210 'where' => 'civicrm_case.end_date',
211 'headerPattern' => '',
212 'dataPattern' => '',
213 'export' => true,
214 'table_name' => 'civicrm_case',
215 'entity' => 'Case',
216 'bao' => 'CRM_Case_BAO_Case',
217 'html' => array(
218 'type' => 'Select Date',
219 ) ,
220 ) ,
221 'details' => array(
222 'name' => 'details',
223 'type' => CRM_Utils_Type::T_TEXT,
224 'title' => ts('Details') ,
225 'description' => 'Details about the meeting (agenda, notes, etc).',
226 'rows' => 8,
227 'cols' => 60,
228 'table_name' => 'civicrm_case',
229 'entity' => 'Case',
230 'bao' => 'CRM_Case_BAO_Case',
231 'html' => array(
232 'type' => 'TextArea',
233 ) ,
234 ) ,
235 'case_status_id' => array(
236 'name' => 'status_id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('Case Status') ,
239 'description' => 'Id of case status.',
240 'required' => true,
241 'import' => true,
242 'where' => 'civicrm_case.status_id',
243 'headerPattern' => '',
244 'dataPattern' => '',
245 'export' => false,
246 'table_name' => 'civicrm_case',
247 'entity' => 'Case',
248 'bao' => 'CRM_Case_BAO_Case',
249 'html' => array(
250 'type' => 'Select',
251 ) ,
252 'pseudoconstant' => array(
253 'optionGroupName' => 'case_status',
254 'optionEditPath' => 'civicrm/admin/options/case_status',
255 )
256 ) ,
257 'case_deleted' => array(
258 'name' => 'is_deleted',
259 'type' => CRM_Utils_Type::T_BOOLEAN,
260 'title' => ts('Case is in the Trash') ,
261 'import' => true,
262 'where' => 'civicrm_case.is_deleted',
263 'headerPattern' => '',
264 'dataPattern' => '',
265 'export' => true,
266 'table_name' => 'civicrm_case',
267 'entity' => 'Case',
268 'bao' => 'CRM_Case_BAO_Case',
269 ) ,
270 );
271 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
272 }
273 return Civi::$statics[__CLASS__]['fields'];
274 }
275 /**
276 * Return a mapping from field-name to the corresponding key (as used in fields()).
277 *
278 * @return array
279 * Array(string $name => string $uniqueName).
280 */
281 static function &fieldKeys() {
282 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
283 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
284 }
285 return Civi::$statics[__CLASS__]['fieldKeys'];
286 }
287 /**
288 * Returns the names of this table
289 *
290 * @return string
291 */
292 static function getTableName() {
293 return self::$_tableName;
294 }
295 /**
296 * Returns if this table needs to be logged
297 *
298 * @return boolean
299 */
300 function getLog() {
301 return self::$_log;
302 }
303 /**
304 * Returns the list of fields that can be imported
305 *
306 * @param bool $prefix
307 *
308 * @return array
309 */
310 static function &import($prefix = false) {
311 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, array());
312 return $r;
313 }
314 /**
315 * Returns the list of fields that can be exported
316 *
317 * @param bool $prefix
318 *
319 * @return array
320 */
321 static function &export($prefix = false) {
322 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, array());
323 return $r;
324 }
325 }