Merge pull request #9637 from omarabuhussein/CRM-19832-searchtask-hook
[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:81081e8ad03b0097ba7949b4425b1ca8)
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 ) ,
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 }