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:1fc78ed79da3731e7c082cf678ae6753)
13 * Database access object for the Batch entity.
15 class CRM_Batch_DAO_Batch
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_batch';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
39 * Variable name/programmatic handle for this batch.
53 * Description of this batch set.
67 * When was this item created
81 * When was this item created
85 public $modified_date;
88 * FK to Saved Search ID
92 public $saved_search_id;
95 * fk to Batch Status options in civicrm_option_values
102 * fk to Batch Type options in civicrm_option_values
109 * fk to Batch mode options in civicrm_option_values
116 * Total amount for this batch.
123 * Number of items in a batch.
130 * fk to Payment Instrument options in civicrm_option_values
134 public $payment_instrument_id;
139 public $exported_date;
151 public function __construct() {
152 $this->__table
= 'civicrm_batch';
153 parent
::__construct();
157 * Returns localized title of this entity.
159 public static function getEntityTitle() {
160 return ts('Batches');
164 * Returns foreign keys and entity references.
167 * [CRM_Core_Reference_Interface]
169 public static function getReferenceColumns() {
170 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
171 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
172 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
173 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
174 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
175 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
177 return Civi
::$statics[__CLASS__
]['links'];
181 * Returns all the column names of this table
185 public static function &fields() {
186 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
187 Civi
::$statics[__CLASS__
]['fields'] = [
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Batch ID'),
192 'description' => ts('Unique Address ID'),
194 'where' => 'civicrm_batch.id',
195 'table_name' => 'civicrm_batch',
197 'bao' => 'CRM_Batch_BAO_Batch',
203 'type' => CRM_Utils_Type
::T_STRING
,
204 'title' => ts('Batch Name'),
205 'description' => ts('Variable name/programmatic handle for this batch.'),
207 'size' => CRM_Utils_Type
::BIG
,
208 'where' => 'civicrm_batch.name',
209 'table_name' => 'civicrm_batch',
211 'bao' => 'CRM_Batch_BAO_Batch',
220 'type' => CRM_Utils_Type
::T_STRING
,
221 'title' => ts('Batch Title'),
222 'description' => ts('Friendly Name.'),
224 'size' => CRM_Utils_Type
::HUGE
,
225 'where' => 'civicrm_batch.title',
226 'table_name' => 'civicrm_batch',
228 'bao' => 'CRM_Batch_BAO_Batch',
236 'name' => 'description',
237 'type' => CRM_Utils_Type
::T_TEXT
,
238 'title' => ts('Batch Description'),
239 'description' => ts('Description of this batch set.'),
242 'where' => 'civicrm_batch.description',
243 'table_name' => 'civicrm_batch',
245 'bao' => 'CRM_Batch_BAO_Batch',
248 'type' => 'TextArea',
253 'name' => 'created_id',
254 'type' => CRM_Utils_Type
::T_INT
,
255 'title' => ts('Batch Created By'),
256 'description' => ts('FK to Contact ID'),
257 'where' => 'civicrm_batch.created_id',
258 'table_name' => 'civicrm_batch',
260 'bao' => 'CRM_Batch_BAO_Batch',
262 'FKClassName' => 'CRM_Contact_DAO_Contact',
266 'name' => 'created_date',
267 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
268 'title' => ts('Batch Created Date'),
269 'description' => ts('When was this item created'),
270 'where' => 'civicrm_batch.created_date',
271 'table_name' => 'civicrm_batch',
273 'bao' => 'CRM_Batch_BAO_Batch',
276 'type' => 'Select Date',
281 'name' => 'modified_id',
282 'type' => CRM_Utils_Type
::T_INT
,
283 'title' => ts('Batch Modified By'),
284 'description' => ts('FK to Contact ID'),
285 'where' => 'civicrm_batch.modified_id',
286 'table_name' => 'civicrm_batch',
288 'bao' => 'CRM_Batch_BAO_Batch',
290 'FKClassName' => 'CRM_Contact_DAO_Contact',
294 'name' => 'modified_date',
295 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
296 'title' => ts('Batch Modified Date'),
297 'description' => ts('When was this item created'),
298 'where' => 'civicrm_batch.modified_date',
299 'table_name' => 'civicrm_batch',
301 'bao' => 'CRM_Batch_BAO_Batch',
305 'saved_search_id' => [
306 'name' => 'saved_search_id',
307 'type' => CRM_Utils_Type
::T_INT
,
308 'title' => ts('Batch Smart Group'),
309 'description' => ts('FK to Saved Search ID'),
310 'where' => 'civicrm_batch.saved_search_id',
311 'table_name' => 'civicrm_batch',
313 'bao' => 'CRM_Batch_BAO_Batch',
315 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
317 'type' => 'EntityRef',
322 'name' => 'status_id',
323 'type' => CRM_Utils_Type
::T_INT
,
324 'title' => ts('Batch Status'),
325 'description' => ts('fk to Batch Status options in civicrm_option_values'),
327 'where' => 'civicrm_batch.status_id',
328 'table_name' => 'civicrm_batch',
330 'bao' => 'CRM_Batch_BAO_Batch',
335 'pseudoconstant' => [
336 'optionGroupName' => 'batch_status',
337 'optionEditPath' => 'civicrm/admin/options/batch_status',
343 'type' => CRM_Utils_Type
::T_INT
,
344 'title' => ts('Batch Type'),
345 'description' => ts('fk to Batch Type options in civicrm_option_values'),
346 'where' => 'civicrm_batch.type_id',
347 'table_name' => 'civicrm_batch',
349 'bao' => 'CRM_Batch_BAO_Batch',
354 'pseudoconstant' => [
355 'optionGroupName' => 'batch_type',
356 'optionEditPath' => 'civicrm/admin/options/batch_type',
362 'type' => CRM_Utils_Type
::T_INT
,
363 'title' => ts('Batch Mode'),
364 'description' => ts('fk to Batch mode options in civicrm_option_values'),
365 'where' => 'civicrm_batch.mode_id',
366 'table_name' => 'civicrm_batch',
368 'bao' => 'CRM_Batch_BAO_Batch',
373 'pseudoconstant' => [
374 'optionGroupName' => 'batch_mode',
375 'optionEditPath' => 'civicrm/admin/options/batch_mode',
381 'type' => CRM_Utils_Type
::T_MONEY
,
382 'title' => ts('Batch Total'),
383 'description' => ts('Total amount for this batch.'),
388 'where' => 'civicrm_batch.total',
389 'table_name' => 'civicrm_batch',
391 'bao' => 'CRM_Batch_BAO_Batch',
399 'name' => 'item_count',
400 'type' => CRM_Utils_Type
::T_INT
,
401 'title' => ts('Batch Number of Items'),
402 'description' => ts('Number of items in a batch.'),
403 'where' => 'civicrm_batch.item_count',
404 'table_name' => 'civicrm_batch',
406 'bao' => 'CRM_Batch_BAO_Batch',
413 'payment_instrument_id' => [
414 'name' => 'payment_instrument_id',
415 'type' => CRM_Utils_Type
::T_INT
,
416 'title' => ts('Batch Payment Method'),
417 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
418 'where' => 'civicrm_batch.payment_instrument_id',
419 'table_name' => 'civicrm_batch',
421 'bao' => 'CRM_Batch_BAO_Batch',
426 'pseudoconstant' => [
427 'optionGroupName' => 'payment_instrument',
428 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
433 'name' => 'exported_date',
434 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
435 'title' => ts('Batch Exported Date'),
436 'where' => 'civicrm_batch.exported_date',
437 'table_name' => 'civicrm_batch',
439 'bao' => 'CRM_Batch_BAO_Batch',
445 'type' => CRM_Utils_Type
::T_LONGTEXT
,
446 'title' => ts('Batch Data'),
447 'description' => ts('cache entered data'),
448 'where' => 'civicrm_batch.data',
449 'table_name' => 'civicrm_batch',
451 'bao' => 'CRM_Batch_BAO_Batch',
456 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
458 return Civi
::$statics[__CLASS__
]['fields'];
462 * Return a mapping from field-name to the corresponding key (as used in fields()).
465 * Array(string $name => string $uniqueName).
467 public static function &fieldKeys() {
468 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
469 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
471 return Civi
::$statics[__CLASS__
]['fieldKeys'];
475 * Returns the names of this table
479 public static function getTableName() {
480 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
484 * Returns if this table needs to be logged
488 public function getLog() {
493 * Returns the list of fields that can be imported
495 * @param bool $prefix
499 public static function &import($prefix = FALSE) {
500 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
505 * Returns the list of fields that can be exported
507 * @param bool $prefix
511 public static function &export($prefix = FALSE) {
512 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
517 * Returns the list of indices
519 * @param bool $localize
523 public static function indices($localize = TRUE) {
530 'localizable' => FALSE,
532 'sig' => 'civicrm_batch::1::name',
535 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;