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:a1b3aef6caf88c912e7cc40e1220ae67)
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',
202 'type' => CRM_Utils_Type
::T_STRING
,
203 'title' => ts('Batch Name'),
204 'description' => ts('Variable name/programmatic handle for this batch.'),
206 'size' => CRM_Utils_Type
::BIG
,
207 'where' => 'civicrm_batch.name',
208 'table_name' => 'civicrm_batch',
210 'bao' => 'CRM_Batch_BAO_Batch',
218 'type' => CRM_Utils_Type
::T_STRING
,
219 'title' => ts('Batch Title'),
220 'description' => ts('Friendly Name.'),
222 'size' => CRM_Utils_Type
::HUGE
,
223 'where' => 'civicrm_batch.title',
224 'table_name' => 'civicrm_batch',
226 'bao' => 'CRM_Batch_BAO_Batch',
233 'name' => 'description',
234 'type' => CRM_Utils_Type
::T_TEXT
,
235 'title' => ts('Batch Description'),
236 'description' => ts('Description of this batch set.'),
239 'where' => 'civicrm_batch.description',
240 'table_name' => 'civicrm_batch',
242 'bao' => 'CRM_Batch_BAO_Batch',
245 'type' => 'TextArea',
249 'name' => 'created_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Batch Created By'),
252 'description' => ts('FK to Contact ID'),
253 'where' => 'civicrm_batch.created_id',
254 'table_name' => 'civicrm_batch',
256 'bao' => 'CRM_Batch_BAO_Batch',
258 'FKClassName' => 'CRM_Contact_DAO_Contact',
261 'name' => 'created_date',
262 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
263 'title' => ts('Batch Created Date'),
264 'description' => ts('When was this item created'),
265 'where' => 'civicrm_batch.created_date',
266 'table_name' => 'civicrm_batch',
268 'bao' => 'CRM_Batch_BAO_Batch',
271 'type' => 'Select Date',
275 'name' => 'modified_id',
276 'type' => CRM_Utils_Type
::T_INT
,
277 'title' => ts('Batch Modified By'),
278 'description' => ts('FK to Contact ID'),
279 'where' => 'civicrm_batch.modified_id',
280 'table_name' => 'civicrm_batch',
282 'bao' => 'CRM_Batch_BAO_Batch',
284 'FKClassName' => 'CRM_Contact_DAO_Contact',
287 'name' => 'modified_date',
288 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
289 'title' => ts('Batch Modified Date'),
290 'description' => ts('When was this item created'),
291 'where' => 'civicrm_batch.modified_date',
292 'table_name' => 'civicrm_batch',
294 'bao' => 'CRM_Batch_BAO_Batch',
297 'saved_search_id' => [
298 'name' => 'saved_search_id',
299 'type' => CRM_Utils_Type
::T_INT
,
300 'title' => ts('Batch Smart Group'),
301 'description' => ts('FK to Saved Search ID'),
302 'where' => 'civicrm_batch.saved_search_id',
303 'table_name' => 'civicrm_batch',
305 'bao' => 'CRM_Batch_BAO_Batch',
307 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
309 'type' => 'EntityRef',
313 'name' => 'status_id',
314 'type' => CRM_Utils_Type
::T_INT
,
315 'title' => ts('Batch Status'),
316 'description' => ts('fk to Batch Status options in civicrm_option_values'),
318 'where' => 'civicrm_batch.status_id',
319 'table_name' => 'civicrm_batch',
321 'bao' => 'CRM_Batch_BAO_Batch',
326 'pseudoconstant' => [
327 'optionGroupName' => 'batch_status',
328 'optionEditPath' => 'civicrm/admin/options/batch_status',
333 'type' => CRM_Utils_Type
::T_INT
,
334 'title' => ts('Batch Type'),
335 'description' => ts('fk to Batch Type options in civicrm_option_values'),
336 'where' => 'civicrm_batch.type_id',
337 'table_name' => 'civicrm_batch',
339 'bao' => 'CRM_Batch_BAO_Batch',
344 'pseudoconstant' => [
345 'optionGroupName' => 'batch_type',
346 'optionEditPath' => 'civicrm/admin/options/batch_type',
351 'type' => CRM_Utils_Type
::T_INT
,
352 'title' => ts('Batch Mode'),
353 'description' => ts('fk to Batch mode options in civicrm_option_values'),
354 'where' => 'civicrm_batch.mode_id',
355 'table_name' => 'civicrm_batch',
357 'bao' => 'CRM_Batch_BAO_Batch',
362 'pseudoconstant' => [
363 'optionGroupName' => 'batch_mode',
364 'optionEditPath' => 'civicrm/admin/options/batch_mode',
369 'type' => CRM_Utils_Type
::T_MONEY
,
370 'title' => ts('Batch Total'),
371 'description' => ts('Total amount for this batch.'),
376 'where' => 'civicrm_batch.total',
377 'table_name' => 'civicrm_batch',
379 'bao' => 'CRM_Batch_BAO_Batch',
386 'name' => 'item_count',
387 'type' => CRM_Utils_Type
::T_INT
,
388 'title' => ts('Batch Number of Items'),
389 'description' => ts('Number of items in a batch.'),
390 'where' => 'civicrm_batch.item_count',
391 'table_name' => 'civicrm_batch',
393 'bao' => 'CRM_Batch_BAO_Batch',
399 'payment_instrument_id' => [
400 'name' => 'payment_instrument_id',
401 'type' => CRM_Utils_Type
::T_INT
,
402 'title' => ts('Batch Payment Method'),
403 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
404 'where' => 'civicrm_batch.payment_instrument_id',
405 'table_name' => 'civicrm_batch',
407 'bao' => 'CRM_Batch_BAO_Batch',
412 'pseudoconstant' => [
413 'optionGroupName' => 'payment_instrument',
414 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
418 'name' => 'exported_date',
419 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
420 'title' => ts('Batch Exported Date'),
421 'where' => 'civicrm_batch.exported_date',
422 'table_name' => 'civicrm_batch',
424 'bao' => 'CRM_Batch_BAO_Batch',
429 'type' => CRM_Utils_Type
::T_LONGTEXT
,
430 'title' => ts('Batch Data'),
431 'description' => ts('cache entered data'),
432 'where' => 'civicrm_batch.data',
433 'table_name' => 'civicrm_batch',
435 'bao' => 'CRM_Batch_BAO_Batch',
439 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
441 return Civi
::$statics[__CLASS__
]['fields'];
445 * Return a mapping from field-name to the corresponding key (as used in fields()).
448 * Array(string $name => string $uniqueName).
450 public static function &fieldKeys() {
451 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
452 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
454 return Civi
::$statics[__CLASS__
]['fieldKeys'];
458 * Returns the names of this table
462 public static function getTableName() {
463 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
467 * Returns if this table needs to be logged
471 public function getLog() {
476 * Returns the list of fields that can be imported
478 * @param bool $prefix
482 public static function &import($prefix = FALSE) {
483 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
488 * Returns the list of fields that can be exported
490 * @param bool $prefix
494 public static function &export($prefix = FALSE) {
495 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
500 * Returns the list of indices
502 * @param bool $localize
506 public static function indices($localize = TRUE) {
513 'localizable' => FALSE,
515 'sig' => 'civicrm_batch::1::name',
518 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;