Merge pull request #8691 from eileenmcnaughton/merge_like
[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 value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Unique Address ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Variable name/programmatic handle for this batch.
59 *
60 * @var string
61 */
62 public $name;
63 /**
64 * Friendly Name.
65 *
66 * @var string
67 */
68 public $title;
69 /**
70 * Description of this batch set.
71 *
72 * @var text
73 */
74 public $description;
75 /**
76 * FK to Contact ID
77 *
78 * @var int unsigned
79 */
80 public $created_id;
81 /**
82 * When was this item created
83 *
84 * @var datetime
85 */
86 public $created_date;
87 /**
88 * FK to Contact ID
89 *
90 * @var int unsigned
91 */
92 public $modified_id;
93 /**
94 * When was this item created
95 *
96 * @var datetime
97 */
98 public $modified_date;
99 /**
100 * FK to Saved Search ID
101 *
102 * @var int unsigned
103 */
104 public $saved_search_id;
105 /**
106 * fk to Batch Status options in civicrm_option_values
107 *
108 * @var int unsigned
109 */
110 public $status_id;
111 /**
112 * fk to Batch Type options in civicrm_option_values
113 *
114 * @var int unsigned
115 */
116 public $type_id;
117 /**
118 * fk to Batch mode options in civicrm_option_values
119 *
120 * @var int unsigned
121 */
122 public $mode_id;
123 /**
124 * Total amount for this batch.
125 *
126 * @var float
127 */
128 public $total;
129 /**
130 * Number of items in a batch.
131 *
132 * @var int unsigned
133 */
134 public $item_count;
135 /**
136 * fk to Payment Instrument options in civicrm_option_values
137 *
138 * @var int unsigned
139 */
140 public $payment_instrument_id;
141 /**
142 *
143 * @var datetime
144 */
145 public $exported_date;
146 /**
147 * cache entered data
148 *
149 * @var longtext
150 */
151 public $data;
152 /**
153 * class constructor
154 *
155 * @return civicrm_batch
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 ) ,
192 'name' => array(
193 'name' => 'name',
194 'type' => CRM_Utils_Type::T_STRING,
195 'title' => ts('Batch Name') ,
196 'description' => 'Variable name/programmatic handle for this batch.',
197 'maxlength' => 64,
198 'size' => CRM_Utils_Type::BIG,
199 'html' => array(
200 'type' => 'Text',
201 ) ,
202 ) ,
203 'title' => array(
204 'name' => 'title',
205 'type' => CRM_Utils_Type::T_STRING,
206 'title' => ts('Batch Title') ,
207 'description' => 'Friendly Name.',
208 'maxlength' => 64,
209 'size' => CRM_Utils_Type::BIG,
210 'html' => array(
211 'type' => 'Text',
212 ) ,
213 ) ,
214 'description' => array(
215 'name' => 'description',
216 'type' => CRM_Utils_Type::T_TEXT,
217 'title' => ts('Batch Description') ,
218 'description' => 'Description of this batch set.',
219 'rows' => 4,
220 'cols' => 80,
221 'html' => array(
222 'type' => 'TextArea',
223 ) ,
224 ) ,
225 'created_id' => array(
226 'name' => 'created_id',
227 'type' => CRM_Utils_Type::T_INT,
228 'title' => ts('Batch Created By') ,
229 'description' => 'FK to Contact ID',
230 'FKClassName' => 'CRM_Contact_DAO_Contact',
231 ) ,
232 'created_date' => array(
233 'name' => 'created_date',
234 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
235 'title' => ts('Batch Created Date') ,
236 'description' => 'When was this item created',
237 'html' => array(
238 'type' => 'Select Date',
239 ) ,
240 ) ,
241 'modified_id' => array(
242 'name' => 'modified_id',
243 'type' => CRM_Utils_Type::T_INT,
244 'title' => ts('Batch Modified By') ,
245 'description' => 'FK to Contact ID',
246 'FKClassName' => 'CRM_Contact_DAO_Contact',
247 ) ,
248 'modified_date' => array(
249 'name' => 'modified_date',
250 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
251 'title' => ts('Batch Modified Date') ,
252 'description' => 'When was this item created',
253 ) ,
254 'saved_search_id' => array(
255 'name' => 'saved_search_id',
256 'type' => CRM_Utils_Type::T_INT,
257 'title' => ts('Batch Smart Group') ,
258 'description' => 'FK to Saved Search ID',
259 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
260 'html' => array(
261 'type' => 'EntityRef',
262 ) ,
263 ) ,
264 'status_id' => array(
265 'name' => 'status_id',
266 'type' => CRM_Utils_Type::T_INT,
267 'title' => ts('Batch Status') ,
268 'description' => 'fk to Batch Status options in civicrm_option_values',
269 'required' => true,
270 'html' => array(
271 'type' => 'Select',
272 ) ,
273 'pseudoconstant' => array(
274 'optionGroupName' => 'batch_status',
275 'optionEditPath' => 'civicrm/admin/options/batch_status',
276 )
277 ) ,
278 'type_id' => array(
279 'name' => 'type_id',
280 'type' => CRM_Utils_Type::T_INT,
281 'title' => ts('Batch Type') ,
282 'description' => 'fk to Batch Type options in civicrm_option_values',
283 'html' => array(
284 'type' => 'Select',
285 ) ,
286 'pseudoconstant' => array(
287 'optionGroupName' => 'batch_type',
288 'optionEditPath' => 'civicrm/admin/options/batch_type',
289 )
290 ) ,
291 'mode_id' => array(
292 'name' => 'mode_id',
293 'type' => CRM_Utils_Type::T_INT,
294 'title' => ts('Batch Mode') ,
295 'description' => 'fk to Batch mode options in civicrm_option_values',
296 'html' => array(
297 'type' => 'Select',
298 ) ,
299 'pseudoconstant' => array(
300 'optionGroupName' => 'batch_mode',
301 'optionEditPath' => 'civicrm/admin/options/batch_mode',
302 )
303 ) ,
304 'total' => array(
305 'name' => 'total',
306 'type' => CRM_Utils_Type::T_MONEY,
307 'title' => ts('Batch Total') ,
308 'description' => 'Total amount for this batch.',
309 'precision' => array(
310 20,
311 2
312 ) ,
313 'html' => array(
314 'type' => 'Text',
315 ) ,
316 ) ,
317 'item_count' => array(
318 'name' => 'item_count',
319 'type' => CRM_Utils_Type::T_INT,
320 'title' => ts('Batch Number of Items') ,
321 'description' => 'Number of items in a batch.',
322 'html' => array(
323 'type' => 'Text',
324 ) ,
325 ) ,
326 'payment_instrument_id' => array(
327 'name' => 'payment_instrument_id',
328 'type' => CRM_Utils_Type::T_INT,
329 'title' => ts('Batch Payment Method') ,
330 'description' => 'fk to Payment Instrument options in civicrm_option_values',
331 'html' => array(
332 'type' => 'Select',
333 ) ,
334 'pseudoconstant' => array(
335 'optionGroupName' => 'payment_instrument',
336 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
337 )
338 ) ,
339 'exported_date' => array(
340 'name' => 'exported_date',
341 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
342 'title' => ts('Batch Exported Date') ,
343 ) ,
344 'data' => array(
345 'name' => 'data',
346 'type' => CRM_Utils_Type::T_LONGTEXT,
347 'title' => ts('Batch Data') ,
348 'description' => 'cache entered data',
349 ) ,
350 );
351 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
352 }
353 return Civi::$statics[__CLASS__]['fields'];
354 }
355 /**
356 * Return a mapping from field-name to the corresponding key (as used in fields()).
357 *
358 * @return array
359 * Array(string $name => string $uniqueName).
360 */
361 static function &fieldKeys() {
362 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
363 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
364 }
365 return Civi::$statics[__CLASS__]['fieldKeys'];
366 }
367 /**
368 * Returns the names of this table
369 *
370 * @return string
371 */
372 static function getTableName() {
373 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
374 }
375 /**
376 * Returns if this table needs to be logged
377 *
378 * @return boolean
379 */
380 function getLog() {
381 return self::$_log;
382 }
383 /**
384 * Returns the list of fields that can be imported
385 *
386 * @param bool $prefix
387 *
388 * @return array
389 */
390 static function &import($prefix = false) {
391 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'batch', $prefix, array());
392 return $r;
393 }
394 /**
395 * Returns the list of fields that can be exported
396 *
397 * @param bool $prefix
398 *
399 * @return array
400 */
401 static function &export($prefix = false) {
402 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'batch', $prefix, array());
403 return $r;
404 }
405 }