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:00a7601bf04fcaa5c8d5ae2e7f916d4f)
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',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Batch Name'),
213 'description' => ts('Variable name/programmatic handle for this batch.'),
215 'size' => CRM_Utils_Type
::BIG
,
216 'where' => 'civicrm_batch.name',
217 'table_name' => 'civicrm_batch',
219 'bao' => 'CRM_Batch_BAO_Batch',
228 'type' => CRM_Utils_Type
::T_STRING
,
229 'title' => ts('Batch Title'),
230 'description' => ts('Friendly Name.'),
232 'size' => CRM_Utils_Type
::HUGE
,
233 'where' => 'civicrm_batch.title',
234 'table_name' => 'civicrm_batch',
236 'bao' => 'CRM_Batch_BAO_Batch',
244 'name' => 'description',
245 'type' => CRM_Utils_Type
::T_TEXT
,
246 'title' => ts('Batch Description'),
247 'description' => ts('Description of this batch set.'),
250 'where' => 'civicrm_batch.description',
251 'table_name' => 'civicrm_batch',
253 'bao' => 'CRM_Batch_BAO_Batch',
256 'type' => 'TextArea',
261 'name' => 'created_id',
262 'type' => CRM_Utils_Type
::T_INT
,
263 'title' => ts('Created By Contact ID'),
264 'description' => ts('FK to Contact ID'),
265 'where' => 'civicrm_batch.created_id',
266 'table_name' => 'civicrm_batch',
268 'bao' => 'CRM_Batch_BAO_Batch',
270 'FKClassName' => 'CRM_Contact_DAO_Contact',
272 'label' => ts("Created By"),
277 'name' => 'created_date',
278 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
279 'title' => ts('Batch Created Date'),
280 'description' => ts('When was this item created'),
281 'where' => 'civicrm_batch.created_date',
282 'table_name' => 'civicrm_batch',
284 'bao' => 'CRM_Batch_BAO_Batch',
287 'type' => 'Select Date',
288 'formatType' => 'activityDateTime',
293 'name' => 'modified_id',
294 'type' => CRM_Utils_Type
::T_INT
,
295 'title' => ts('Modified By Contact ID'),
296 'description' => ts('FK to Contact ID'),
297 'where' => 'civicrm_batch.modified_id',
298 'table_name' => 'civicrm_batch',
300 'bao' => 'CRM_Batch_BAO_Batch',
302 'FKClassName' => 'CRM_Contact_DAO_Contact',
304 'label' => ts("Modified By"),
309 'name' => 'modified_date',
310 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
311 'title' => ts('Batch Modified Date'),
312 'description' => ts('When was this item created'),
313 'where' => 'civicrm_batch.modified_date',
314 'table_name' => 'civicrm_batch',
316 'bao' => 'CRM_Batch_BAO_Batch',
320 'saved_search_id' => [
321 'name' => 'saved_search_id',
322 'type' => CRM_Utils_Type
::T_INT
,
323 'title' => ts('Smart Group ID'),
324 'description' => ts('FK to Saved Search ID'),
325 'where' => 'civicrm_batch.saved_search_id',
326 'table_name' => 'civicrm_batch',
328 'bao' => 'CRM_Batch_BAO_Batch',
330 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
332 'type' => 'EntityRef',
333 'label' => ts("Smart Group"),
338 'name' => 'status_id',
339 'type' => CRM_Utils_Type
::T_INT
,
340 'title' => ts('Batch Status'),
341 'description' => ts('fk to Batch Status options in civicrm_option_values'),
343 'where' => 'civicrm_batch.status_id',
344 'table_name' => 'civicrm_batch',
346 'bao' => 'CRM_Batch_BAO_Batch',
351 'pseudoconstant' => [
352 'optionGroupName' => 'batch_status',
353 'optionEditPath' => 'civicrm/admin/options/batch_status',
359 'type' => CRM_Utils_Type
::T_INT
,
360 'title' => ts('Batch Type'),
361 'description' => ts('fk to Batch Type options in civicrm_option_values'),
362 'where' => 'civicrm_batch.type_id',
363 'table_name' => 'civicrm_batch',
365 'bao' => 'CRM_Batch_BAO_Batch',
370 'pseudoconstant' => [
371 'optionGroupName' => 'batch_type',
372 'optionEditPath' => 'civicrm/admin/options/batch_type',
378 'type' => CRM_Utils_Type
::T_INT
,
379 'title' => ts('Batch Mode'),
380 'description' => ts('fk to Batch mode options in civicrm_option_values'),
381 'where' => 'civicrm_batch.mode_id',
382 'table_name' => 'civicrm_batch',
384 'bao' => 'CRM_Batch_BAO_Batch',
389 'pseudoconstant' => [
390 'optionGroupName' => 'batch_mode',
391 'optionEditPath' => 'civicrm/admin/options/batch_mode',
397 'type' => CRM_Utils_Type
::T_MONEY
,
398 'title' => ts('Batch Total'),
399 'description' => ts('Total amount for this batch.'),
404 'where' => 'civicrm_batch.total',
405 'table_name' => 'civicrm_batch',
407 'bao' => 'CRM_Batch_BAO_Batch',
415 'name' => 'item_count',
416 'type' => CRM_Utils_Type
::T_INT
,
417 'title' => ts('Batch Number of Items'),
418 'description' => ts('Number of items in a batch.'),
419 'where' => 'civicrm_batch.item_count',
420 'table_name' => 'civicrm_batch',
422 'bao' => 'CRM_Batch_BAO_Batch',
429 'payment_instrument_id' => [
430 'name' => 'payment_instrument_id',
431 'type' => CRM_Utils_Type
::T_INT
,
432 'title' => ts('Batch Payment Method'),
433 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
434 'where' => 'civicrm_batch.payment_instrument_id',
435 'table_name' => 'civicrm_batch',
437 'bao' => 'CRM_Batch_BAO_Batch',
442 'pseudoconstant' => [
443 'optionGroupName' => 'payment_instrument',
444 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
449 'name' => 'exported_date',
450 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
451 'title' => ts('Batch Exported Date'),
452 'where' => 'civicrm_batch.exported_date',
453 'table_name' => 'civicrm_batch',
455 'bao' => 'CRM_Batch_BAO_Batch',
461 'type' => CRM_Utils_Type
::T_LONGTEXT
,
462 'title' => ts('Batch Data'),
463 'description' => ts('cache entered data'),
464 'where' => 'civicrm_batch.data',
465 'table_name' => 'civicrm_batch',
467 'bao' => 'CRM_Batch_BAO_Batch',
472 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
474 return Civi
::$statics[__CLASS__
]['fields'];
478 * Return a mapping from field-name to the corresponding key (as used in fields()).
481 * Array(string $name => string $uniqueName).
483 public static function &fieldKeys() {
484 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
485 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
487 return Civi
::$statics[__CLASS__
]['fieldKeys'];
491 * Returns the names of this table
495 public static function getTableName() {
496 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
500 * Returns if this table needs to be logged
504 public function getLog() {
509 * Returns the list of fields that can be imported
511 * @param bool $prefix
515 public static function &import($prefix = FALSE) {
516 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
521 * Returns the list of fields that can be exported
523 * @param bool $prefix
527 public static function &export($prefix = FALSE) {
528 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
533 * Returns the list of indices
535 * @param bool $localize
539 public static function indices($localize = TRUE) {
546 'localizable' => FALSE,
548 'sig' => 'civicrm_batch::1::name',
551 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;