| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Batch/Batch.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:ec065dd0aaa794ee44d5fb2216deac3d) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the Batch entity. |
| 14 | */ |
| 15 | class CRM_Batch_DAO_Batch extends CRM_Core_DAO { |
| 16 | |
| 17 | /** |
| 18 | * Static instance to hold the table name. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | public static $_tableName = 'civicrm_batch'; |
| 23 | |
| 24 | /** |
| 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | public static $_log = FALSE; |
| 30 | |
| 31 | /** |
| 32 | * Unique Address ID |
| 33 | * |
| 34 | * @var int |
| 35 | */ |
| 36 | public $id; |
| 37 | |
| 38 | /** |
| 39 | * Variable name/programmatic handle for this batch. |
| 40 | * |
| 41 | * @var string |
| 42 | */ |
| 43 | public $name; |
| 44 | |
| 45 | /** |
| 46 | * Friendly Name. |
| 47 | * |
| 48 | * @var string |
| 49 | */ |
| 50 | public $title; |
| 51 | |
| 52 | /** |
| 53 | * Description of this batch set. |
| 54 | * |
| 55 | * @var text |
| 56 | */ |
| 57 | public $description; |
| 58 | |
| 59 | /** |
| 60 | * FK to Contact ID |
| 61 | * |
| 62 | * @var int |
| 63 | */ |
| 64 | public $created_id; |
| 65 | |
| 66 | /** |
| 67 | * When was this item created |
| 68 | * |
| 69 | * @var datetime |
| 70 | */ |
| 71 | public $created_date; |
| 72 | |
| 73 | /** |
| 74 | * FK to Contact ID |
| 75 | * |
| 76 | * @var int |
| 77 | */ |
| 78 | public $modified_id; |
| 79 | |
| 80 | /** |
| 81 | * When was this item created |
| 82 | * |
| 83 | * @var datetime |
| 84 | */ |
| 85 | public $modified_date; |
| 86 | |
| 87 | /** |
| 88 | * FK to Saved Search ID |
| 89 | * |
| 90 | * @var int |
| 91 | */ |
| 92 | public $saved_search_id; |
| 93 | |
| 94 | /** |
| 95 | * fk to Batch Status options in civicrm_option_values |
| 96 | * |
| 97 | * @var int |
| 98 | */ |
| 99 | public $status_id; |
| 100 | |
| 101 | /** |
| 102 | * fk to Batch Type options in civicrm_option_values |
| 103 | * |
| 104 | * @var int |
| 105 | */ |
| 106 | public $type_id; |
| 107 | |
| 108 | /** |
| 109 | * fk to Batch mode options in civicrm_option_values |
| 110 | * |
| 111 | * @var int |
| 112 | */ |
| 113 | public $mode_id; |
| 114 | |
| 115 | /** |
| 116 | * Total amount for this batch. |
| 117 | * |
| 118 | * @var float |
| 119 | */ |
| 120 | public $total; |
| 121 | |
| 122 | /** |
| 123 | * Number of items in a batch. |
| 124 | * |
| 125 | * @var int |
| 126 | */ |
| 127 | public $item_count; |
| 128 | |
| 129 | /** |
| 130 | * fk to Payment Instrument options in civicrm_option_values |
| 131 | * |
| 132 | * @var int |
| 133 | */ |
| 134 | public $payment_instrument_id; |
| 135 | |
| 136 | /** |
| 137 | * @var datetime |
| 138 | */ |
| 139 | public $exported_date; |
| 140 | |
| 141 | /** |
| 142 | * cache entered data |
| 143 | * |
| 144 | * @var longtext |
| 145 | */ |
| 146 | public $data; |
| 147 | |
| 148 | /** |
| 149 | * Class constructor. |
| 150 | */ |
| 151 | public function __construct() { |
| 152 | $this->__table = 'civicrm_batch'; |
| 153 | parent::__construct(); |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Returns foreign keys and entity references. |
| 158 | * |
| 159 | * @return array |
| 160 | * [CRM_Core_Reference_Interface] |
| 161 | */ |
| 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']); |
| 169 | } |
| 170 | return Civi::$statics[__CLASS__]['links']; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Returns all the column names of this table |
| 175 | * |
| 176 | * @return array |
| 177 | */ |
| 178 | public static function &fields() { |
| 179 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 180 | Civi::$statics[__CLASS__]['fields'] = [ |
| 181 | 'id' => [ |
| 182 | 'name' => 'id', |
| 183 | 'type' => CRM_Utils_Type::T_INT, |
| 184 | 'title' => ts('Batch ID'), |
| 185 | 'description' => ts('Unique Address ID'), |
| 186 | 'required' => TRUE, |
| 187 | 'where' => 'civicrm_batch.id', |
| 188 | 'table_name' => 'civicrm_batch', |
| 189 | 'entity' => 'Batch', |
| 190 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 191 | 'localizable' => 0, |
| 192 | ], |
| 193 | 'name' => [ |
| 194 | 'name' => 'name', |
| 195 | 'type' => CRM_Utils_Type::T_STRING, |
| 196 | 'title' => ts('Batch Name'), |
| 197 | 'description' => ts('Variable name/programmatic handle for this batch.'), |
| 198 | 'maxlength' => 64, |
| 199 | 'size' => CRM_Utils_Type::BIG, |
| 200 | 'where' => 'civicrm_batch.name', |
| 201 | 'table_name' => 'civicrm_batch', |
| 202 | 'entity' => 'Batch', |
| 203 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 204 | 'localizable' => 0, |
| 205 | 'html' => [ |
| 206 | 'type' => 'Text', |
| 207 | ], |
| 208 | ], |
| 209 | 'title' => [ |
| 210 | 'name' => 'title', |
| 211 | 'type' => CRM_Utils_Type::T_STRING, |
| 212 | 'title' => ts('Batch Title'), |
| 213 | 'description' => ts('Friendly Name.'), |
| 214 | 'maxlength' => 255, |
| 215 | 'size' => CRM_Utils_Type::HUGE, |
| 216 | 'where' => 'civicrm_batch.title', |
| 217 | 'table_name' => 'civicrm_batch', |
| 218 | 'entity' => 'Batch', |
| 219 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 220 | 'localizable' => 1, |
| 221 | 'html' => [ |
| 222 | 'type' => 'Text', |
| 223 | ], |
| 224 | ], |
| 225 | 'description' => [ |
| 226 | 'name' => 'description', |
| 227 | 'type' => CRM_Utils_Type::T_TEXT, |
| 228 | 'title' => ts('Batch Description'), |
| 229 | 'description' => ts('Description of this batch set.'), |
| 230 | 'rows' => 4, |
| 231 | 'cols' => 80, |
| 232 | 'where' => 'civicrm_batch.description', |
| 233 | 'table_name' => 'civicrm_batch', |
| 234 | 'entity' => 'Batch', |
| 235 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 236 | 'localizable' => 1, |
| 237 | 'html' => [ |
| 238 | 'type' => 'TextArea', |
| 239 | ], |
| 240 | ], |
| 241 | 'created_id' => [ |
| 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', |
| 248 | 'entity' => 'Batch', |
| 249 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 250 | 'localizable' => 0, |
| 251 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
| 252 | ], |
| 253 | 'created_date' => [ |
| 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', |
| 260 | 'entity' => 'Batch', |
| 261 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 262 | 'localizable' => 0, |
| 263 | 'html' => [ |
| 264 | 'type' => 'Select Date', |
| 265 | ], |
| 266 | ], |
| 267 | 'modified_id' => [ |
| 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', |
| 274 | 'entity' => 'Batch', |
| 275 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 276 | 'localizable' => 0, |
| 277 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
| 278 | ], |
| 279 | 'modified_date' => [ |
| 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', |
| 286 | 'entity' => 'Batch', |
| 287 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 288 | 'localizable' => 0, |
| 289 | ], |
| 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', |
| 297 | 'entity' => 'Batch', |
| 298 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 299 | 'localizable' => 0, |
| 300 | 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', |
| 301 | 'html' => [ |
| 302 | 'type' => 'EntityRef', |
| 303 | ], |
| 304 | ], |
| 305 | 'status_id' => [ |
| 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'), |
| 310 | 'required' => TRUE, |
| 311 | 'where' => 'civicrm_batch.status_id', |
| 312 | 'table_name' => 'civicrm_batch', |
| 313 | 'entity' => 'Batch', |
| 314 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 315 | 'localizable' => 0, |
| 316 | 'html' => [ |
| 317 | 'type' => 'Select', |
| 318 | ], |
| 319 | 'pseudoconstant' => [ |
| 320 | 'optionGroupName' => 'batch_status', |
| 321 | 'optionEditPath' => 'civicrm/admin/options/batch_status', |
| 322 | ], |
| 323 | ], |
| 324 | 'type_id' => [ |
| 325 | 'name' => 'type_id', |
| 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', |
| 331 | 'entity' => 'Batch', |
| 332 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 333 | 'localizable' => 0, |
| 334 | 'html' => [ |
| 335 | 'type' => 'Select', |
| 336 | ], |
| 337 | 'pseudoconstant' => [ |
| 338 | 'optionGroupName' => 'batch_type', |
| 339 | 'optionEditPath' => 'civicrm/admin/options/batch_type', |
| 340 | ], |
| 341 | ], |
| 342 | 'mode_id' => [ |
| 343 | 'name' => 'mode_id', |
| 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', |
| 349 | 'entity' => 'Batch', |
| 350 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 351 | 'localizable' => 0, |
| 352 | 'html' => [ |
| 353 | 'type' => 'Select', |
| 354 | ], |
| 355 | 'pseudoconstant' => [ |
| 356 | 'optionGroupName' => 'batch_mode', |
| 357 | 'optionEditPath' => 'civicrm/admin/options/batch_mode', |
| 358 | ], |
| 359 | ], |
| 360 | 'total' => [ |
| 361 | 'name' => 'total', |
| 362 | 'type' => CRM_Utils_Type::T_MONEY, |
| 363 | 'title' => ts('Batch Total'), |
| 364 | 'description' => ts('Total amount for this batch.'), |
| 365 | 'precision' => [ |
| 366 | 20, |
| 367 | 2, |
| 368 | ], |
| 369 | 'where' => 'civicrm_batch.total', |
| 370 | 'table_name' => 'civicrm_batch', |
| 371 | 'entity' => 'Batch', |
| 372 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 373 | 'localizable' => 0, |
| 374 | 'html' => [ |
| 375 | 'type' => 'Text', |
| 376 | ], |
| 377 | ], |
| 378 | 'item_count' => [ |
| 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', |
| 385 | 'entity' => 'Batch', |
| 386 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 387 | 'localizable' => 0, |
| 388 | 'html' => [ |
| 389 | 'type' => 'Text', |
| 390 | ], |
| 391 | ], |
| 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', |
| 399 | 'entity' => 'Batch', |
| 400 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 401 | 'localizable' => 0, |
| 402 | 'html' => [ |
| 403 | 'type' => 'Select', |
| 404 | ], |
| 405 | 'pseudoconstant' => [ |
| 406 | 'optionGroupName' => 'payment_instrument', |
| 407 | 'optionEditPath' => 'civicrm/admin/options/payment_instrument', |
| 408 | ], |
| 409 | ], |
| 410 | 'exported_date' => [ |
| 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', |
| 416 | 'entity' => 'Batch', |
| 417 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 418 | 'localizable' => 0, |
| 419 | ], |
| 420 | 'data' => [ |
| 421 | 'name' => 'data', |
| 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', |
| 427 | 'entity' => 'Batch', |
| 428 | 'bao' => 'CRM_Batch_BAO_Batch', |
| 429 | 'localizable' => 0, |
| 430 | ], |
| 431 | ]; |
| 432 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 433 | } |
| 434 | return Civi::$statics[__CLASS__]['fields']; |
| 435 | } |
| 436 | |
| 437 | /** |
| 438 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 439 | * |
| 440 | * @return array |
| 441 | * Array(string $name => string $uniqueName). |
| 442 | */ |
| 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())); |
| 446 | } |
| 447 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * Returns the names of this table |
| 452 | * |
| 453 | * @return string |
| 454 | */ |
| 455 | public static function getTableName() { |
| 456 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Returns if this table needs to be logged |
| 461 | * |
| 462 | * @return bool |
| 463 | */ |
| 464 | public function getLog() { |
| 465 | return self::$_log; |
| 466 | } |
| 467 | |
| 468 | /** |
| 469 | * Returns the list of fields that can be imported |
| 470 | * |
| 471 | * @param bool $prefix |
| 472 | * |
| 473 | * @return array |
| 474 | */ |
| 475 | public static function &import($prefix = FALSE) { |
| 476 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'batch', $prefix, []); |
| 477 | return $r; |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * Returns the list of fields that can be exported |
| 482 | * |
| 483 | * @param bool $prefix |
| 484 | * |
| 485 | * @return array |
| 486 | */ |
| 487 | public static function &export($prefix = FALSE) { |
| 488 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'batch', $prefix, []); |
| 489 | return $r; |
| 490 | } |
| 491 | |
| 492 | /** |
| 493 | * Returns the list of indices |
| 494 | * |
| 495 | * @param bool $localize |
| 496 | * |
| 497 | * @return array |
| 498 | */ |
| 499 | public static function indices($localize = TRUE) { |
| 500 | $indices = [ |
| 501 | 'UI_name' => [ |
| 502 | 'name' => 'UI_name', |
| 503 | 'field' => [ |
| 504 | 0 => 'name', |
| 505 | ], |
| 506 | 'localizable' => FALSE, |
| 507 | 'unique' => TRUE, |
| 508 | 'sig' => 'civicrm_batch::1::name', |
| 509 | ], |
| 510 | ]; |
| 511 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 512 | } |
| 513 | |
| 514 | } |