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