Merge pull request #22954 from JMAConsulting/booleanFields
[civicrm-core.git] / CRM / Pledge / DAO / Pledge.php
CommitLineData
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/Pledge.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:cbecc4833b44f7758722ef898cb8670b)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Pledge entity.
f41f0342 14 */
e501603b 15class CRM_Pledge_DAO_Pledge 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';
c3fc2621 26
449c4e6b
CW
27 /**
28 * Icon associated with this entity.
29 *
30 * @var string
31 */
32 public static $_icon = 'fa-paper-plane';
33
e501603b 34 /**
f41f0342 35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 36 *
c3fc2621 37 * @var bool
e501603b 38 */
fa45b5b9 39 public static $_log = TRUE;
c3fc2621 40
e501603b
TO
41 /**
42 * Pledge ID
43 *
28979d65
CW
44 * @var int|string|null
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
e501603b
TO
47 */
48 public $id;
c3fc2621 49
e501603b
TO
50 /**
51 * Foreign key to civicrm_contact.id .
52 *
28979d65
CW
53 * @var int|string
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
e501603b
TO
56 */
57 public $contact_id;
c3fc2621 58
e501603b
TO
59 /**
60 * FK to Financial Type
61 *
28979d65
CW
62 * @var int|string|null
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
e501603b
TO
65 */
66 public $financial_type_id;
c3fc2621 67
e501603b
TO
68 /**
69 * The Contribution Page which triggered this contribution
70 *
28979d65
CW
71 * @var int|string|null
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
e501603b
TO
74 */
75 public $contribution_page_id;
c3fc2621 76
e501603b
TO
77 /**
78 * Total pledged amount.
79 *
28979d65
CW
80 * @var float|string
81 * (SQL type: decimal(20,2))
82 * Note that values will be retrieved from the database as a string.
e501603b
TO
83 */
84 public $amount;
c3fc2621 85
e501603b
TO
86 /**
87 * Original amount for each of the installments.
88 *
28979d65
CW
89 * @var float|string
90 * (SQL type: decimal(20,2))
91 * Note that values will be retrieved from the database as a string.
e501603b
TO
92 */
93 public $original_installment_amount;
c3fc2621 94
e501603b
TO
95 /**
96 * 3 character string, value from config setting or input via user.
97 *
28979d65
CW
98 * @var string|null
99 * (SQL type: varchar(3))
100 * Note that values will be retrieved from the database as a string.
e501603b
TO
101 */
102 public $currency;
c3fc2621 103
e501603b
TO
104 /**
105 * Time units for recurrence of pledge payments.
106 *
107 * @var string
28979d65
CW
108 * (SQL type: varchar(8))
109 * Note that values will be retrieved from the database as a string.
e501603b
TO
110 */
111 public $frequency_unit;
c3fc2621 112
e501603b
TO
113 /**
114 * Number of time units for recurrence of pledge payments.
115 *
28979d65
CW
116 * @var int|string
117 * (SQL type: int unsigned)
118 * Note that values will be retrieved from the database as a string.
e501603b
TO
119 */
120 public $frequency_interval;
c3fc2621 121
e501603b
TO
122 /**
123 * Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.
124 *
28979d65
CW
125 * @var int|string
126 * (SQL type: int unsigned)
127 * Note that values will be retrieved from the database as a string.
e501603b
TO
128 */
129 public $frequency_day;
c3fc2621 130
e501603b
TO
131 /**
132 * Total number of payments to be made.
133 *
28979d65
CW
134 * @var int|string
135 * (SQL type: int unsigned)
136 * Note that values will be retrieved from the database as a string.
e501603b
TO
137 */
138 public $installments;
c3fc2621 139
e501603b
TO
140 /**
141 * The date the first scheduled pledge occurs.
142 *
28979d65
CW
143 * @var string
144 * (SQL type: datetime)
145 * Note that values will be retrieved from the database as a string.
e501603b
TO
146 */
147 public $start_date;
c3fc2621 148
e501603b
TO
149 /**
150 * When this pledge record was created.
151 *
28979d65
CW
152 * @var string
153 * (SQL type: datetime)
154 * Note that values will be retrieved from the database as a string.
e501603b
TO
155 */
156 public $create_date;
c3fc2621 157
e501603b
TO
158 /**
159 * When a pledge acknowledgement message was sent to the contributor.
160 *
28979d65
CW
161 * @var string|null
162 * (SQL type: datetime)
163 * Note that values will be retrieved from the database as a string.
e501603b
TO
164 */
165 public $acknowledge_date;
c3fc2621 166
e501603b
TO
167 /**
168 * Last updated date for this pledge record.
169 *
28979d65
CW
170 * @var string|null
171 * (SQL type: datetime)
172 * Note that values will be retrieved from the database as a string.
e501603b
TO
173 */
174 public $modified_date;
c3fc2621 175
e501603b
TO
176 /**
177 * Date this pledge was cancelled by contributor.
178 *
28979d65
CW
179 * @var string|null
180 * (SQL type: datetime)
181 * Note that values will be retrieved from the database as a string.
e501603b
TO
182 */
183 public $cancel_date;
c3fc2621 184
e501603b
TO
185 /**
186 * Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).
187 *
28979d65
CW
188 * @var string|null
189 * (SQL type: datetime)
190 * Note that values will be retrieved from the database as a string.
e501603b
TO
191 */
192 public $end_date;
c3fc2621 193
e501603b
TO
194 /**
195 * The maximum number of payment reminders to send for any given payment.
196 *
28979d65
CW
197 * @var int|string|null
198 * (SQL type: int unsigned)
199 * Note that values will be retrieved from the database as a string.
e501603b
TO
200 */
201 public $max_reminders;
c3fc2621 202
e501603b
TO
203 /**
204 * Send initial reminder this many days prior to the payment due date.
205 *
28979d65
CW
206 * @var int|string|null
207 * (SQL type: int unsigned)
208 * Note that values will be retrieved from the database as a string.
e501603b
TO
209 */
210 public $initial_reminder_day;
c3fc2621 211
e501603b
TO
212 /**
213 * Send additional reminder this many days after last one sent, up to maximum number of reminders.
214 *
28979d65
CW
215 * @var int|string|null
216 * (SQL type: int unsigned)
217 * Note that values will be retrieved from the database as a string.
e501603b
TO
218 */
219 public $additional_reminder_day;
c3fc2621 220
e501603b 221 /**
01dac399 222 * Implicit foreign key to civicrm_option_values in the pledge_status option group.
e501603b 223 *
28979d65
CW
224 * @var int|string
225 * (SQL type: int unsigned)
226 * Note that values will be retrieved from the database as a string.
e501603b
TO
227 */
228 public $status_id;
c3fc2621 229
e501603b 230 /**
28979d65
CW
231 * @var bool|string
232 * (SQL type: tinyint)
233 * Note that values will be retrieved from the database as a string.
e501603b
TO
234 */
235 public $is_test;
c3fc2621 236
e501603b
TO
237 /**
238 * The campaign for which this pledge has been initiated.
239 *
28979d65
CW
240 * @var int|string|null
241 * (SQL type: int unsigned)
242 * Note that values will be retrieved from the database as a string.
e501603b
TO
243 */
244 public $campaign_id;
c3fc2621 245
e501603b 246 /**
f41f0342 247 * Class constructor.
e501603b 248 */
c3fc2621 249 public function __construct() {
e501603b
TO
250 $this->__table = 'civicrm_pledge';
251 parent::__construct();
252 }
c3fc2621 253
449c4e6b
CW
254 /**
255 * Returns localized title of this entity.
7b66c3b5
AH
256 *
257 * @param bool $plural
258 * Whether to return the plural version of the title.
449c4e6b 259 */
7b66c3b5
AH
260 public static function getEntityTitle($plural = FALSE) {
261 return $plural ? ts('Pledges') : ts('Pledge');
449c4e6b
CW
262 }
263
2562d09a
CW
264 /**
265 * Returns user-friendly description of this entity.
266 *
267 * @return string
268 */
269 public static function getEntityDescription() {
270 return ts('Promises to contribute at a future time, either in full, or at regular intervals until a total goal is reached.');
271 }
272
e501603b 273 /**
f41f0342 274 * Returns foreign keys and entity references.
e501603b
TO
275 *
276 * @return array
277 * [CRM_Core_Reference_Interface]
278 */
c3fc2621 279 public static function getReferenceColumns() {
346aaaba 280 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 281 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
282 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
283 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
284 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
285 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
346aaaba 286 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 287 }
346aaaba 288 return Civi::$statics[__CLASS__]['links'];
e501603b 289 }
c3fc2621 290
e501603b
TO
291 /**
292 * Returns all the column names of this table
293 *
294 * @return array
295 */
c3fc2621 296 public static function &fields() {
346aaaba 297 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
298 Civi::$statics[__CLASS__]['fields'] = [
299 'pledge_id' => [
e501603b
TO
300 'name' => 'id',
301 'type' => CRM_Utils_Type::T_INT,
c3fc2621 302 'title' => ts('Pledge ID'),
215b423e 303 'description' => ts('Pledge ID'),
c3fc2621
CW
304 'required' => TRUE,
305 'import' => TRUE,
e501603b 306 'where' => 'civicrm_pledge.id',
c3fc2621 307 'export' => TRUE,
522a26c9 308 'table_name' => 'civicrm_pledge',
309 'entity' => 'Pledge',
310 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 311 'localizable' => 0,
2cbbebe8
A
312 'html' => [
313 'type' => 'Number',
314 ],
1fe423d6 315 'readonly' => TRUE,
a9d0587b 316 'add' => '2.1',
c3fc2621
CW
317 ],
318 'pledge_contact_id' => [
e501603b
TO
319 'name' => 'contact_id',
320 'type' => CRM_Utils_Type::T_INT,
c3fc2621 321 'title' => ts('Contact ID'),
215b423e 322 'description' => ts('Foreign key to civicrm_contact.id .'),
c3fc2621
CW
323 'required' => TRUE,
324 'import' => TRUE,
e501603b 325 'where' => 'civicrm_pledge.contact_id',
c3fc2621 326 'export' => TRUE,
522a26c9 327 'table_name' => 'civicrm_pledge',
328 'entity' => 'Pledge',
329 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 330 'localizable' => 0,
e501603b 331 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 332 'html' => [
e501603b 333 'type' => 'EntityRef',
2cbbebe8 334 'label' => ts("Contact"),
c3fc2621 335 ],
a9d0587b 336 'add' => '2.1',
c3fc2621
CW
337 ],
338 'pledge_financial_type_id' => [
e501603b
TO
339 'name' => 'financial_type_id',
340 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 341 'title' => ts('Financial Type ID'),
215b423e 342 'description' => ts('FK to Financial Type'),
a36434b9 343 'where' => 'civicrm_pledge.financial_type_id',
522a26c9 344 'table_name' => 'civicrm_pledge',
345 'entity' => 'Pledge',
346 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 347 'localizable' => 0,
e501603b 348 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 349 'html' => [
e501603b 350 'type' => 'Select',
2cbbebe8 351 'label' => ts("Financial Type"),
c3fc2621
CW
352 ],
353 'pseudoconstant' => [
e501603b
TO
354 'table' => 'civicrm_financial_type',
355 'keyColumn' => 'id',
356 'labelColumn' => 'name',
e6ca0a57 357 ],
a9d0587b 358 'add' => '4.3',
c3fc2621
CW
359 ],
360 'pledge_contribution_page_id' => [
e501603b
TO
361 'name' => 'contribution_page_id',
362 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 363 'title' => ts('Contribution Page ID'),
215b423e 364 'description' => ts('The Contribution Page which triggered this contribution'),
a36434b9 365 'where' => 'civicrm_pledge.contribution_page_id',
522a26c9 366 'table_name' => 'civicrm_pledge',
367 'entity' => 'Pledge',
368 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 369 'localizable' => 0,
e501603b 370 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
2cbbebe8
A
371 'html' => [
372 'label' => ts("Contribution Page"),
373 ],
a9d0587b 374 'add' => '2.1',
c3fc2621
CW
375 ],
376 'pledge_amount' => [
e501603b
TO
377 'name' => 'amount',
378 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 379 'title' => ts('Total Pledged'),
215b423e 380 'description' => ts('Total pledged amount.'),
c3fc2621
CW
381 'required' => TRUE,
382 'precision' => [
e501603b 383 20,
fb607354 384 2,
c3fc2621
CW
385 ],
386 'import' => TRUE,
e501603b 387 'where' => 'civicrm_pledge.amount',
c3fc2621 388 'export' => TRUE,
522a26c9 389 'table_name' => 'civicrm_pledge',
390 'entity' => 'Pledge',
391 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 392 'localizable' => 0,
c3fc2621 393 'html' => [
e501603b 394 'type' => 'Text',
c3fc2621 395 ],
a9d0587b 396 'add' => '2.1',
c3fc2621
CW
397 ],
398 'pledge_original_installment_amount' => [
e501603b
TO
399 'name' => 'original_installment_amount',
400 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 401 'title' => ts('Original Installment Amount'),
215b423e 402 'description' => ts('Original amount for each of the installments.'),
c3fc2621
CW
403 'required' => TRUE,
404 'precision' => [
e501603b 405 20,
fb607354 406 2,
c3fc2621 407 ],
db517dfe 408 'where' => 'civicrm_pledge.original_installment_amount',
a36434b9 409 'export' => TRUE,
522a26c9 410 'table_name' => 'civicrm_pledge',
411 'entity' => 'Pledge',
412 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 413 'localizable' => 0,
c3fc2621 414 'html' => [
e501603b 415 'type' => 'Text',
c3fc2621 416 ],
a9d0587b 417 'add' => '3.2',
c3fc2621
CW
418 ],
419 'currency' => [
e501603b
TO
420 'name' => 'currency',
421 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 422 'title' => ts('Pledge Currency'),
215b423e 423 'description' => ts('3 character string, value from config setting or input via user.'),
e501603b
TO
424 'maxlength' => 3,
425 'size' => CRM_Utils_Type::FOUR,
a36434b9 426 'where' => 'civicrm_pledge.currency',
5fb0de1f 427 'default' => NULL,
522a26c9 428 'table_name' => 'civicrm_pledge',
429 'entity' => 'Pledge',
430 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 431 'localizable' => 0,
c3fc2621 432 'html' => [
e501603b 433 'type' => 'Select',
c3fc2621
CW
434 ],
435 'pseudoconstant' => [
e501603b
TO
436 'table' => 'civicrm_currency',
437 'keyColumn' => 'name',
438 'labelColumn' => 'full_name',
439 'nameColumn' => 'name',
a8fdb24e 440 'abbrColumn' => 'symbol',
e6ca0a57 441 ],
a9d0587b 442 'add' => '3.2',
c3fc2621
CW
443 ],
444 'pledge_frequency_unit' => [
e501603b
TO
445 'name' => 'frequency_unit',
446 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 447 'title' => ts('Pledge Frequency Unit'),
215b423e 448 'description' => ts('Time units for recurrence of pledge payments.'),
64a05eb1 449 'required' => TRUE,
e501603b
TO
450 'maxlength' => 8,
451 'size' => CRM_Utils_Type::EIGHT,
a36434b9 452 'where' => 'civicrm_pledge.frequency_unit',
e501603b 453 'default' => 'month',
522a26c9 454 'table_name' => 'civicrm_pledge',
455 'entity' => 'Pledge',
456 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 457 'localizable' => 0,
c3fc2621 458 'html' => [
e501603b 459 'type' => 'Select',
c3fc2621
CW
460 ],
461 'pseudoconstant' => [
e501603b
TO
462 'optionGroupName' => 'recur_frequency_units',
463 'keyColumn' => 'name',
464 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
e6ca0a57 465 ],
a9d0587b 466 'add' => '2.1',
c3fc2621
CW
467 ],
468 'pledge_frequency_interval' => [
e501603b
TO
469 'name' => 'frequency_interval',
470 'type' => CRM_Utils_Type::T_INT,
c3fc2621 471 'title' => ts('Pledge Frequency Interval'),
215b423e 472 'description' => ts('Number of time units for recurrence of pledge payments.'),
c3fc2621 473 'required' => TRUE,
a36434b9 474 'where' => 'civicrm_pledge.frequency_interval',
e501603b 475 'default' => '1',
522a26c9 476 'table_name' => 'civicrm_pledge',
477 'entity' => 'Pledge',
478 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 479 'localizable' => 0,
c3fc2621 480 'html' => [
e501603b 481 'type' => 'Text',
c3fc2621 482 ],
a9d0587b 483 'add' => '2.1',
c3fc2621
CW
484 ],
485 'frequency_day' => [
e501603b
TO
486 'name' => 'frequency_day',
487 'type' => CRM_Utils_Type::T_INT,
c3fc2621 488 'title' => ts('Pledge day'),
215b423e 489 'description' => ts('Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.'),
c3fc2621 490 'required' => TRUE,
a36434b9 491 'where' => 'civicrm_pledge.frequency_day',
e501603b 492 'default' => '3',
522a26c9 493 'table_name' => 'civicrm_pledge',
494 'entity' => 'Pledge',
495 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 496 'localizable' => 0,
c3fc2621 497 'html' => [
e501603b 498 'type' => 'Select',
c3fc2621 499 ],
a9d0587b 500 'add' => '2.1',
c3fc2621
CW
501 ],
502 'installments' => [
e501603b
TO
503 'name' => 'installments',
504 'type' => CRM_Utils_Type::T_INT,
c3fc2621 505 'title' => ts('Pledge Number of Installments'),
215b423e 506 'description' => ts('Total number of payments to be made.'),
64a05eb1 507 'required' => TRUE,
db517dfe 508 'where' => 'civicrm_pledge.installments',
a36434b9 509 'export' => TRUE,
e501603b 510 'default' => '1',
522a26c9 511 'table_name' => 'civicrm_pledge',
512 'entity' => 'Pledge',
513 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 514 'localizable' => 0,
c3fc2621 515 'html' => [
e501603b 516 'type' => 'Text',
c3fc2621 517 ],
a9d0587b 518 'add' => '2.1',
c3fc2621 519 ],
a5e468ff 520 'pledge_start_date' => [
e501603b
TO
521 'name' => 'start_date',
522 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 523 'title' => ts('Pledge Start Date'),
215b423e 524 'description' => ts('The date the first scheduled pledge occurs.'),
c3fc2621 525 'required' => TRUE,
a36434b9 526 'where' => 'civicrm_pledge.start_date',
a5e468ff 527 'export' => TRUE,
522a26c9 528 'table_name' => 'civicrm_pledge',
529 'entity' => 'Pledge',
530 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 531 'localizable' => 0,
a5e468ff 532 'unique_title' => ts('Payments Start Date'),
c3fc2621 533 'html' => [
e501603b 534 'type' => 'Select Date',
efcda6b9 535 'formatType' => 'activityDate',
c3fc2621 536 ],
a9d0587b 537 'add' => '2.1',
c3fc2621
CW
538 ],
539 'pledge_create_date' => [
e501603b
TO
540 'name' => 'create_date',
541 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 542 'title' => ts('Pledge Made'),
215b423e 543 'description' => ts('When this pledge record was created.'),
c3fc2621
CW
544 'required' => TRUE,
545 'import' => TRUE,
e501603b 546 'where' => 'civicrm_pledge.create_date',
c3fc2621 547 'export' => TRUE,
522a26c9 548 'table_name' => 'civicrm_pledge',
549 'entity' => 'Pledge',
550 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 551 'localizable' => 0,
c3fc2621 552 'html' => [
e501603b 553 'type' => 'Select Date',
efcda6b9 554 'formatType' => 'activityDate',
c3fc2621 555 ],
a9d0587b 556 'add' => '2.1',
c3fc2621
CW
557 ],
558 'acknowledge_date' => [
e501603b
TO
559 'name' => 'acknowledge_date',
560 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 561 'title' => ts('Pledge Acknowledged'),
215b423e 562 'description' => ts('When a pledge acknowledgement message was sent to the contributor.'),
a36434b9 563 'where' => 'civicrm_pledge.acknowledge_date',
522a26c9 564 'table_name' => 'civicrm_pledge',
565 'entity' => 'Pledge',
566 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 567 'localizable' => 0,
c3fc2621 568 'html' => [
e501603b 569 'type' => 'Select Date',
efcda6b9 570 'formatType' => 'activityDate',
c3fc2621 571 ],
a9d0587b 572 'add' => '2.1',
c3fc2621
CW
573 ],
574 'modified_date' => [
e501603b
TO
575 'name' => 'modified_date',
576 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 577 'title' => ts('Pledge Modified Date'),
215b423e 578 'description' => ts('Last updated date for this pledge record.'),
a36434b9 579 'where' => 'civicrm_pledge.modified_date',
522a26c9 580 'table_name' => 'civicrm_pledge',
581 'entity' => 'Pledge',
582 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 583 'localizable' => 0,
a0e733f3 584 'readonly' => TRUE,
a9d0587b 585 'add' => '2.1',
c3fc2621
CW
586 ],
587 'cancel_date' => [
e501603b
TO
588 'name' => 'cancel_date',
589 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 590 'title' => ts('Pledge Cancelled Date'),
215b423e 591 'description' => ts('Date this pledge was cancelled by contributor.'),
a36434b9 592 'where' => 'civicrm_pledge.cancel_date',
522a26c9 593 'table_name' => 'civicrm_pledge',
594 'entity' => 'Pledge',
595 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 596 'localizable' => 0,
c3fc2621 597 'html' => [
e501603b 598 'type' => 'Select Date',
efcda6b9 599 'formatType' => 'activityDate',
c3fc2621 600 ],
a9d0587b 601 'add' => '2.1',
c3fc2621 602 ],
a5e468ff 603 'pledge_end_date' => [
e501603b
TO
604 'name' => 'end_date',
605 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 606 'title' => ts('Pledge End Date'),
215b423e 607 'description' => ts('Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).'),
a36434b9 608 'where' => 'civicrm_pledge.end_date',
a5e468ff 609 'export' => TRUE,
522a26c9 610 'table_name' => 'civicrm_pledge',
611 'entity' => 'Pledge',
612 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 613 'localizable' => 0,
a5e468ff 614 'unique_title' => ts('Payments Ended Date'),
c3fc2621 615 'html' => [
e501603b 616 'type' => 'Select Date',
efcda6b9 617 'formatType' => 'activityDate',
c3fc2621 618 ],
a9d0587b 619 'add' => '2.1',
c3fc2621
CW
620 ],
621 'max_reminders' => [
e501603b
TO
622 'name' => 'max_reminders',
623 'type' => CRM_Utils_Type::T_INT,
c3fc2621 624 'title' => ts('Maximum Number of Reminders'),
215b423e 625 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
a36434b9 626 'where' => 'civicrm_pledge.max_reminders',
e501603b 627 'default' => '1',
522a26c9 628 'table_name' => 'civicrm_pledge',
629 'entity' => 'Pledge',
630 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 631 'localizable' => 0,
c3fc2621 632 'html' => [
e501603b 633 'type' => 'Text',
c3fc2621 634 ],
a9d0587b 635 'add' => '2.1',
c3fc2621
CW
636 ],
637 'initial_reminder_day' => [
e501603b
TO
638 'name' => 'initial_reminder_day',
639 'type' => CRM_Utils_Type::T_INT,
c3fc2621 640 'title' => ts('Initial Reminder Day'),
215b423e 641 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
a36434b9 642 'where' => 'civicrm_pledge.initial_reminder_day',
e501603b 643 'default' => '5',
522a26c9 644 'table_name' => 'civicrm_pledge',
645 'entity' => 'Pledge',
646 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 647 'localizable' => 0,
c3fc2621 648 'html' => [
e501603b 649 'type' => 'Select',
c3fc2621 650 ],
a9d0587b 651 'add' => '2.1',
c3fc2621
CW
652 ],
653 'additional_reminder_day' => [
e501603b
TO
654 'name' => 'additional_reminder_day',
655 'type' => CRM_Utils_Type::T_INT,
c3fc2621 656 'title' => ts('Additional Reminder Days'),
215b423e 657 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
a36434b9 658 'where' => 'civicrm_pledge.additional_reminder_day',
e501603b 659 'default' => '5',
522a26c9 660 'table_name' => 'civicrm_pledge',
661 'entity' => 'Pledge',
662 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 663 'localizable' => 0,
c3fc2621 664 'html' => [
e501603b 665 'type' => 'Text',
c3fc2621 666 ],
a9d0587b 667 'add' => '2.1',
c3fc2621
CW
668 ],
669 'pledge_status_id' => [
e501603b
TO
670 'name' => 'status_id',
671 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 672 'title' => ts('Pledge Status ID'),
215b423e 673 'description' => ts('Implicit foreign key to civicrm_option_values in the pledge_status option group.'),
64a05eb1 674 'required' => TRUE,
c3fc2621 675 'import' => TRUE,
e501603b 676 'where' => 'civicrm_pledge.status_id',
c3fc2621 677 'export' => FALSE,
522a26c9 678 'table_name' => 'civicrm_pledge',
679 'entity' => 'Pledge',
680 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 681 'localizable' => 0,
52ddd94d 682 'html' => [
683 'type' => 'Select',
684 ],
c3fc2621 685 'pseudoconstant' => [
01dac399
JP
686 'optionGroupName' => 'pledge_status',
687 'optionEditPath' => 'civicrm/admin/options/pledge_status',
e6ca0a57 688 ],
a9d0587b 689 'add' => '2.1',
c3fc2621
CW
690 ],
691 'pledge_is_test' => [
e501603b
TO
692 'name' => 'is_test',
693 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 694 'title' => ts('Test'),
64a05eb1 695 'required' => TRUE,
c3fc2621 696 'import' => TRUE,
e501603b 697 'where' => 'civicrm_pledge.is_test',
c3fc2621 698 'export' => TRUE,
45a83e42 699 'default' => '0',
522a26c9 700 'table_name' => 'civicrm_pledge',
701 'entity' => 'Pledge',
702 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 703 'localizable' => 0,
c3fc2621 704 'html' => [
e501603b 705 'type' => 'CheckBox',
c3fc2621 706 ],
a9d0587b 707 'add' => NULL,
c3fc2621
CW
708 ],
709 'pledge_campaign_id' => [
e501603b
TO
710 'name' => 'campaign_id',
711 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 712 'title' => ts('Campaign ID'),
215b423e 713 'description' => ts('The campaign for which this pledge has been initiated.'),
c3fc2621 714 'import' => TRUE,
e501603b 715 'where' => 'civicrm_pledge.campaign_id',
c3fc2621 716 'export' => TRUE,
522a26c9 717 'table_name' => 'civicrm_pledge',
718 'entity' => 'Pledge',
719 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 720 'localizable' => 0,
e501603b 721 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
88c31c05 722 'component' => 'CiviCampaign',
c3fc2621 723 'html' => [
8813f972 724 'type' => 'EntityRef',
2cbbebe8 725 'label' => ts("Campaign"),
c3fc2621 726 ],
25ad69f2
CW
727 'pseudoconstant' => [
728 'table' => 'civicrm_campaign',
729 'keyColumn' => 'id',
730 'labelColumn' => 'title',
731 'prefetch' => 'FALSE',
732 ],
a9d0587b 733 'add' => '3.4',
c3fc2621
CW
734 ],
735 ];
346aaaba 736 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 737 }
346aaaba 738 return Civi::$statics[__CLASS__]['fields'];
e501603b 739 }
c3fc2621 740
e501603b 741 /**
bd8e0b14 742 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
743 *
744 * @return array
bd8e0b14 745 * Array(string $name => string $uniqueName).
e501603b 746 */
c3fc2621 747 public static function &fieldKeys() {
bd8e0b14
TO
748 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
749 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 750 }
bd8e0b14 751 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 752 }
c3fc2621 753
e501603b
TO
754 /**
755 * Returns the names of this table
756 *
757 * @return string
758 */
c3fc2621 759 public static function getTableName() {
e501603b
TO
760 return self::$_tableName;
761 }
c3fc2621 762
e501603b
TO
763 /**
764 * Returns if this table needs to be logged
765 *
c3fc2621 766 * @return bool
e501603b 767 */
c3fc2621 768 public function getLog() {
e501603b
TO
769 return self::$_log;
770 }
c3fc2621 771
e501603b
TO
772 /**
773 * Returns the list of fields that can be imported
774 *
775 * @param bool $prefix
776 *
777 * @return array
778 */
c3fc2621
CW
779 public static function &import($prefix = FALSE) {
780 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, []);
60808919 781 return $r;
e501603b 782 }
c3fc2621 783
e501603b
TO
784 /**
785 * Returns the list of fields that can be exported
786 *
787 * @param bool $prefix
788 *
789 * @return array
790 */
c3fc2621
CW
791 public static function &export($prefix = FALSE) {
792 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, []);
60808919 793 return $r;
e501603b 794 }
c3fc2621 795
e7a6b91a
AS
796 /**
797 * Returns the list of indices
c3fc2621
CW
798 *
799 * @param bool $localize
800 *
801 * @return array
e7a6b91a
AS
802 */
803 public static function indices($localize = TRUE) {
c3fc2621
CW
804 $indices = [
805 'index_status' => [
e7a6b91a 806 'name' => 'index_status',
c3fc2621 807 'field' => [
e7a6b91a 808 0 => 'status_id',
c3fc2621
CW
809 ],
810 'localizable' => FALSE,
e7a6b91a 811 'sig' => 'civicrm_pledge::0::status_id',
c3fc2621
CW
812 ],
813 ];
e7a6b91a
AS
814 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
815 }
c3fc2621 816
e501603b 817}