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:21bc670b9083e60a58ccd4713958c192)
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 created
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 created'),
314 'where' => 'civicrm_batch.modified_date',
315 'table_name' => 'civicrm_batch',
317 'bao' => 'CRM_Batch_BAO_Batch',
321 'saved_search_id' => [
322 'name' => 'saved_search_id',
323 'type' => CRM_Utils_Type
::T_INT
,
324 'title' => ts('Smart Group ID'),
325 'description' => ts('FK to Saved Search ID'),
326 'where' => 'civicrm_batch.saved_search_id',
327 'table_name' => 'civicrm_batch',
329 'bao' => 'CRM_Batch_BAO_Batch',
331 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
333 'type' => 'EntityRef',
334 'label' => ts("Smart Group"),
339 'name' => 'status_id',
340 'type' => CRM_Utils_Type
::T_INT
,
341 'title' => ts('Batch Status'),
342 'description' => ts('fk to Batch Status options in civicrm_option_values'),
344 'where' => 'civicrm_batch.status_id',
345 'table_name' => 'civicrm_batch',
347 'bao' => 'CRM_Batch_BAO_Batch',
352 'pseudoconstant' => [
353 'optionGroupName' => 'batch_status',
354 'optionEditPath' => 'civicrm/admin/options/batch_status',
360 'type' => CRM_Utils_Type
::T_INT
,
361 'title' => ts('Batch Type'),
362 'description' => ts('fk to Batch Type options in civicrm_option_values'),
363 'where' => 'civicrm_batch.type_id',
364 'table_name' => 'civicrm_batch',
366 'bao' => 'CRM_Batch_BAO_Batch',
371 'pseudoconstant' => [
372 'optionGroupName' => 'batch_type',
373 'optionEditPath' => 'civicrm/admin/options/batch_type',
379 'type' => CRM_Utils_Type
::T_INT
,
380 'title' => ts('Batch Mode'),
381 'description' => ts('fk to Batch mode options in civicrm_option_values'),
382 'where' => 'civicrm_batch.mode_id',
383 'table_name' => 'civicrm_batch',
385 'bao' => 'CRM_Batch_BAO_Batch',
390 'pseudoconstant' => [
391 'optionGroupName' => 'batch_mode',
392 'optionEditPath' => 'civicrm/admin/options/batch_mode',
398 'type' => CRM_Utils_Type
::T_MONEY
,
399 'title' => ts('Batch Total'),
400 'description' => ts('Total amount for this batch.'),
405 'where' => 'civicrm_batch.total',
406 'table_name' => 'civicrm_batch',
408 'bao' => 'CRM_Batch_BAO_Batch',
416 'name' => 'item_count',
417 'type' => CRM_Utils_Type
::T_INT
,
418 'title' => ts('Batch Number of Items'),
419 'description' => ts('Number of items in a batch.'),
420 'where' => 'civicrm_batch.item_count',
421 'table_name' => 'civicrm_batch',
423 'bao' => 'CRM_Batch_BAO_Batch',
430 'payment_instrument_id' => [
431 'name' => 'payment_instrument_id',
432 'type' => CRM_Utils_Type
::T_INT
,
433 'title' => ts('Batch Payment Method'),
434 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
435 'where' => 'civicrm_batch.payment_instrument_id',
436 'table_name' => 'civicrm_batch',
438 'bao' => 'CRM_Batch_BAO_Batch',
443 'pseudoconstant' => [
444 'optionGroupName' => 'payment_instrument',
445 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
450 'name' => 'exported_date',
451 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
452 'title' => ts('Batch Exported Date'),
453 'where' => 'civicrm_batch.exported_date',
454 'table_name' => 'civicrm_batch',
456 'bao' => 'CRM_Batch_BAO_Batch',
462 'type' => CRM_Utils_Type
::T_LONGTEXT
,
463 'title' => ts('Batch Data'),
464 'description' => ts('cache entered data'),
465 'where' => 'civicrm_batch.data',
466 'table_name' => 'civicrm_batch',
468 'bao' => 'CRM_Batch_BAO_Batch',
473 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
475 return Civi
::$statics[__CLASS__
]['fields'];
479 * Return a mapping from field-name to the corresponding key (as used in fields()).
482 * Array(string $name => string $uniqueName).
484 public static function &fieldKeys() {
485 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
486 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
488 return Civi
::$statics[__CLASS__
]['fieldKeys'];
492 * Returns the names of this table
496 public static function getTableName() {
497 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
501 * Returns if this table needs to be logged
505 public function getLog() {
510 * Returns the list of fields that can be imported
512 * @param bool $prefix
516 public static function &import($prefix = FALSE) {
517 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
522 * Returns the list of fields that can be exported
524 * @param bool $prefix
528 public static function &export($prefix = FALSE) {
529 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
534 * Returns the list of indices
536 * @param bool $localize
540 public static function indices($localize = TRUE) {
547 'localizable' => FALSE,
549 'sig' => 'civicrm_batch::1::name',
552 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;