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