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