5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Batch/Batch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:965795e9c5cb8876ff6198abee5ffc71)
13 * Database access object for the Batch entity.
15 class CRM_Batch_DAO_Batch
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.3';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_batch';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * Variable name/programmatic handle for this batch.
55 * Description of this batch set.
69 * When was this item created
83 * When was this item modified
87 public $modified_date;
90 * FK to Saved Search ID
94 public $saved_search_id;
97 * fk to Batch Status options in civicrm_option_values
104 * fk to Batch Type options in civicrm_option_values
111 * fk to Batch mode options in civicrm_option_values
118 * Total amount for this batch.
125 * Number of items in a batch.
132 * fk to Payment Instrument options in civicrm_option_values
136 public $payment_instrument_id;
141 public $exported_date;
153 public function __construct() {
154 $this->__table
= 'civicrm_batch';
155 parent
::__construct();
159 * Returns localized title of this entity.
161 * @param bool $plural
162 * Whether to return the plural version of the title.
164 public static function getEntityTitle($plural = FALSE) {
165 return $plural ?
ts('Batches') : ts('Batch');
169 * Returns foreign keys and entity references.
172 * [CRM_Core_Reference_Interface]
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']);
182 return Civi
::$statics[__CLASS__
]['links'];
186 * Returns all the column names of this table
190 public static function &fields() {
191 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
192 Civi
::$statics[__CLASS__
]['fields'] = [
195 'type' => CRM_Utils_Type
::T_INT
,
196 'title' => ts('Batch ID'),
197 'description' => ts('Unique Address ID'),
199 'where' => 'civicrm_batch.id',
200 'table_name' => 'civicrm_batch',
202 'bao' => 'CRM_Batch_BAO_Batch',
212 'type' => CRM_Utils_Type
::T_STRING
,
213 'title' => ts('Batch Name'),
214 'description' => ts('Variable name/programmatic handle for this batch.'),
216 'size' => CRM_Utils_Type
::BIG
,
217 'where' => 'civicrm_batch.name',
218 'table_name' => 'civicrm_batch',
220 'bao' => 'CRM_Batch_BAO_Batch',
229 'type' => CRM_Utils_Type
::T_STRING
,
230 'title' => ts('Batch Title'),
231 'description' => ts('Friendly Name.'),
233 'size' => CRM_Utils_Type
::HUGE
,
234 'where' => 'civicrm_batch.title',
235 'table_name' => 'civicrm_batch',
237 'bao' => 'CRM_Batch_BAO_Batch',
245 'name' => 'description',
246 'type' => CRM_Utils_Type
::T_TEXT
,
247 'title' => ts('Batch Description'),
248 'description' => ts('Description of this batch set.'),
251 'where' => 'civicrm_batch.description',
252 'table_name' => 'civicrm_batch',
254 'bao' => 'CRM_Batch_BAO_Batch',
257 'type' => 'TextArea',
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',
269 'bao' => 'CRM_Batch_BAO_Batch',
271 'FKClassName' => 'CRM_Contact_DAO_Contact',
273 'label' => ts("Created By"),
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',
285 'bao' => 'CRM_Batch_BAO_Batch',
288 'type' => 'Select Date',
289 'formatType' => 'activityDateTime',
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',
301 'bao' => 'CRM_Batch_BAO_Batch',
303 'FKClassName' => 'CRM_Contact_DAO_Contact',
305 'label' => ts("Modified By"),
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',
317 'bao' => 'CRM_Batch_BAO_Batch',
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',
330 'bao' => 'CRM_Batch_BAO_Batch',
332 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
334 'type' => 'EntityRef',
335 'label' => ts("Smart Group"),
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'),
345 'where' => 'civicrm_batch.status_id',
346 'table_name' => 'civicrm_batch',
348 'bao' => 'CRM_Batch_BAO_Batch',
353 'pseudoconstant' => [
354 'optionGroupName' => 'batch_status',
355 'optionEditPath' => 'civicrm/admin/options/batch_status',
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',
367 'bao' => 'CRM_Batch_BAO_Batch',
372 'pseudoconstant' => [
373 'optionGroupName' => 'batch_type',
374 'optionEditPath' => 'civicrm/admin/options/batch_type',
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',
386 'bao' => 'CRM_Batch_BAO_Batch',
391 'pseudoconstant' => [
392 'optionGroupName' => 'batch_mode',
393 'optionEditPath' => 'civicrm/admin/options/batch_mode',
399 'type' => CRM_Utils_Type
::T_MONEY
,
400 'title' => ts('Batch Total'),
401 'description' => ts('Total amount for this batch.'),
406 'where' => 'civicrm_batch.total',
407 'table_name' => 'civicrm_batch',
409 'bao' => 'CRM_Batch_BAO_Batch',
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',
424 'bao' => 'CRM_Batch_BAO_Batch',
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',
439 'bao' => 'CRM_Batch_BAO_Batch',
444 'pseudoconstant' => [
445 'optionGroupName' => 'payment_instrument',
446 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
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',
457 'bao' => 'CRM_Batch_BAO_Batch',
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',
469 'bao' => 'CRM_Batch_BAO_Batch',
474 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
476 return Civi
::$statics[__CLASS__
]['fields'];
480 * Return a mapping from field-name to the corresponding key (as used in fields()).
483 * Array(string $name => string $uniqueName).
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()));
489 return Civi
::$statics[__CLASS__
]['fieldKeys'];
493 * Returns the names of this table
497 public static function getTableName() {
498 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
502 * Returns if this table needs to be logged
506 public function getLog() {
511 * Returns the list of fields that can be imported
513 * @param bool $prefix
517 public static function &import($prefix = FALSE) {
518 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
523 * Returns the list of fields that can be exported
525 * @param bool $prefix
529 public static function &export($prefix = FALSE) {
530 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
535 * Returns the list of indices
537 * @param bool $localize
541 public static function indices($localize = TRUE) {
548 'localizable' => FALSE,
550 'sig' => 'civicrm_batch::1::name',
553 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;