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