PageRenderTime 21ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/sites/all/modules/contrib/civicrm/CRM/Batch/DAO/Batch.php

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