xml/templates/dao.tpl - Simplify fieldKeys()
[civicrm-core.git] / CRM / Pledge / DAO / PledgePayment.php
CommitLineData
e501603b
TO
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/Pledge/PledgePayment.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:61fd25d78097c2495d13be5336a17923)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_pledge_payment';
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;
e501603b
TO
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 = true;
69 /**
70 *
71 * @var int unsigned
72 */
73 public $id;
74 /**
75 * FK to Pledge table
76 *
77 * @var int unsigned
78 */
79 public $pledge_id;
80 /**
81 * FK to contribution table.
82 *
83 * @var int unsigned
84 */
85 public $contribution_id;
86 /**
87 * Pledged amount for this payment (the actual contribution amount might be different).
88 *
89 * @var float
90 */
91 public $scheduled_amount;
92 /**
93 * Actual amount that is paid as the Pledged installment amount.
94 *
95 * @var float
96 */
97 public $actual_amount;
98 /**
99 * 3 character string, value from config setting or input via user.
100 *
101 * @var string
102 */
103 public $currency;
104 /**
105 * The date the pledge payment is supposed to happen.
106 *
107 * @var datetime
108 */
109 public $scheduled_date;
110 /**
111 * The date that the most recent payment reminder was sent.
112 *
113 * @var datetime
114 */
115 public $reminder_date;
116 /**
117 * The number of payment reminders sent.
118 *
119 * @var int unsigned
120 */
121 public $reminder_count;
122 /**
123 *
124 * @var int unsigned
125 */
126 public $status_id;
127 /**
128 * class constructor
129 *
130 * @return civicrm_pledge_payment
131 */
132 function __construct() {
133 $this->__table = 'civicrm_pledge_payment';
134 parent::__construct();
135 }
136 /**
137 * Returns foreign keys and entity references
138 *
139 * @return array
140 * [CRM_Core_Reference_Interface]
141 */
142 static function getReferenceColumns() {
143 if (!self::$_links) {
144 self::$_links = static ::createReferenceColumns(__CLASS__);
145 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'pledge_id', 'civicrm_pledge', 'id');
146 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id');
147 }
148 return self::$_links;
149 }
150 /**
151 * Returns all the column names of this table
152 *
153 * @return array
154 */
155 static function &fields() {
156 if (!(self::$_fields)) {
157 self::$_fields = array(
158 'pledge_payment_id' => array(
159 'name' => 'id',
160 'type' => CRM_Utils_Type::T_INT,
161 'title' => ts('Payment ID') ,
162 'required' => true,
163 'import' => true,
164 'where' => 'civicrm_pledge_payment.id',
165 'headerPattern' => '',
166 'dataPattern' => '',
167 'export' => true,
168 ) ,
169 'pledge_id' => array(
170 'name' => 'pledge_id',
171 'type' => CRM_Utils_Type::T_INT,
172 'title' => ts('Pledge') ,
173 'description' => 'FK to Pledge table',
174 'required' => true,
175 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
176 ) ,
177 'contribution_id' => array(
178 'name' => 'contribution_id',
179 'type' => CRM_Utils_Type::T_INT,
180 'title' => ts('Contribution') ,
181 'description' => 'FK to contribution table.',
182 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
183 ) ,
184 'pledge_payment_scheduled_amount' => array(
185 'name' => 'scheduled_amount',
186 'type' => CRM_Utils_Type::T_MONEY,
187 'title' => ts('Scheduled Amount') ,
188 'description' => 'Pledged amount for this payment (the actual contribution amount might be different).',
189 'required' => true,
190 'precision' => array(
191 20,
192 2
193 ) ,
194 'import' => true,
195 'where' => 'civicrm_pledge_payment.scheduled_amount',
196 'headerPattern' => '',
197 'dataPattern' => '',
198 'export' => true,
199 ) ,
200 'pledge_payment_actual_amount' => array(
201 'name' => 'actual_amount',
202 'type' => CRM_Utils_Type::T_MONEY,
203 'title' => ts('Actual Amount') ,
204 'description' => 'Actual amount that is paid as the Pledged installment amount.',
205 'precision' => array(
206 20,
207 2
208 ) ,
209 'import' => true,
210 'where' => 'civicrm_pledge_payment.actual_amount',
211 'headerPattern' => '',
212 'dataPattern' => '',
213 'export' => true,
214 ) ,
215 'currency' => array(
216 'name' => 'currency',
217 'type' => CRM_Utils_Type::T_STRING,
218 'title' => ts('Currency') ,
219 'description' => '3 character string, value from config setting or input via user.',
220 'maxlength' => 3,
221 'size' => CRM_Utils_Type::FOUR,
222 'default' => 'NULL',
223 'html' => array(
224 'type' => 'Select',
225 ) ,
226 'pseudoconstant' => array(
227 'table' => 'civicrm_currency',
228 'keyColumn' => 'name',
229 'labelColumn' => 'full_name',
230 'nameColumn' => 'name',
231 )
232 ) ,
233 'pledge_payment_scheduled_date' => array(
234 'name' => 'scheduled_date',
235 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
236 'title' => ts('Scheduled Date') ,
237 'description' => 'The date the pledge payment is supposed to happen.',
238 'required' => true,
239 'import' => true,
240 'where' => 'civicrm_pledge_payment.scheduled_date',
241 'headerPattern' => '',
242 'dataPattern' => '',
243 'export' => true,
244 ) ,
245 'pledge_payment_reminder_date' => array(
246 'name' => 'reminder_date',
247 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
248 'title' => ts('Last Reminder') ,
249 'description' => 'The date that the most recent payment reminder was sent.',
250 'import' => true,
251 'where' => 'civicrm_pledge_payment.reminder_date',
252 'headerPattern' => '',
253 'dataPattern' => '',
254 'export' => true,
255 ) ,
256 'pledge_payment_reminder_count' => array(
257 'name' => 'reminder_count',
258 'type' => CRM_Utils_Type::T_INT,
259 'title' => ts('Reminders Sent') ,
260 'description' => 'The number of payment reminders sent.',
261 'import' => true,
262 'where' => 'civicrm_pledge_payment.reminder_count',
263 'headerPattern' => '',
264 'dataPattern' => '',
265 'export' => true,
266 ) ,
267 'pledge_payment_status_id' => array(
268 'name' => 'status_id',
269 'type' => CRM_Utils_Type::T_INT,
270 'title' => ts('Payment Status') ,
271 'import' => true,
272 'where' => 'civicrm_pledge_payment.status_id',
273 'headerPattern' => '',
274 'dataPattern' => '',
275 'export' => false,
276 'pseudoconstant' => array(
277 'optionGroupName' => 'contribution_status',
278 'optionEditPath' => 'civicrm/admin/options/contribution_status',
279 )
280 ) ,
281 );
282 }
283 return self::$_fields;
284 }
285 /**
286 * Returns an array containing, for each field, the arary key used for that
287 * field in self::$_fields.
288 *
289 * @return array
290 */
291 static function &fieldKeys() {
292 if (!(self::$_fieldKeys)) {
293 self::$_fieldKeys = array(
294 'id' => 'pledge_payment_id',
295 'pledge_id' => 'pledge_id',
296 'contribution_id' => 'contribution_id',
297 'scheduled_amount' => 'pledge_payment_scheduled_amount',
298 'actual_amount' => 'pledge_payment_actual_amount',
299 'currency' => 'currency',
300 'scheduled_date' => 'pledge_payment_scheduled_date',
301 'reminder_date' => 'pledge_payment_reminder_date',
302 'reminder_count' => 'pledge_payment_reminder_count',
303 'status_id' => 'pledge_payment_status_id',
304 );
305 }
306 return self::$_fieldKeys;
307 }
308 /**
309 * Returns the names of this table
310 *
311 * @return string
312 */
313 static function getTableName() {
314 return self::$_tableName;
315 }
316 /**
317 * Returns if this table needs to be logged
318 *
319 * @return boolean
320 */
321 function getLog() {
322 return self::$_log;
323 }
324 /**
325 * Returns the list of fields that can be imported
326 *
327 * @param bool $prefix
328 *
329 * @return array
330 */
331 static function &import($prefix = false) {
60808919
TO
332 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_payment', $prefix, array());
333 return $r;
e501603b
TO
334 }
335 /**
336 * Returns the list of fields that can be exported
337 *
338 * @param bool $prefix
339 *
340 * @return array
341 */
342 static function &export($prefix = false) {
60808919
TO
343 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_payment', $prefix, array());
344 return $r;
e501603b
TO
345 }
346}