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:29e187971d03eba3ce5e3848f2ea1a5b)
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',
208 'type' => CRM_Utils_Type
::T_STRING
,
209 'title' => ts('Batch Name'),
210 'description' => ts('Variable name/programmatic handle for this batch.'),
212 'size' => CRM_Utils_Type
::BIG
,
213 'where' => 'civicrm_batch.name',
214 'table_name' => 'civicrm_batch',
216 'bao' => 'CRM_Batch_BAO_Batch',
225 'type' => CRM_Utils_Type
::T_STRING
,
226 'title' => ts('Batch Title'),
227 'description' => ts('Friendly Name.'),
229 'size' => CRM_Utils_Type
::HUGE
,
230 'where' => 'civicrm_batch.title',
231 'table_name' => 'civicrm_batch',
233 'bao' => 'CRM_Batch_BAO_Batch',
241 'name' => 'description',
242 'type' => CRM_Utils_Type
::T_TEXT
,
243 'title' => ts('Batch Description'),
244 'description' => ts('Description of this batch set.'),
247 'where' => 'civicrm_batch.description',
248 'table_name' => 'civicrm_batch',
250 'bao' => 'CRM_Batch_BAO_Batch',
253 'type' => 'TextArea',
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',
265 'bao' => 'CRM_Batch_BAO_Batch',
267 'FKClassName' => 'CRM_Contact_DAO_Contact',
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',
278 'bao' => 'CRM_Batch_BAO_Batch',
281 'type' => 'Select Date',
282 'formatType' => 'activityDateTime',
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',
294 'bao' => 'CRM_Batch_BAO_Batch',
296 'FKClassName' => 'CRM_Contact_DAO_Contact',
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',
307 'bao' => 'CRM_Batch_BAO_Batch',
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',
319 'bao' => 'CRM_Batch_BAO_Batch',
321 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
323 'type' => 'EntityRef',
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'),
333 'where' => 'civicrm_batch.status_id',
334 'table_name' => 'civicrm_batch',
336 'bao' => 'CRM_Batch_BAO_Batch',
341 'pseudoconstant' => [
342 'optionGroupName' => 'batch_status',
343 'optionEditPath' => 'civicrm/admin/options/batch_status',
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',
355 'bao' => 'CRM_Batch_BAO_Batch',
360 'pseudoconstant' => [
361 'optionGroupName' => 'batch_type',
362 'optionEditPath' => 'civicrm/admin/options/batch_type',
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',
374 'bao' => 'CRM_Batch_BAO_Batch',
379 'pseudoconstant' => [
380 'optionGroupName' => 'batch_mode',
381 'optionEditPath' => 'civicrm/admin/options/batch_mode',
387 'type' => CRM_Utils_Type
::T_MONEY
,
388 'title' => ts('Batch Total'),
389 'description' => ts('Total amount for this batch.'),
394 'where' => 'civicrm_batch.total',
395 'table_name' => 'civicrm_batch',
397 'bao' => 'CRM_Batch_BAO_Batch',
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',
412 'bao' => 'CRM_Batch_BAO_Batch',
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',
427 'bao' => 'CRM_Batch_BAO_Batch',
432 'pseudoconstant' => [
433 'optionGroupName' => 'payment_instrument',
434 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
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',
445 'bao' => 'CRM_Batch_BAO_Batch',
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',
457 'bao' => 'CRM_Batch_BAO_Batch',
462 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
464 return Civi
::$statics[__CLASS__
]['fields'];
468 * Return a mapping from field-name to the corresponding key (as used in fields()).
471 * Array(string $name => string $uniqueName).
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()));
477 return Civi
::$statics[__CLASS__
]['fieldKeys'];
481 * Returns the names of this table
485 public static function getTableName() {
486 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
490 * Returns if this table needs to be logged
494 public function getLog() {
499 * Returns the list of fields that can be imported
501 * @param bool $prefix
505 public static function &import($prefix = FALSE) {
506 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
511 * Returns the list of fields that can be exported
513 * @param bool $prefix
517 public static function &export($prefix = FALSE) {
518 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
523 * Returns the list of indices
525 * @param bool $localize
529 public static function indices($localize = TRUE) {
536 'localizable' => FALSE,
538 'sig' => 'civicrm_batch::1::name',
541 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;