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