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