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:ec065dd0aaa794ee44d5fb2216deac3d)
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 foreign keys and entity references.
160 * [CRM_Core_Reference_Interface]
162 public static function getReferenceColumns() {
163 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
164 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
165 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
166 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
167 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
168 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
170 return Civi
::$statics[__CLASS__
]['links'];
174 * Returns all the column names of this table
178 public static function &fields() {
179 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
180 Civi
::$statics[__CLASS__
]['fields'] = [
183 'type' => CRM_Utils_Type
::T_INT
,
184 'title' => ts('Batch ID'),
185 'description' => ts('Unique Address ID'),
187 'where' => 'civicrm_batch.id',
188 'table_name' => 'civicrm_batch',
190 'bao' => 'CRM_Batch_BAO_Batch',
195 'type' => CRM_Utils_Type
::T_STRING
,
196 'title' => ts('Batch Name'),
197 'description' => ts('Variable name/programmatic handle for this batch.'),
199 'size' => CRM_Utils_Type
::BIG
,
200 'where' => 'civicrm_batch.name',
201 'table_name' => 'civicrm_batch',
203 'bao' => 'CRM_Batch_BAO_Batch',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Batch Title'),
213 'description' => ts('Friendly Name.'),
215 'size' => CRM_Utils_Type
::HUGE
,
216 'where' => 'civicrm_batch.title',
217 'table_name' => 'civicrm_batch',
219 'bao' => 'CRM_Batch_BAO_Batch',
226 'name' => 'description',
227 'type' => CRM_Utils_Type
::T_TEXT
,
228 'title' => ts('Batch Description'),
229 'description' => ts('Description of this batch set.'),
232 'where' => 'civicrm_batch.description',
233 'table_name' => 'civicrm_batch',
235 'bao' => 'CRM_Batch_BAO_Batch',
238 'type' => 'TextArea',
242 'name' => 'created_id',
243 'type' => CRM_Utils_Type
::T_INT
,
244 'title' => ts('Batch Created By'),
245 'description' => ts('FK to Contact ID'),
246 'where' => 'civicrm_batch.created_id',
247 'table_name' => 'civicrm_batch',
249 'bao' => 'CRM_Batch_BAO_Batch',
251 'FKClassName' => 'CRM_Contact_DAO_Contact',
254 'name' => 'created_date',
255 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
256 'title' => ts('Batch Created Date'),
257 'description' => ts('When was this item created'),
258 'where' => 'civicrm_batch.created_date',
259 'table_name' => 'civicrm_batch',
261 'bao' => 'CRM_Batch_BAO_Batch',
264 'type' => 'Select Date',
268 'name' => 'modified_id',
269 'type' => CRM_Utils_Type
::T_INT
,
270 'title' => ts('Batch Modified By'),
271 'description' => ts('FK to Contact ID'),
272 'where' => 'civicrm_batch.modified_id',
273 'table_name' => 'civicrm_batch',
275 'bao' => 'CRM_Batch_BAO_Batch',
277 'FKClassName' => 'CRM_Contact_DAO_Contact',
280 'name' => 'modified_date',
281 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
282 'title' => ts('Batch Modified Date'),
283 'description' => ts('When was this item created'),
284 'where' => 'civicrm_batch.modified_date',
285 'table_name' => 'civicrm_batch',
287 'bao' => 'CRM_Batch_BAO_Batch',
290 'saved_search_id' => [
291 'name' => 'saved_search_id',
292 'type' => CRM_Utils_Type
::T_INT
,
293 'title' => ts('Batch Smart Group'),
294 'description' => ts('FK to Saved Search ID'),
295 'where' => 'civicrm_batch.saved_search_id',
296 'table_name' => 'civicrm_batch',
298 'bao' => 'CRM_Batch_BAO_Batch',
300 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
302 'type' => 'EntityRef',
306 'name' => 'status_id',
307 'type' => CRM_Utils_Type
::T_INT
,
308 'title' => ts('Batch Status'),
309 'description' => ts('fk to Batch Status options in civicrm_option_values'),
311 'where' => 'civicrm_batch.status_id',
312 'table_name' => 'civicrm_batch',
314 'bao' => 'CRM_Batch_BAO_Batch',
319 'pseudoconstant' => [
320 'optionGroupName' => 'batch_status',
321 'optionEditPath' => 'civicrm/admin/options/batch_status',
326 'type' => CRM_Utils_Type
::T_INT
,
327 'title' => ts('Batch Type'),
328 'description' => ts('fk to Batch Type options in civicrm_option_values'),
329 'where' => 'civicrm_batch.type_id',
330 'table_name' => 'civicrm_batch',
332 'bao' => 'CRM_Batch_BAO_Batch',
337 'pseudoconstant' => [
338 'optionGroupName' => 'batch_type',
339 'optionEditPath' => 'civicrm/admin/options/batch_type',
344 'type' => CRM_Utils_Type
::T_INT
,
345 'title' => ts('Batch Mode'),
346 'description' => ts('fk to Batch mode options in civicrm_option_values'),
347 'where' => 'civicrm_batch.mode_id',
348 'table_name' => 'civicrm_batch',
350 'bao' => 'CRM_Batch_BAO_Batch',
355 'pseudoconstant' => [
356 'optionGroupName' => 'batch_mode',
357 'optionEditPath' => 'civicrm/admin/options/batch_mode',
362 'type' => CRM_Utils_Type
::T_MONEY
,
363 'title' => ts('Batch Total'),
364 'description' => ts('Total amount for this batch.'),
369 'where' => 'civicrm_batch.total',
370 'table_name' => 'civicrm_batch',
372 'bao' => 'CRM_Batch_BAO_Batch',
379 'name' => 'item_count',
380 'type' => CRM_Utils_Type
::T_INT
,
381 'title' => ts('Batch Number of Items'),
382 'description' => ts('Number of items in a batch.'),
383 'where' => 'civicrm_batch.item_count',
384 'table_name' => 'civicrm_batch',
386 'bao' => 'CRM_Batch_BAO_Batch',
392 'payment_instrument_id' => [
393 'name' => 'payment_instrument_id',
394 'type' => CRM_Utils_Type
::T_INT
,
395 'title' => ts('Batch Payment Method'),
396 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
397 'where' => 'civicrm_batch.payment_instrument_id',
398 'table_name' => 'civicrm_batch',
400 'bao' => 'CRM_Batch_BAO_Batch',
405 'pseudoconstant' => [
406 'optionGroupName' => 'payment_instrument',
407 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
411 'name' => 'exported_date',
412 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
413 'title' => ts('Batch Exported Date'),
414 'where' => 'civicrm_batch.exported_date',
415 'table_name' => 'civicrm_batch',
417 'bao' => 'CRM_Batch_BAO_Batch',
422 'type' => CRM_Utils_Type
::T_LONGTEXT
,
423 'title' => ts('Batch Data'),
424 'description' => ts('cache entered data'),
425 'where' => 'civicrm_batch.data',
426 'table_name' => 'civicrm_batch',
428 'bao' => 'CRM_Batch_BAO_Batch',
432 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
434 return Civi
::$statics[__CLASS__
]['fields'];
438 * Return a mapping from field-name to the corresponding key (as used in fields()).
441 * Array(string $name => string $uniqueName).
443 public static function &fieldKeys() {
444 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
445 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
447 return Civi
::$statics[__CLASS__
]['fieldKeys'];
451 * Returns the names of this table
455 public static function getTableName() {
456 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
460 * Returns if this table needs to be logged
464 public function getLog() {
469 * Returns the list of fields that can be imported
471 * @param bool $prefix
475 public static function &import($prefix = FALSE) {
476 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
481 * Returns the list of fields that can be exported
483 * @param bool $prefix
487 public static function &export($prefix = FALSE) {
488 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
493 * Returns the list of indices
495 * @param bool $localize
499 public static function indices($localize = TRUE) {
506 'localizable' => FALSE,
508 'sig' => 'civicrm_batch::1::name',
511 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;