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