SearchKit - Add translatable descriptions to entities
[civicrm-core.git] / CRM / Batch / DAO / Batch.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Batch/Batch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:965795e9c5cb8876ff6198abee5ffc71)
10 */
11
12 /**
13 * Database access object for the Batch entity.
14 */
15 class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.3';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_batch';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Unique Address ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Variable name/programmatic handle for this batch.
42 *
43 * @var string
44 */
45 public $name;
46
47 /**
48 * Friendly Name.
49 *
50 * @var string
51 */
52 public $title;
53
54 /**
55 * Description of this batch set.
56 *
57 * @var text
58 */
59 public $description;
60
61 /**
62 * FK to Contact ID
63 *
64 * @var int
65 */
66 public $created_id;
67
68 /**
69 * When was this item created
70 *
71 * @var datetime
72 */
73 public $created_date;
74
75 /**
76 * FK to Contact ID
77 *
78 * @var int
79 */
80 public $modified_id;
81
82 /**
83 * When was this item modified
84 *
85 * @var datetime
86 */
87 public $modified_date;
88
89 /**
90 * FK to Saved Search ID
91 *
92 * @var int
93 */
94 public $saved_search_id;
95
96 /**
97 * fk to Batch Status options in civicrm_option_values
98 *
99 * @var int
100 */
101 public $status_id;
102
103 /**
104 * fk to Batch Type options in civicrm_option_values
105 *
106 * @var int
107 */
108 public $type_id;
109
110 /**
111 * fk to Batch mode options in civicrm_option_values
112 *
113 * @var int
114 */
115 public $mode_id;
116
117 /**
118 * Total amount for this batch.
119 *
120 * @var float
121 */
122 public $total;
123
124 /**
125 * Number of items in a batch.
126 *
127 * @var int
128 */
129 public $item_count;
130
131 /**
132 * fk to Payment Instrument options in civicrm_option_values
133 *
134 * @var int
135 */
136 public $payment_instrument_id;
137
138 /**
139 * @var datetime
140 */
141 public $exported_date;
142
143 /**
144 * cache entered data
145 *
146 * @var longtext
147 */
148 public $data;
149
150 /**
151 * Class constructor.
152 */
153 public function __construct() {
154 $this->__table = 'civicrm_batch';
155 parent::__construct();
156 }
157
158 /**
159 * Returns localized title of this entity.
160 *
161 * @param bool $plural
162 * Whether to return the plural version of the title.
163 */
164 public static function getEntityTitle($plural = FALSE) {
165 return $plural ? ts('Batches') : ts('Batch');
166 }
167
168 /**
169 * Returns foreign keys and entity references.
170 *
171 * @return array
172 * [CRM_Core_Reference_Interface]
173 */
174 public static function getReferenceColumns() {
175 if (!isset(Civi::$statics[__CLASS__]['links'])) {
176 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
177 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
178 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id');
179 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
180 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
181 }
182 return Civi::$statics[__CLASS__]['links'];
183 }
184
185 /**
186 * Returns all the column names of this table
187 *
188 * @return array
189 */
190 public static function &fields() {
191 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
192 Civi::$statics[__CLASS__]['fields'] = [
193 'id' => [
194 'name' => 'id',
195 'type' => CRM_Utils_Type::T_INT,
196 'title' => ts('Batch ID'),
197 'description' => ts('Unique Address ID'),
198 'required' => TRUE,
199 'where' => 'civicrm_batch.id',
200 'table_name' => 'civicrm_batch',
201 'entity' => 'Batch',
202 'bao' => 'CRM_Batch_BAO_Batch',
203 'localizable' => 0,
204 'html' => [
205 'type' => 'Number',
206 ],
207 'readonly' => TRUE,
208 'add' => '3.3',
209 ],
210 'name' => [
211 'name' => 'name',
212 'type' => CRM_Utils_Type::T_STRING,
213 'title' => ts('Batch Name'),
214 'description' => ts('Variable name/programmatic handle for this batch.'),
215 'maxlength' => 64,
216 'size' => CRM_Utils_Type::BIG,
217 'where' => 'civicrm_batch.name',
218 'table_name' => 'civicrm_batch',
219 'entity' => 'Batch',
220 'bao' => 'CRM_Batch_BAO_Batch',
221 'localizable' => 0,
222 'html' => [
223 'type' => 'Text',
224 ],
225 'add' => '3.3',
226 ],
227 'title' => [
228 'name' => 'title',
229 'type' => CRM_Utils_Type::T_STRING,
230 'title' => ts('Batch Title'),
231 'description' => ts('Friendly Name.'),
232 'maxlength' => 255,
233 'size' => CRM_Utils_Type::HUGE,
234 'where' => 'civicrm_batch.title',
235 'table_name' => 'civicrm_batch',
236 'entity' => 'Batch',
237 'bao' => 'CRM_Batch_BAO_Batch',
238 'localizable' => 1,
239 'html' => [
240 'type' => 'Text',
241 ],
242 'add' => '4.2',
243 ],
244 'description' => [
245 'name' => 'description',
246 'type' => CRM_Utils_Type::T_TEXT,
247 'title' => ts('Batch Description'),
248 'description' => ts('Description of this batch set.'),
249 'rows' => 4,
250 'cols' => 80,
251 'where' => 'civicrm_batch.description',
252 'table_name' => 'civicrm_batch',
253 'entity' => 'Batch',
254 'bao' => 'CRM_Batch_BAO_Batch',
255 'localizable' => 1,
256 'html' => [
257 'type' => 'TextArea',
258 ],
259 'add' => '3.3',
260 ],
261 'created_id' => [
262 'name' => 'created_id',
263 'type' => CRM_Utils_Type::T_INT,
264 'title' => ts('Created By Contact ID'),
265 'description' => ts('FK to Contact ID'),
266 'where' => 'civicrm_batch.created_id',
267 'table_name' => 'civicrm_batch',
268 'entity' => 'Batch',
269 'bao' => 'CRM_Batch_BAO_Batch',
270 'localizable' => 0,
271 'FKClassName' => 'CRM_Contact_DAO_Contact',
272 'html' => [
273 'label' => ts("Created By"),
274 ],
275 'add' => '3.3',
276 ],
277 'created_date' => [
278 'name' => 'created_date',
279 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
280 'title' => ts('Batch Created Date'),
281 'description' => ts('When was this item created'),
282 'where' => 'civicrm_batch.created_date',
283 'table_name' => 'civicrm_batch',
284 'entity' => 'Batch',
285 'bao' => 'CRM_Batch_BAO_Batch',
286 'localizable' => 0,
287 'html' => [
288 'type' => 'Select Date',
289 'formatType' => 'activityDateTime',
290 ],
291 'add' => '3.3',
292 ],
293 'modified_id' => [
294 'name' => 'modified_id',
295 'type' => CRM_Utils_Type::T_INT,
296 'title' => ts('Modified By Contact ID'),
297 'description' => ts('FK to Contact ID'),
298 'where' => 'civicrm_batch.modified_id',
299 'table_name' => 'civicrm_batch',
300 'entity' => 'Batch',
301 'bao' => 'CRM_Batch_BAO_Batch',
302 'localizable' => 0,
303 'FKClassName' => 'CRM_Contact_DAO_Contact',
304 'html' => [
305 'label' => ts("Modified By"),
306 ],
307 'add' => '3.3',
308 ],
309 'modified_date' => [
310 'name' => 'modified_date',
311 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
312 'title' => ts('Batch Modified Date'),
313 'description' => ts('When was this item modified'),
314 'where' => 'civicrm_batch.modified_date',
315 'table_name' => 'civicrm_batch',
316 'entity' => 'Batch',
317 'bao' => 'CRM_Batch_BAO_Batch',
318 'localizable' => 0,
319 'readonly' => TRUE,
320 'add' => '3.3',
321 ],
322 'saved_search_id' => [
323 'name' => 'saved_search_id',
324 'type' => CRM_Utils_Type::T_INT,
325 'title' => ts('Smart Group ID'),
326 'description' => ts('FK to Saved Search ID'),
327 'where' => 'civicrm_batch.saved_search_id',
328 'table_name' => 'civicrm_batch',
329 'entity' => 'Batch',
330 'bao' => 'CRM_Batch_BAO_Batch',
331 'localizable' => 0,
332 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
333 'html' => [
334 'type' => 'EntityRef',
335 'label' => ts("Smart Group"),
336 ],
337 'add' => '4.1',
338 ],
339 'status_id' => [
340 'name' => 'status_id',
341 'type' => CRM_Utils_Type::T_INT,
342 'title' => ts('Batch Status'),
343 'description' => ts('fk to Batch Status options in civicrm_option_values'),
344 'required' => TRUE,
345 'where' => 'civicrm_batch.status_id',
346 'table_name' => 'civicrm_batch',
347 'entity' => 'Batch',
348 'bao' => 'CRM_Batch_BAO_Batch',
349 'localizable' => 0,
350 'html' => [
351 'type' => 'Select',
352 ],
353 'pseudoconstant' => [
354 'optionGroupName' => 'batch_status',
355 'optionEditPath' => 'civicrm/admin/options/batch_status',
356 ],
357 'add' => '4.2',
358 ],
359 'type_id' => [
360 'name' => 'type_id',
361 'type' => CRM_Utils_Type::T_INT,
362 'title' => ts('Batch Type'),
363 'description' => ts('fk to Batch Type options in civicrm_option_values'),
364 'where' => 'civicrm_batch.type_id',
365 'table_name' => 'civicrm_batch',
366 'entity' => 'Batch',
367 'bao' => 'CRM_Batch_BAO_Batch',
368 'localizable' => 0,
369 'html' => [
370 'type' => 'Select',
371 ],
372 'pseudoconstant' => [
373 'optionGroupName' => 'batch_type',
374 'optionEditPath' => 'civicrm/admin/options/batch_type',
375 ],
376 'add' => '4.2',
377 ],
378 'mode_id' => [
379 'name' => 'mode_id',
380 'type' => CRM_Utils_Type::T_INT,
381 'title' => ts('Batch Mode'),
382 'description' => ts('fk to Batch mode options in civicrm_option_values'),
383 'where' => 'civicrm_batch.mode_id',
384 'table_name' => 'civicrm_batch',
385 'entity' => 'Batch',
386 'bao' => 'CRM_Batch_BAO_Batch',
387 'localizable' => 0,
388 'html' => [
389 'type' => 'Select',
390 ],
391 'pseudoconstant' => [
392 'optionGroupName' => 'batch_mode',
393 'optionEditPath' => 'civicrm/admin/options/batch_mode',
394 ],
395 'add' => '4.2',
396 ],
397 'total' => [
398 'name' => 'total',
399 'type' => CRM_Utils_Type::T_MONEY,
400 'title' => ts('Batch Total'),
401 'description' => ts('Total amount for this batch.'),
402 'precision' => [
403 20,
404 2,
405 ],
406 'where' => 'civicrm_batch.total',
407 'table_name' => 'civicrm_batch',
408 'entity' => 'Batch',
409 'bao' => 'CRM_Batch_BAO_Batch',
410 'localizable' => 0,
411 'html' => [
412 'type' => 'Text',
413 ],
414 'add' => '4.2',
415 ],
416 'item_count' => [
417 'name' => 'item_count',
418 'type' => CRM_Utils_Type::T_INT,
419 'title' => ts('Batch Number of Items'),
420 'description' => ts('Number of items in a batch.'),
421 'where' => 'civicrm_batch.item_count',
422 'table_name' => 'civicrm_batch',
423 'entity' => 'Batch',
424 'bao' => 'CRM_Batch_BAO_Batch',
425 'localizable' => 0,
426 'html' => [
427 'type' => 'Text',
428 ],
429 'add' => '4.2',
430 ],
431 'payment_instrument_id' => [
432 'name' => 'payment_instrument_id',
433 'type' => CRM_Utils_Type::T_INT,
434 'title' => ts('Batch Payment Method'),
435 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
436 'where' => 'civicrm_batch.payment_instrument_id',
437 'table_name' => 'civicrm_batch',
438 'entity' => 'Batch',
439 'bao' => 'CRM_Batch_BAO_Batch',
440 'localizable' => 0,
441 'html' => [
442 'type' => 'Select',
443 ],
444 'pseudoconstant' => [
445 'optionGroupName' => 'payment_instrument',
446 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
447 ],
448 'add' => '4.3',
449 ],
450 'exported_date' => [
451 'name' => 'exported_date',
452 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
453 'title' => ts('Batch Exported Date'),
454 'where' => 'civicrm_batch.exported_date',
455 'table_name' => 'civicrm_batch',
456 'entity' => 'Batch',
457 'bao' => 'CRM_Batch_BAO_Batch',
458 'localizable' => 0,
459 'add' => '4.3',
460 ],
461 'data' => [
462 'name' => 'data',
463 'type' => CRM_Utils_Type::T_LONGTEXT,
464 'title' => ts('Batch Data'),
465 'description' => ts('cache entered data'),
466 'where' => 'civicrm_batch.data',
467 'table_name' => 'civicrm_batch',
468 'entity' => 'Batch',
469 'bao' => 'CRM_Batch_BAO_Batch',
470 'localizable' => 0,
471 'add' => '4.4',
472 ],
473 ];
474 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
475 }
476 return Civi::$statics[__CLASS__]['fields'];
477 }
478
479 /**
480 * Return a mapping from field-name to the corresponding key (as used in fields()).
481 *
482 * @return array
483 * Array(string $name => string $uniqueName).
484 */
485 public static function &fieldKeys() {
486 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
487 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
488 }
489 return Civi::$statics[__CLASS__]['fieldKeys'];
490 }
491
492 /**
493 * Returns the names of this table
494 *
495 * @return string
496 */
497 public static function getTableName() {
498 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
499 }
500
501 /**
502 * Returns if this table needs to be logged
503 *
504 * @return bool
505 */
506 public function getLog() {
507 return self::$_log;
508 }
509
510 /**
511 * Returns the list of fields that can be imported
512 *
513 * @param bool $prefix
514 *
515 * @return array
516 */
517 public static function &import($prefix = FALSE) {
518 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'batch', $prefix, []);
519 return $r;
520 }
521
522 /**
523 * Returns the list of fields that can be exported
524 *
525 * @param bool $prefix
526 *
527 * @return array
528 */
529 public static function &export($prefix = FALSE) {
530 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'batch', $prefix, []);
531 return $r;
532 }
533
534 /**
535 * Returns the list of indices
536 *
537 * @param bool $localize
538 *
539 * @return array
540 */
541 public static function indices($localize = TRUE) {
542 $indices = [
543 'UI_name' => [
544 'name' => 'UI_name',
545 'field' => [
546 0 => 'name',
547 ],
548 'localizable' => FALSE,
549 'unique' => TRUE,
550 'sig' => 'civicrm_batch::1::name',
551 ],
552 ];
553 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
554 }
555
556 }