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