5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Batch/Batch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a9d49cd47b4a388ca88aa2af363f952d)
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 static $_tableName = 'civicrm_batch';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_batch',
189 'bao' => 'CRM_Batch_BAO_Batch',
194 'type' => CRM_Utils_Type
::T_STRING
,
195 'title' => ts('Batch Name'),
196 'description' => ts('Variable name/programmatic handle for this batch.'),
198 'size' => CRM_Utils_Type
::BIG
,
199 'table_name' => 'civicrm_batch',
201 'bao' => 'CRM_Batch_BAO_Batch',
209 'type' => CRM_Utils_Type
::T_STRING
,
210 'title' => ts('Batch Title'),
211 'description' => ts('Friendly Name.'),
213 'size' => CRM_Utils_Type
::HUGE
,
214 'table_name' => 'civicrm_batch',
216 'bao' => 'CRM_Batch_BAO_Batch',
223 'name' => 'description',
224 'type' => CRM_Utils_Type
::T_TEXT
,
225 'title' => ts('Batch Description'),
226 'description' => ts('Description of this batch set.'),
229 'table_name' => 'civicrm_batch',
231 'bao' => 'CRM_Batch_BAO_Batch',
234 'type' => 'TextArea',
238 'name' => 'created_id',
239 'type' => CRM_Utils_Type
::T_INT
,
240 'title' => ts('Batch Created By'),
241 'description' => ts('FK to Contact ID'),
242 'table_name' => 'civicrm_batch',
244 'bao' => 'CRM_Batch_BAO_Batch',
246 'FKClassName' => 'CRM_Contact_DAO_Contact',
249 'name' => 'created_date',
250 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
251 'title' => ts('Batch Created Date'),
252 'description' => ts('When was this item created'),
253 'table_name' => 'civicrm_batch',
255 'bao' => 'CRM_Batch_BAO_Batch',
258 'type' => 'Select Date',
262 'name' => 'modified_id',
263 'type' => CRM_Utils_Type
::T_INT
,
264 'title' => ts('Batch Modified By'),
265 'description' => ts('FK to Contact ID'),
266 'table_name' => 'civicrm_batch',
268 'bao' => 'CRM_Batch_BAO_Batch',
270 'FKClassName' => 'CRM_Contact_DAO_Contact',
273 'name' => 'modified_date',
274 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
275 'title' => ts('Batch Modified Date'),
276 'description' => ts('When was this item created'),
277 'table_name' => 'civicrm_batch',
279 'bao' => 'CRM_Batch_BAO_Batch',
282 'saved_search_id' => [
283 'name' => 'saved_search_id',
284 'type' => CRM_Utils_Type
::T_INT
,
285 'title' => ts('Batch Smart Group'),
286 'description' => ts('FK to Saved Search ID'),
287 'table_name' => 'civicrm_batch',
289 'bao' => 'CRM_Batch_BAO_Batch',
291 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
293 'type' => 'EntityRef',
297 'name' => 'status_id',
298 'type' => CRM_Utils_Type
::T_INT
,
299 'title' => ts('Batch Status'),
300 'description' => ts('fk to Batch Status options in civicrm_option_values'),
302 'table_name' => 'civicrm_batch',
304 'bao' => 'CRM_Batch_BAO_Batch',
309 'pseudoconstant' => [
310 'optionGroupName' => 'batch_status',
311 'optionEditPath' => 'civicrm/admin/options/batch_status',
316 'type' => CRM_Utils_Type
::T_INT
,
317 'title' => ts('Batch Type'),
318 'description' => ts('fk to Batch Type options in civicrm_option_values'),
319 'table_name' => 'civicrm_batch',
321 'bao' => 'CRM_Batch_BAO_Batch',
326 'pseudoconstant' => [
327 'optionGroupName' => 'batch_type',
328 'optionEditPath' => 'civicrm/admin/options/batch_type',
333 'type' => CRM_Utils_Type
::T_INT
,
334 'title' => ts('Batch Mode'),
335 'description' => ts('fk to Batch mode options in civicrm_option_values'),
336 'table_name' => 'civicrm_batch',
338 'bao' => 'CRM_Batch_BAO_Batch',
343 'pseudoconstant' => [
344 'optionGroupName' => 'batch_mode',
345 'optionEditPath' => 'civicrm/admin/options/batch_mode',
350 'type' => CRM_Utils_Type
::T_MONEY
,
351 'title' => ts('Batch Total'),
352 'description' => ts('Total amount for this batch.'),
357 'table_name' => 'civicrm_batch',
359 'bao' => 'CRM_Batch_BAO_Batch',
366 'name' => 'item_count',
367 'type' => CRM_Utils_Type
::T_INT
,
368 'title' => ts('Batch Number of Items'),
369 'description' => ts('Number of items in a batch.'),
370 'table_name' => 'civicrm_batch',
372 'bao' => 'CRM_Batch_BAO_Batch',
378 'payment_instrument_id' => [
379 'name' => 'payment_instrument_id',
380 'type' => CRM_Utils_Type
::T_INT
,
381 'title' => ts('Batch Payment Method'),
382 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
383 'table_name' => 'civicrm_batch',
385 'bao' => 'CRM_Batch_BAO_Batch',
390 'pseudoconstant' => [
391 'optionGroupName' => 'payment_instrument',
392 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
396 'name' => 'exported_date',
397 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
398 'title' => ts('Batch Exported Date'),
399 'table_name' => 'civicrm_batch',
401 'bao' => 'CRM_Batch_BAO_Batch',
406 'type' => CRM_Utils_Type
::T_LONGTEXT
,
407 'title' => ts('Batch Data'),
408 'description' => ts('cache entered data'),
409 'table_name' => 'civicrm_batch',
411 'bao' => 'CRM_Batch_BAO_Batch',
415 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
417 return Civi
::$statics[__CLASS__
]['fields'];
421 * Return a mapping from field-name to the corresponding key (as used in fields()).
424 * Array(string $name => string $uniqueName).
426 public static function &fieldKeys() {
427 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
428 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
430 return Civi
::$statics[__CLASS__
]['fieldKeys'];
434 * Returns the names of this table
438 public static function getTableName() {
439 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
443 * Returns if this table needs to be logged
447 public function getLog() {
452 * Returns the list of fields that can be imported
454 * @param bool $prefix
458 public static function &import($prefix = FALSE) {
459 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'batch', $prefix, []);
464 * Returns the list of fields that can be exported
466 * @param bool $prefix
470 public static function &export($prefix = FALSE) {
471 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'batch', $prefix, []);
476 * Returns the list of indices
478 * @param bool $localize
482 public static function indices($localize = TRUE) {
489 'localizable' => FALSE,
491 'sig' => 'civicrm_batch::1::name',
494 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;