Merge pull request #19095 from nishant-bhorodia/Issue#537-owner-notification-email...
[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:717006044703500afc7d4f45f63194df)
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 created
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 'add' => '3.3',
205 ],
206 'name' => [
207 'name' => 'name',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('Batch Name'),
210 'description' => ts('Variable name/programmatic handle for this batch.'),
211 'maxlength' => 64,
212 'size' => CRM_Utils_Type::BIG,
213 'where' => 'civicrm_batch.name',
214 'table_name' => 'civicrm_batch',
215 'entity' => 'Batch',
216 'bao' => 'CRM_Batch_BAO_Batch',
217 'localizable' => 0,
218 'html' => [
219 'type' => 'Text',
220 ],
221 'add' => '3.3',
222 ],
223 'title' => [
224 'name' => 'title',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Batch Title'),
227 'description' => ts('Friendly Name.'),
228 'maxlength' => 255,
229 'size' => CRM_Utils_Type::HUGE,
230 'where' => 'civicrm_batch.title',
231 'table_name' => 'civicrm_batch',
232 'entity' => 'Batch',
233 'bao' => 'CRM_Batch_BAO_Batch',
234 'localizable' => 1,
235 'html' => [
236 'type' => 'Text',
237 ],
238 'add' => '4.2',
239 ],
240 'description' => [
241 'name' => 'description',
242 'type' => CRM_Utils_Type::T_TEXT,
243 'title' => ts('Batch Description'),
244 'description' => ts('Description of this batch set.'),
245 'rows' => 4,
246 'cols' => 80,
247 'where' => 'civicrm_batch.description',
248 'table_name' => 'civicrm_batch',
249 'entity' => 'Batch',
250 'bao' => 'CRM_Batch_BAO_Batch',
251 'localizable' => 1,
252 'html' => [
253 'type' => 'TextArea',
254 ],
255 'add' => '3.3',
256 ],
257 'created_id' => [
258 'name' => 'created_id',
259 'type' => CRM_Utils_Type::T_INT,
260 'title' => ts('Batch Created By'),
261 'description' => ts('FK to Contact ID'),
262 'where' => 'civicrm_batch.created_id',
263 'table_name' => 'civicrm_batch',
264 'entity' => 'Batch',
265 'bao' => 'CRM_Batch_BAO_Batch',
266 'localizable' => 0,
267 'FKClassName' => 'CRM_Contact_DAO_Contact',
268 'add' => '3.3',
269 ],
270 'created_date' => [
271 'name' => 'created_date',
272 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
273 'title' => ts('Batch Created Date'),
274 'description' => ts('When was this item created'),
275 'where' => 'civicrm_batch.created_date',
276 'table_name' => 'civicrm_batch',
277 'entity' => 'Batch',
278 'bao' => 'CRM_Batch_BAO_Batch',
279 'localizable' => 0,
280 'html' => [
281 'type' => 'Select Date',
282 'formatType' => 'activityDateTime',
283 ],
284 'add' => '3.3',
285 ],
286 'modified_id' => [
287 'name' => 'modified_id',
288 'type' => CRM_Utils_Type::T_INT,
289 'title' => ts('Batch Modified By'),
290 'description' => ts('FK to Contact ID'),
291 'where' => 'civicrm_batch.modified_id',
292 'table_name' => 'civicrm_batch',
293 'entity' => 'Batch',
294 'bao' => 'CRM_Batch_BAO_Batch',
295 'localizable' => 0,
296 'FKClassName' => 'CRM_Contact_DAO_Contact',
297 'add' => '3.3',
298 ],
299 'modified_date' => [
300 'name' => 'modified_date',
301 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
302 'title' => ts('Batch Modified Date'),
303 'description' => ts('When was this item created'),
304 'where' => 'civicrm_batch.modified_date',
305 'table_name' => 'civicrm_batch',
306 'entity' => 'Batch',
307 'bao' => 'CRM_Batch_BAO_Batch',
308 'localizable' => 0,
309 'add' => '3.3',
310 ],
311 'saved_search_id' => [
312 'name' => 'saved_search_id',
313 'type' => CRM_Utils_Type::T_INT,
314 'title' => ts('Batch Smart Group'),
315 'description' => ts('FK to Saved Search ID'),
316 'where' => 'civicrm_batch.saved_search_id',
317 'table_name' => 'civicrm_batch',
318 'entity' => 'Batch',
319 'bao' => 'CRM_Batch_BAO_Batch',
320 'localizable' => 0,
321 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
322 'html' => [
323 'type' => 'EntityRef',
324 ],
325 'add' => '4.1',
326 ],
327 'status_id' => [
328 'name' => 'status_id',
329 'type' => CRM_Utils_Type::T_INT,
330 'title' => ts('Batch Status'),
331 'description' => ts('fk to Batch Status options in civicrm_option_values'),
332 'required' => TRUE,
333 'where' => 'civicrm_batch.status_id',
334 'table_name' => 'civicrm_batch',
335 'entity' => 'Batch',
336 'bao' => 'CRM_Batch_BAO_Batch',
337 'localizable' => 0,
338 'html' => [
339 'type' => 'Select',
340 ],
341 'pseudoconstant' => [
342 'optionGroupName' => 'batch_status',
343 'optionEditPath' => 'civicrm/admin/options/batch_status',
344 ],
345 'add' => '4.2',
346 ],
347 'type_id' => [
348 'name' => 'type_id',
349 'type' => CRM_Utils_Type::T_INT,
350 'title' => ts('Batch Type'),
351 'description' => ts('fk to Batch Type options in civicrm_option_values'),
352 'where' => 'civicrm_batch.type_id',
353 'table_name' => 'civicrm_batch',
354 'entity' => 'Batch',
355 'bao' => 'CRM_Batch_BAO_Batch',
356 'localizable' => 0,
357 'html' => [
358 'type' => 'Select',
359 ],
360 'pseudoconstant' => [
361 'optionGroupName' => 'batch_type',
362 'optionEditPath' => 'civicrm/admin/options/batch_type',
363 ],
364 'add' => '4.2',
365 ],
366 'mode_id' => [
367 'name' => 'mode_id',
368 'type' => CRM_Utils_Type::T_INT,
369 'title' => ts('Batch Mode'),
370 'description' => ts('fk to Batch mode options in civicrm_option_values'),
371 'where' => 'civicrm_batch.mode_id',
372 'table_name' => 'civicrm_batch',
373 'entity' => 'Batch',
374 'bao' => 'CRM_Batch_BAO_Batch',
375 'localizable' => 0,
376 'html' => [
377 'type' => 'Select',
378 ],
379 'pseudoconstant' => [
380 'optionGroupName' => 'batch_mode',
381 'optionEditPath' => 'civicrm/admin/options/batch_mode',
382 ],
383 'add' => '4.2',
384 ],
385 'total' => [
386 'name' => 'total',
387 'type' => CRM_Utils_Type::T_MONEY,
388 'title' => ts('Batch Total'),
389 'description' => ts('Total amount for this batch.'),
390 'precision' => [
391 20,
392 2,
393 ],
394 'where' => 'civicrm_batch.total',
395 'table_name' => 'civicrm_batch',
396 'entity' => 'Batch',
397 'bao' => 'CRM_Batch_BAO_Batch',
398 'localizable' => 0,
399 'html' => [
400 'type' => 'Text',
401 ],
402 'add' => '4.2',
403 ],
404 'item_count' => [
405 'name' => 'item_count',
406 'type' => CRM_Utils_Type::T_INT,
407 'title' => ts('Batch Number of Items'),
408 'description' => ts('Number of items in a batch.'),
409 'where' => 'civicrm_batch.item_count',
410 'table_name' => 'civicrm_batch',
411 'entity' => 'Batch',
412 'bao' => 'CRM_Batch_BAO_Batch',
413 'localizable' => 0,
414 'html' => [
415 'type' => 'Text',
416 ],
417 'add' => '4.2',
418 ],
419 'payment_instrument_id' => [
420 'name' => 'payment_instrument_id',
421 'type' => CRM_Utils_Type::T_INT,
422 'title' => ts('Batch Payment Method'),
423 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
424 'where' => 'civicrm_batch.payment_instrument_id',
425 'table_name' => 'civicrm_batch',
426 'entity' => 'Batch',
427 'bao' => 'CRM_Batch_BAO_Batch',
428 'localizable' => 0,
429 'html' => [
430 'type' => 'Select',
431 ],
432 'pseudoconstant' => [
433 'optionGroupName' => 'payment_instrument',
434 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
435 ],
436 'add' => '4.3',
437 ],
438 'exported_date' => [
439 'name' => 'exported_date',
440 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
441 'title' => ts('Batch Exported Date'),
442 'where' => 'civicrm_batch.exported_date',
443 'table_name' => 'civicrm_batch',
444 'entity' => 'Batch',
445 'bao' => 'CRM_Batch_BAO_Batch',
446 'localizable' => 0,
447 'add' => '4.3',
448 ],
449 'data' => [
450 'name' => 'data',
451 'type' => CRM_Utils_Type::T_LONGTEXT,
452 'title' => ts('Batch Data'),
453 'description' => ts('cache entered data'),
454 'where' => 'civicrm_batch.data',
455 'table_name' => 'civicrm_batch',
456 'entity' => 'Batch',
457 'bao' => 'CRM_Batch_BAO_Batch',
458 'localizable' => 0,
459 'add' => '4.4',
460 ],
461 ];
462 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
463 }
464 return Civi::$statics[__CLASS__]['fields'];
465 }
466
467 /**
468 * Return a mapping from field-name to the corresponding key (as used in fields()).
469 *
470 * @return array
471 * Array(string $name => string $uniqueName).
472 */
473 public static function &fieldKeys() {
474 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
475 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
476 }
477 return Civi::$statics[__CLASS__]['fieldKeys'];
478 }
479
480 /**
481 * Returns the names of this table
482 *
483 * @return string
484 */
485 public static function getTableName() {
486 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
487 }
488
489 /**
490 * Returns if this table needs to be logged
491 *
492 * @return bool
493 */
494 public function getLog() {
495 return self::$_log;
496 }
497
498 /**
499 * Returns the list of fields that can be imported
500 *
501 * @param bool $prefix
502 *
503 * @return array
504 */
505 public static function &import($prefix = FALSE) {
506 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'batch', $prefix, []);
507 return $r;
508 }
509
510 /**
511 * Returns the list of fields that can be exported
512 *
513 * @param bool $prefix
514 *
515 * @return array
516 */
517 public static function &export($prefix = FALSE) {
518 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'batch', $prefix, []);
519 return $r;
520 }
521
522 /**
523 * Returns the list of indices
524 *
525 * @param bool $localize
526 *
527 * @return array
528 */
529 public static function indices($localize = TRUE) {
530 $indices = [
531 'UI_name' => [
532 'name' => 'UI_name',
533 'field' => [
534 0 => 'name',
535 ],
536 'localizable' => FALSE,
537 'unique' => TRUE,
538 'sig' => 'civicrm_batch::1::name',
539 ],
540 ];
541 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
542 }
543
544 }