Merge pull request #12659 from kenwest/strip-html-tags-from-joblog-description
[civicrm-core.git] / CRM / Pledge / DAO / PledgePayment.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Pledge/PledgePayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:37953335e5e08db4328298ec003c97a8)
10 */
11
12 /**
13 * Database access object for the PledgePayment entity.
14 */
15 class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_pledge_payment';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = TRUE;
30
31 /**
32 * @var int unsigned
33 */
34 public $id;
35
36 /**
37 * FK to Pledge table
38 *
39 * @var int unsigned
40 */
41 public $pledge_id;
42
43 /**
44 * FK to contribution table.
45 *
46 * @var int unsigned
47 */
48 public $contribution_id;
49
50 /**
51 * Pledged amount for this payment (the actual contribution amount might be different).
52 *
53 * @var float
54 */
55 public $scheduled_amount;
56
57 /**
58 * Actual amount that is paid as the Pledged installment amount.
59 *
60 * @var float
61 */
62 public $actual_amount;
63
64 /**
65 * 3 character string, value from config setting or input via user.
66 *
67 * @var string
68 */
69 public $currency;
70
71 /**
72 * The date the pledge payment is supposed to happen.
73 *
74 * @var datetime
75 */
76 public $scheduled_date;
77
78 /**
79 * The date that the most recent payment reminder was sent.
80 *
81 * @var datetime
82 */
83 public $reminder_date;
84
85 /**
86 * The number of payment reminders sent.
87 *
88 * @var int unsigned
89 */
90 public $reminder_count;
91
92 /**
93 * @var int unsigned
94 */
95 public $status_id;
96
97 /**
98 * Class constructor.
99 */
100 public function __construct() {
101 $this->__table = 'civicrm_pledge_payment';
102 parent::__construct();
103 }
104
105 /**
106 * Returns foreign keys and entity references.
107 *
108 * @return array
109 * [CRM_Core_Reference_Interface]
110 */
111 public static function getReferenceColumns() {
112 if (!isset(Civi::$statics[__CLASS__]['links'])) {
113 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
114 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pledge_id', 'civicrm_pledge', 'id');
115 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
116 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
117 }
118 return Civi::$statics[__CLASS__]['links'];
119 }
120
121 /**
122 * Returns all the column names of this table
123 *
124 * @return array
125 */
126 public static function &fields() {
127 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
128 Civi::$statics[__CLASS__]['fields'] = [
129 'pledge_payment_id' => [
130 'name' => 'id',
131 'type' => CRM_Utils_Type::T_INT,
132 'title' => ts('Payment ID'),
133 'required' => TRUE,
134 'import' => TRUE,
135 'where' => 'civicrm_pledge_payment.id',
136 'headerPattern' => '',
137 'dataPattern' => '',
138 'export' => TRUE,
139 'table_name' => 'civicrm_pledge_payment',
140 'entity' => 'PledgePayment',
141 'bao' => 'CRM_Pledge_BAO_PledgePayment',
142 'localizable' => 0,
143 ],
144 'pledge_id' => [
145 'name' => 'pledge_id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Pledge'),
148 'description' => ts('FK to Pledge table'),
149 'required' => TRUE,
150 'table_name' => 'civicrm_pledge_payment',
151 'entity' => 'PledgePayment',
152 'bao' => 'CRM_Pledge_BAO_PledgePayment',
153 'localizable' => 0,
154 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
155 ],
156 'contribution_id' => [
157 'name' => 'contribution_id',
158 'type' => CRM_Utils_Type::T_INT,
159 'title' => ts('Contribution'),
160 'description' => ts('FK to contribution table.'),
161 'table_name' => 'civicrm_pledge_payment',
162 'entity' => 'PledgePayment',
163 'bao' => 'CRM_Pledge_BAO_PledgePayment',
164 'localizable' => 0,
165 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
166 ],
167 'pledge_payment_scheduled_amount' => [
168 'name' => 'scheduled_amount',
169 'type' => CRM_Utils_Type::T_MONEY,
170 'title' => ts('Scheduled Amount'),
171 'description' => ts('Pledged amount for this payment (the actual contribution amount might be different).'),
172 'required' => TRUE,
173 'precision' => [
174 20,
175 2
176 ],
177 'import' => TRUE,
178 'where' => 'civicrm_pledge_payment.scheduled_amount',
179 'headerPattern' => '',
180 'dataPattern' => '',
181 'export' => TRUE,
182 'table_name' => 'civicrm_pledge_payment',
183 'entity' => 'PledgePayment',
184 'bao' => 'CRM_Pledge_BAO_PledgePayment',
185 'localizable' => 0,
186 ],
187 'pledge_payment_actual_amount' => [
188 'name' => 'actual_amount',
189 'type' => CRM_Utils_Type::T_MONEY,
190 'title' => ts('Actual Amount'),
191 'description' => ts('Actual amount that is paid as the Pledged installment amount.'),
192 'precision' => [
193 20,
194 2
195 ],
196 'import' => TRUE,
197 'where' => 'civicrm_pledge_payment.actual_amount',
198 'headerPattern' => '',
199 'dataPattern' => '',
200 'export' => TRUE,
201 'table_name' => 'civicrm_pledge_payment',
202 'entity' => 'PledgePayment',
203 'bao' => 'CRM_Pledge_BAO_PledgePayment',
204 'localizable' => 0,
205 ],
206 'currency' => [
207 'name' => 'currency',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('Currency'),
210 'description' => ts('3 character string, value from config setting or input via user.'),
211 'maxlength' => 3,
212 'size' => CRM_Utils_Type::FOUR,
213 'default' => 'NULL',
214 'table_name' => 'civicrm_pledge_payment',
215 'entity' => 'PledgePayment',
216 'bao' => 'CRM_Pledge_BAO_PledgePayment',
217 'localizable' => 0,
218 'html' => [
219 'type' => 'Select',
220 ],
221 'pseudoconstant' => [
222 'table' => 'civicrm_currency',
223 'keyColumn' => 'name',
224 'labelColumn' => 'full_name',
225 'nameColumn' => 'name',
226 ]
227 ],
228 'pledge_payment_scheduled_date' => [
229 'name' => 'scheduled_date',
230 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
231 'title' => ts('Scheduled Date'),
232 'description' => ts('The date the pledge payment is supposed to happen.'),
233 'required' => TRUE,
234 'import' => TRUE,
235 'where' => 'civicrm_pledge_payment.scheduled_date',
236 'headerPattern' => '',
237 'dataPattern' => '',
238 'export' => TRUE,
239 'table_name' => 'civicrm_pledge_payment',
240 'entity' => 'PledgePayment',
241 'bao' => 'CRM_Pledge_BAO_PledgePayment',
242 'localizable' => 0,
243 ],
244 'pledge_payment_reminder_date' => [
245 'name' => 'reminder_date',
246 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
247 'title' => ts('Last Reminder'),
248 'description' => ts('The date that the most recent payment reminder was sent.'),
249 'import' => TRUE,
250 'where' => 'civicrm_pledge_payment.reminder_date',
251 'headerPattern' => '',
252 'dataPattern' => '',
253 'export' => TRUE,
254 'table_name' => 'civicrm_pledge_payment',
255 'entity' => 'PledgePayment',
256 'bao' => 'CRM_Pledge_BAO_PledgePayment',
257 'localizable' => 0,
258 ],
259 'pledge_payment_reminder_count' => [
260 'name' => 'reminder_count',
261 'type' => CRM_Utils_Type::T_INT,
262 'title' => ts('Reminders Sent'),
263 'description' => ts('The number of payment reminders sent.'),
264 'import' => TRUE,
265 'where' => 'civicrm_pledge_payment.reminder_count',
266 'headerPattern' => '',
267 'dataPattern' => '',
268 'export' => TRUE,
269 'default' => '0',
270 'table_name' => 'civicrm_pledge_payment',
271 'entity' => 'PledgePayment',
272 'bao' => 'CRM_Pledge_BAO_PledgePayment',
273 'localizable' => 0,
274 ],
275 'pledge_payment_status_id' => [
276 'name' => 'status_id',
277 'type' => CRM_Utils_Type::T_INT,
278 'title' => ts('Payment Status'),
279 'import' => TRUE,
280 'where' => 'civicrm_pledge_payment.status_id',
281 'headerPattern' => '',
282 'dataPattern' => '',
283 'export' => FALSE,
284 'table_name' => 'civicrm_pledge_payment',
285 'entity' => 'PledgePayment',
286 'bao' => 'CRM_Pledge_BAO_PledgePayment',
287 'localizable' => 0,
288 'pseudoconstant' => [
289 'optionGroupName' => 'contribution_status',
290 'optionEditPath' => 'civicrm/admin/options/contribution_status',
291 ]
292 ],
293 ];
294 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
295 }
296 return Civi::$statics[__CLASS__]['fields'];
297 }
298
299 /**
300 * Return a mapping from field-name to the corresponding key (as used in fields()).
301 *
302 * @return array
303 * Array(string $name => string $uniqueName).
304 */
305 public static function &fieldKeys() {
306 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
307 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
308 }
309 return Civi::$statics[__CLASS__]['fieldKeys'];
310 }
311
312 /**
313 * Returns the names of this table
314 *
315 * @return string
316 */
317 public static function getTableName() {
318 return self::$_tableName;
319 }
320
321 /**
322 * Returns if this table needs to be logged
323 *
324 * @return bool
325 */
326 public function getLog() {
327 return self::$_log;
328 }
329
330 /**
331 * Returns the list of fields that can be imported
332 *
333 * @param bool $prefix
334 *
335 * @return array
336 */
337 public static function &import($prefix = FALSE) {
338 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_payment', $prefix, []);
339 return $r;
340 }
341
342 /**
343 * Returns the list of fields that can be exported
344 *
345 * @param bool $prefix
346 *
347 * @return array
348 */
349 public static function &export($prefix = FALSE) {
350 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_payment', $prefix, []);
351 return $r;
352 }
353
354 /**
355 * Returns the list of indices
356 *
357 * @param bool $localize
358 *
359 * @return array
360 */
361 public static function indices($localize = TRUE) {
362 $indices = [
363 'index_contribution_pledge' => [
364 'name' => 'index_contribution_pledge',
365 'field' => [
366 0 => 'contribution_id',
367 1 => 'pledge_id',
368 ],
369 'localizable' => FALSE,
370 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id',
371 ],
372 'index_status' => [
373 'name' => 'index_status',
374 'field' => [
375 0 => 'status_id',
376 ],
377 'localizable' => FALSE,
378 'sig' => 'civicrm_pledge_payment::0::status_id',
379 ],
380 ];
381 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
382 }
383
384 }