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:8169fc2f338afc4a163214c0018030be)
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 public static function getEntityTitle() {
162 return ts('Batches');
166 * Returns foreign keys and entity references.
169 * [CRM_Core_Reference_Interface]
171 public static function getReferenceColumns() {
172 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
173 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
174 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
175 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
176 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
177 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
179 return Civi
::$statics[__CLASS__
]['links'];
183 * Returns all the column names of this table
187 public static function &fields() {
188 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
189 Civi
::$statics[__CLASS__
]['fields'] = [
192 'type' => CRM_Utils_Type
::T_INT
,
193 'title' => ts('Batch ID'),
194 'description' => ts('Unique Address ID'),
196 'where' => 'civicrm_batch.id',
197 'table_name' => 'civicrm_batch',
199 'bao' => 'CRM_Batch_BAO_Batch',
205 'type' => CRM_Utils_Type
::T_STRING
,
206 'title' => ts('Batch Name'),
207 'description' => ts('Variable name/programmatic handle for this batch.'),
209 'size' => CRM_Utils_Type
::BIG
,
210 'where' => 'civicrm_batch.name',
211 'table_name' => 'civicrm_batch',
213 'bao' => 'CRM_Batch_BAO_Batch',
222 'type' => CRM_Utils_Type
::T_STRING
,
223 'title' => ts('Batch Title'),
224 'description' => ts('Friendly Name.'),
226 'size' => CRM_Utils_Type
::HUGE
,
227 'where' => 'civicrm_batch.title',
228 'table_name' => 'civicrm_batch',
230 'bao' => 'CRM_Batch_BAO_Batch',
238 'name' => 'description',
239 'type' => CRM_Utils_Type
::T_TEXT
,
240 'title' => ts('Batch Description'),
241 'description' => ts('Description of this batch set.'),
244 'where' => 'civicrm_batch.description',
245 'table_name' => 'civicrm_batch',
247 'bao' => 'CRM_Batch_BAO_Batch',
250 'type' => 'TextArea',
255 'name' => 'created_id',
256 'type' => CRM_Utils_Type
::T_INT
,
257 'title' => ts('Batch Created By'),
258 'description' => ts('FK to Contact ID'),
259 'where' => 'civicrm_batch.created_id',
260 'table_name' => 'civicrm_batch',
262 'bao' => 'CRM_Batch_BAO_Batch',
264 'FKClassName' => 'CRM_Contact_DAO_Contact',
268 'name' => 'created_date',
269 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
270 'title' => ts('Batch Created Date'),
271 'description' => ts('When was this item created'),
272 'where' => 'civicrm_batch.created_date',
273 'table_name' => 'civicrm_batch',
275 'bao' => 'CRM_Batch_BAO_Batch',
278 'type' => 'Select Date',
279 'formatType' => 'activityDateTime',
284 'name' => 'modified_id',
285 'type' => CRM_Utils_Type
::T_INT
,
286 'title' => ts('Batch Modified By'),
287 'description' => ts('FK to Contact ID'),
288 'where' => 'civicrm_batch.modified_id',
289 'table_name' => 'civicrm_batch',
291 'bao' => 'CRM_Batch_BAO_Batch',
293 'FKClassName' => 'CRM_Contact_DAO_Contact',
297 'name' => 'modified_date',
298 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
299 'title' => ts('Batch Modified Date'),
300 'description' => ts('When was this item created'),
301 'where' => 'civicrm_batch.modified_date',
302 'table_name' => 'civicrm_batch',
304 'bao' => 'CRM_Batch_BAO_Batch',
308 'saved_search_id' => [
309 'name' => 'saved_search_id',
310 'type' => CRM_Utils_Type
::T_INT
,
311 'title' => ts('Batch Smart Group'),
312 'description' => ts('FK to Saved Search ID'),
313 'where' => 'civicrm_batch.saved_search_id',
314 'table_name' => 'civicrm_batch',
316 'bao' => 'CRM_Batch_BAO_Batch',
318 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
320 'type' => 'EntityRef',
325 'name' => 'status_id',
326 'type' => CRM_Utils_Type
::T_INT
,
327 'title' => ts('Batch Status'),
328 'description' => ts('fk to Batch Status options in civicrm_option_values'),
330 'where' => 'civicrm_batch.status_id',
331 'table_name' => 'civicrm_batch',
333 'bao' => 'CRM_Batch_BAO_Batch',
338 'pseudoconstant' => [
339 'optionGroupName' => 'batch_status',
340 'optionEditPath' => 'civicrm/admin/options/batch_status',
346 'type' => CRM_Utils_Type
::T_INT
,
347 'title' => ts('Batch Type'),
348 'description' => ts('fk to Batch Type options in civicrm_option_values'),
349 'where' => 'civicrm_batch.type_id',
350 'table_name' => 'civicrm_batch',
352 'bao' => 'CRM_Batch_BAO_Batch',
357 'pseudoconstant' => [
358 'optionGroupName' => 'batch_type',
359 'optionEditPath' => 'civicrm/admin/options/batch_type',
365 'type' => CRM_Utils_Type
::T_INT
,
366 'title' => ts('Batch Mode'),
367 'description' => ts('fk to Batch mode options in civicrm_option_values'),
368 'where' => 'civicrm_batch.mode_id',
369 'table_name' => 'civicrm_batch',
371 'bao' => 'CRM_Batch_BAO_Batch',
376 'pseudoconstant' => [
377 'optionGroupName' => 'batch_mode',
378 'optionEditPath' => 'civicrm/admin/options/batch_mode',
384 'type' => CRM_Utils_Type
::T_MONEY
,
385 'title' => ts('Batch Total'),
386 'description' => ts('Total amount for this batch.'),
391 'where' => 'civicrm_batch.total',
392 'table_name' => 'civicrm_batch',
394 'bao' => 'CRM_Batch_BAO_Batch',
402 'name' => 'item_count',
403 'type' => CRM_Utils_Type
::T_INT
,
404 'title' => ts('Batch Number of Items'),
405 'description' => ts('Number of items in a batch.'),
406 'where' => 'civicrm_batch.item_count',
407 'table_name' => 'civicrm_batch',
409 'bao' => 'CRM_Batch_BAO_Batch',
416 'payment_instrument_id' => [
417 'name' => 'payment_instrument_id',
418 'type' => CRM_Utils_Type
::T_INT
,
419 'title' => ts('Batch Payment Method'),
420 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
421 'where' => 'civicrm_batch.payment_instrument_id',
422 'table_name' => 'civicrm_batch',
424 'bao' => 'CRM_Batch_BAO_Batch',
429 'pseudoconstant' => [
430 'optionGroupName' => 'payment_instrument',
431 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
436 'name' => 'exported_date',
437 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
438 'title' => ts('Batch Exported Date'),
439 'where' => 'civicrm_batch.exported_date',
440 'table_name' => 'civicrm_batch',
442 'bao' => 'CRM_Batch_BAO_Batch',
448 'type' => CRM_Utils_Type
::T_LONGTEXT
,
449 'title' => ts('Batch Data'),
450 'description' => ts('cache entered data'),
451 'where' => 'civicrm_batch.data',
452 'table_name' => 'civicrm_batch',
454 'bao' => 'CRM_Batch_BAO_Batch',
459 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
461 return Civi
::$statics[__CLASS__
]['fields'];
465 * Return a mapping from field-name to the corresponding key (as used in fields()).
468 * Array(string $name => string $uniqueName).
470 public static function &fieldKeys() {
471 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
472 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
474 return Civi
::$statics[__CLASS__
]['fieldKeys'];
478 * Returns the names of this table
482 public static function getTableName() {
483 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
487 * Returns if this table needs to be logged
491 public function getLog() {
496 * Returns the list of fields that can be imported
498 * @param bool $prefix
502 public static function &import($prefix = FALSE) {
503 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
508 * Returns the list of fields that can be exported
510 * @param bool $prefix
514 public static function &export($prefix = FALSE) {
515 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
520 * Returns the list of indices
522 * @param bool $localize
526 public static function indices($localize = TRUE) {
533 'localizable' => FALSE,
535 'sig' => 'civicrm_batch::1::name',
538 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;