Merge pull request #18158 from mattwire/createProfileContact
[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
25ad69f2 9 * (GenCodeChecksum:bcc7d49479de858804a09bf49c1ebda9)
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
2562d09a
CW
218 /**
219 * Returns user-friendly description of this entity.
220 *
221 * @return string
222 */
223 public static function getEntityDescription() {
224 return ts('Promises to contribute at a future time, either in full, or at regular intervals until a total goal is reached.');
225 }
226
e501603b 227 /**
f41f0342 228 * Returns foreign keys and entity references.
e501603b
TO
229 *
230 * @return array
231 * [CRM_Core_Reference_Interface]
232 */
c3fc2621 233 public static function getReferenceColumns() {
346aaaba 234 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 235 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
236 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
237 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
238 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
239 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
346aaaba 240 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 241 }
346aaaba 242 return Civi::$statics[__CLASS__]['links'];
e501603b 243 }
c3fc2621 244
e501603b
TO
245 /**
246 * Returns all the column names of this table
247 *
248 * @return array
249 */
c3fc2621 250 public static function &fields() {
346aaaba 251 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
252 Civi::$statics[__CLASS__]['fields'] = [
253 'pledge_id' => [
e501603b
TO
254 'name' => 'id',
255 'type' => CRM_Utils_Type::T_INT,
c3fc2621 256 'title' => ts('Pledge ID'),
215b423e 257 'description' => ts('Pledge ID'),
c3fc2621
CW
258 'required' => TRUE,
259 'import' => TRUE,
e501603b 260 'where' => 'civicrm_pledge.id',
c3fc2621 261 'export' => TRUE,
522a26c9 262 'table_name' => 'civicrm_pledge',
263 'entity' => 'Pledge',
264 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 265 'localizable' => 0,
2cbbebe8
A
266 'html' => [
267 'type' => 'Number',
268 ],
1fe423d6 269 'readonly' => TRUE,
a9d0587b 270 'add' => '2.1',
c3fc2621
CW
271 ],
272 'pledge_contact_id' => [
e501603b
TO
273 'name' => 'contact_id',
274 'type' => CRM_Utils_Type::T_INT,
c3fc2621 275 'title' => ts('Contact ID'),
215b423e 276 'description' => ts('Foreign key to civicrm_contact.id .'),
c3fc2621
CW
277 'required' => TRUE,
278 'import' => TRUE,
e501603b 279 'where' => 'civicrm_pledge.contact_id',
c3fc2621 280 'export' => TRUE,
522a26c9 281 'table_name' => 'civicrm_pledge',
282 'entity' => 'Pledge',
283 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 284 'localizable' => 0,
e501603b 285 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 286 'html' => [
e501603b 287 'type' => 'EntityRef',
2cbbebe8 288 'label' => ts("Contact"),
c3fc2621 289 ],
a9d0587b 290 'add' => '2.1',
c3fc2621
CW
291 ],
292 'pledge_financial_type_id' => [
e501603b
TO
293 'name' => 'financial_type_id',
294 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 295 'title' => ts('Financial Type ID'),
215b423e 296 'description' => ts('FK to Financial Type'),
a36434b9 297 'where' => 'civicrm_pledge.financial_type_id',
522a26c9 298 'table_name' => 'civicrm_pledge',
299 'entity' => 'Pledge',
300 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 301 'localizable' => 0,
e501603b 302 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 303 'html' => [
e501603b 304 'type' => 'Select',
2cbbebe8 305 'label' => ts("Financial Type"),
c3fc2621
CW
306 ],
307 'pseudoconstant' => [
e501603b
TO
308 'table' => 'civicrm_financial_type',
309 'keyColumn' => 'id',
310 'labelColumn' => 'name',
e6ca0a57 311 ],
a9d0587b 312 'add' => '4.3',
c3fc2621
CW
313 ],
314 'pledge_contribution_page_id' => [
e501603b
TO
315 'name' => 'contribution_page_id',
316 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 317 'title' => ts('Contribution Page ID'),
215b423e 318 'description' => ts('The Contribution Page which triggered this contribution'),
a36434b9 319 'where' => 'civicrm_pledge.contribution_page_id',
522a26c9 320 'table_name' => 'civicrm_pledge',
321 'entity' => 'Pledge',
322 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 323 'localizable' => 0,
e501603b 324 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
2cbbebe8
A
325 'html' => [
326 'label' => ts("Contribution Page"),
327 ],
a9d0587b 328 'add' => '2.1',
c3fc2621
CW
329 ],
330 'pledge_amount' => [
e501603b
TO
331 'name' => 'amount',
332 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 333 'title' => ts('Total Pledged'),
215b423e 334 'description' => ts('Total pledged amount.'),
c3fc2621
CW
335 'required' => TRUE,
336 'precision' => [
e501603b 337 20,
fb607354 338 2,
c3fc2621
CW
339 ],
340 'import' => TRUE,
e501603b 341 'where' => 'civicrm_pledge.amount',
c3fc2621 342 'export' => TRUE,
522a26c9 343 'table_name' => 'civicrm_pledge',
344 'entity' => 'Pledge',
345 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 346 'localizable' => 0,
c3fc2621 347 'html' => [
e501603b 348 'type' => 'Text',
c3fc2621 349 ],
a9d0587b 350 'add' => '2.1',
c3fc2621
CW
351 ],
352 'pledge_original_installment_amount' => [
e501603b
TO
353 'name' => 'original_installment_amount',
354 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 355 'title' => ts('Original Installment Amount'),
215b423e 356 'description' => ts('Original amount for each of the installments.'),
c3fc2621
CW
357 'required' => TRUE,
358 'precision' => [
e501603b 359 20,
fb607354 360 2,
c3fc2621 361 ],
db517dfe 362 'where' => 'civicrm_pledge.original_installment_amount',
a36434b9 363 'export' => TRUE,
522a26c9 364 'table_name' => 'civicrm_pledge',
365 'entity' => 'Pledge',
366 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 367 'localizable' => 0,
c3fc2621 368 'html' => [
e501603b 369 'type' => 'Text',
c3fc2621 370 ],
a9d0587b 371 'add' => '3.2',
c3fc2621
CW
372 ],
373 'currency' => [
e501603b
TO
374 'name' => 'currency',
375 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 376 'title' => ts('Pledge Currency'),
215b423e 377 'description' => ts('3 character string, value from config setting or input via user.'),
e501603b
TO
378 'maxlength' => 3,
379 'size' => CRM_Utils_Type::FOUR,
a36434b9 380 'where' => 'civicrm_pledge.currency',
5fb0de1f 381 'default' => NULL,
522a26c9 382 'table_name' => 'civicrm_pledge',
383 'entity' => 'Pledge',
384 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 385 'localizable' => 0,
c3fc2621 386 'html' => [
e501603b 387 'type' => 'Select',
c3fc2621
CW
388 ],
389 'pseudoconstant' => [
e501603b
TO
390 'table' => 'civicrm_currency',
391 'keyColumn' => 'name',
392 'labelColumn' => 'full_name',
393 'nameColumn' => 'name',
a8fdb24e 394 'abbrColumn' => 'symbol',
e6ca0a57 395 ],
a9d0587b 396 'add' => '3.2',
c3fc2621
CW
397 ],
398 'pledge_frequency_unit' => [
e501603b
TO
399 'name' => 'frequency_unit',
400 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 401 'title' => ts('Pledge Frequency Unit'),
215b423e 402 'description' => ts('Time units for recurrence of pledge payments.'),
64a05eb1 403 'required' => TRUE,
e501603b
TO
404 'maxlength' => 8,
405 'size' => CRM_Utils_Type::EIGHT,
a36434b9 406 'where' => 'civicrm_pledge.frequency_unit',
e501603b 407 'default' => 'month',
522a26c9 408 'table_name' => 'civicrm_pledge',
409 'entity' => 'Pledge',
410 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 411 'localizable' => 0,
c3fc2621 412 'html' => [
e501603b 413 'type' => 'Select',
c3fc2621
CW
414 ],
415 'pseudoconstant' => [
e501603b
TO
416 'optionGroupName' => 'recur_frequency_units',
417 'keyColumn' => 'name',
418 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
e6ca0a57 419 ],
a9d0587b 420 'add' => '2.1',
c3fc2621
CW
421 ],
422 'pledge_frequency_interval' => [
e501603b
TO
423 'name' => 'frequency_interval',
424 'type' => CRM_Utils_Type::T_INT,
c3fc2621 425 'title' => ts('Pledge Frequency Interval'),
215b423e 426 'description' => ts('Number of time units for recurrence of pledge payments.'),
c3fc2621 427 'required' => TRUE,
a36434b9 428 'where' => 'civicrm_pledge.frequency_interval',
e501603b 429 'default' => '1',
522a26c9 430 'table_name' => 'civicrm_pledge',
431 'entity' => 'Pledge',
432 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 433 'localizable' => 0,
c3fc2621 434 'html' => [
e501603b 435 'type' => 'Text',
c3fc2621 436 ],
a9d0587b 437 'add' => '2.1',
c3fc2621
CW
438 ],
439 'frequency_day' => [
e501603b
TO
440 'name' => 'frequency_day',
441 'type' => CRM_Utils_Type::T_INT,
c3fc2621 442 'title' => ts('Pledge day'),
215b423e 443 '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 444 'required' => TRUE,
a36434b9 445 'where' => 'civicrm_pledge.frequency_day',
e501603b 446 'default' => '3',
522a26c9 447 'table_name' => 'civicrm_pledge',
448 'entity' => 'Pledge',
449 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 450 'localizable' => 0,
c3fc2621 451 'html' => [
e501603b 452 'type' => 'Select',
c3fc2621 453 ],
a9d0587b 454 'add' => '2.1',
c3fc2621
CW
455 ],
456 'installments' => [
e501603b
TO
457 'name' => 'installments',
458 'type' => CRM_Utils_Type::T_INT,
c3fc2621 459 'title' => ts('Pledge Number of Installments'),
215b423e 460 'description' => ts('Total number of payments to be made.'),
64a05eb1 461 'required' => TRUE,
db517dfe 462 'where' => 'civicrm_pledge.installments',
a36434b9 463 'export' => TRUE,
e501603b 464 'default' => '1',
522a26c9 465 'table_name' => 'civicrm_pledge',
466 'entity' => 'Pledge',
467 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 468 'localizable' => 0,
c3fc2621 469 'html' => [
e501603b 470 'type' => 'Text',
c3fc2621 471 ],
a9d0587b 472 'add' => '2.1',
c3fc2621 473 ],
a5e468ff 474 'pledge_start_date' => [
e501603b
TO
475 'name' => 'start_date',
476 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 477 'title' => ts('Pledge Start Date'),
215b423e 478 'description' => ts('The date the first scheduled pledge occurs.'),
c3fc2621 479 'required' => TRUE,
a36434b9 480 'where' => 'civicrm_pledge.start_date',
a5e468ff 481 'export' => TRUE,
522a26c9 482 'table_name' => 'civicrm_pledge',
483 'entity' => 'Pledge',
484 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 485 'localizable' => 0,
a5e468ff 486 'unique_title' => ts('Payments Start Date'),
c3fc2621 487 'html' => [
e501603b 488 'type' => 'Select Date',
efcda6b9 489 'formatType' => 'activityDate',
c3fc2621 490 ],
a9d0587b 491 'add' => '2.1',
c3fc2621
CW
492 ],
493 'pledge_create_date' => [
e501603b
TO
494 'name' => 'create_date',
495 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 496 'title' => ts('Pledge Made'),
215b423e 497 'description' => ts('When this pledge record was created.'),
c3fc2621
CW
498 'required' => TRUE,
499 'import' => TRUE,
e501603b 500 'where' => 'civicrm_pledge.create_date',
c3fc2621 501 'export' => TRUE,
522a26c9 502 'table_name' => 'civicrm_pledge',
503 'entity' => 'Pledge',
504 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 505 'localizable' => 0,
c3fc2621 506 'html' => [
e501603b 507 'type' => 'Select Date',
efcda6b9 508 'formatType' => 'activityDate',
c3fc2621 509 ],
a9d0587b 510 'add' => '2.1',
c3fc2621
CW
511 ],
512 'acknowledge_date' => [
e501603b
TO
513 'name' => 'acknowledge_date',
514 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 515 'title' => ts('Pledge Acknowledged'),
215b423e 516 'description' => ts('When a pledge acknowledgement message was sent to the contributor.'),
a36434b9 517 'where' => 'civicrm_pledge.acknowledge_date',
522a26c9 518 'table_name' => 'civicrm_pledge',
519 'entity' => 'Pledge',
520 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 521 'localizable' => 0,
c3fc2621 522 'html' => [
e501603b 523 'type' => 'Select Date',
efcda6b9 524 'formatType' => 'activityDate',
c3fc2621 525 ],
a9d0587b 526 'add' => '2.1',
c3fc2621
CW
527 ],
528 'modified_date' => [
e501603b
TO
529 'name' => 'modified_date',
530 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 531 'title' => ts('Pledge Modified Date'),
215b423e 532 'description' => ts('Last updated date for this pledge record.'),
a36434b9 533 'where' => 'civicrm_pledge.modified_date',
522a26c9 534 'table_name' => 'civicrm_pledge',
535 'entity' => 'Pledge',
536 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 537 'localizable' => 0,
a0e733f3 538 'readonly' => TRUE,
a9d0587b 539 'add' => '2.1',
c3fc2621
CW
540 ],
541 'cancel_date' => [
e501603b
TO
542 'name' => 'cancel_date',
543 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 544 'title' => ts('Pledge Cancelled Date'),
215b423e 545 'description' => ts('Date this pledge was cancelled by contributor.'),
a36434b9 546 'where' => 'civicrm_pledge.cancel_date',
522a26c9 547 'table_name' => 'civicrm_pledge',
548 'entity' => 'Pledge',
549 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 550 'localizable' => 0,
c3fc2621 551 'html' => [
e501603b 552 'type' => 'Select Date',
efcda6b9 553 'formatType' => 'activityDate',
c3fc2621 554 ],
a9d0587b 555 'add' => '2.1',
c3fc2621 556 ],
a5e468ff 557 'pledge_end_date' => [
e501603b
TO
558 'name' => 'end_date',
559 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 560 'title' => ts('Pledge End Date'),
215b423e 561 'description' => ts('Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).'),
a36434b9 562 'where' => 'civicrm_pledge.end_date',
a5e468ff 563 'export' => TRUE,
522a26c9 564 'table_name' => 'civicrm_pledge',
565 'entity' => 'Pledge',
566 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 567 'localizable' => 0,
a5e468ff 568 'unique_title' => ts('Payments Ended Date'),
c3fc2621 569 'html' => [
e501603b 570 'type' => 'Select Date',
efcda6b9 571 'formatType' => 'activityDate',
c3fc2621 572 ],
a9d0587b 573 'add' => '2.1',
c3fc2621
CW
574 ],
575 'max_reminders' => [
e501603b
TO
576 'name' => 'max_reminders',
577 'type' => CRM_Utils_Type::T_INT,
c3fc2621 578 'title' => ts('Maximum Number of Reminders'),
215b423e 579 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
a36434b9 580 'where' => 'civicrm_pledge.max_reminders',
e501603b 581 'default' => '1',
522a26c9 582 'table_name' => 'civicrm_pledge',
583 'entity' => 'Pledge',
584 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 585 'localizable' => 0,
c3fc2621 586 'html' => [
e501603b 587 'type' => 'Text',
c3fc2621 588 ],
a9d0587b 589 'add' => '2.1',
c3fc2621
CW
590 ],
591 'initial_reminder_day' => [
e501603b
TO
592 'name' => 'initial_reminder_day',
593 'type' => CRM_Utils_Type::T_INT,
c3fc2621 594 'title' => ts('Initial Reminder Day'),
215b423e 595 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
a36434b9 596 'where' => 'civicrm_pledge.initial_reminder_day',
e501603b 597 'default' => '5',
522a26c9 598 'table_name' => 'civicrm_pledge',
599 'entity' => 'Pledge',
600 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 601 'localizable' => 0,
c3fc2621 602 'html' => [
e501603b 603 'type' => 'Select',
c3fc2621 604 ],
a9d0587b 605 'add' => '2.1',
c3fc2621
CW
606 ],
607 'additional_reminder_day' => [
e501603b
TO
608 'name' => 'additional_reminder_day',
609 'type' => CRM_Utils_Type::T_INT,
c3fc2621 610 'title' => ts('Additional Reminder Days'),
215b423e 611 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
a36434b9 612 'where' => 'civicrm_pledge.additional_reminder_day',
e501603b 613 'default' => '5',
522a26c9 614 'table_name' => 'civicrm_pledge',
615 'entity' => 'Pledge',
616 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 617 'localizable' => 0,
c3fc2621 618 'html' => [
e501603b 619 'type' => 'Text',
c3fc2621 620 ],
a9d0587b 621 'add' => '2.1',
c3fc2621
CW
622 ],
623 'pledge_status_id' => [
e501603b
TO
624 'name' => 'status_id',
625 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 626 'title' => ts('Pledge Status ID'),
215b423e 627 'description' => ts('Implicit foreign key to civicrm_option_values in the pledge_status option group.'),
64a05eb1 628 'required' => TRUE,
c3fc2621 629 'import' => TRUE,
e501603b 630 'where' => 'civicrm_pledge.status_id',
c3fc2621 631 'export' => FALSE,
522a26c9 632 'table_name' => 'civicrm_pledge',
633 'entity' => 'Pledge',
634 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 635 'localizable' => 0,
52ddd94d 636 'html' => [
637 'type' => 'Select',
638 ],
c3fc2621 639 'pseudoconstant' => [
01dac399
JP
640 'optionGroupName' => 'pledge_status',
641 'optionEditPath' => 'civicrm/admin/options/pledge_status',
e6ca0a57 642 ],
a9d0587b 643 'add' => '2.1',
c3fc2621
CW
644 ],
645 'pledge_is_test' => [
e501603b
TO
646 'name' => 'is_test',
647 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 648 'title' => ts('Test'),
64a05eb1 649 'required' => TRUE,
c3fc2621 650 'import' => TRUE,
e501603b 651 'where' => 'civicrm_pledge.is_test',
c3fc2621 652 'export' => TRUE,
45a83e42 653 'default' => '0',
522a26c9 654 'table_name' => 'civicrm_pledge',
655 'entity' => 'Pledge',
656 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 657 'localizable' => 0,
c3fc2621 658 'html' => [
e501603b 659 'type' => 'CheckBox',
c3fc2621 660 ],
a9d0587b 661 'add' => NULL,
c3fc2621
CW
662 ],
663 'pledge_campaign_id' => [
e501603b
TO
664 'name' => 'campaign_id',
665 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 666 'title' => ts('Campaign ID'),
215b423e 667 'description' => ts('The campaign for which this pledge has been initiated.'),
c3fc2621 668 'import' => TRUE,
e501603b 669 'where' => 'civicrm_pledge.campaign_id',
c3fc2621 670 'export' => TRUE,
522a26c9 671 'table_name' => 'civicrm_pledge',
672 'entity' => 'Pledge',
673 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 674 'localizable' => 0,
e501603b 675 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
88c31c05 676 'component' => 'CiviCampaign',
c3fc2621 677 'html' => [
8813f972 678 'type' => 'EntityRef',
2cbbebe8 679 'label' => ts("Campaign"),
c3fc2621 680 ],
25ad69f2
CW
681 'pseudoconstant' => [
682 'table' => 'civicrm_campaign',
683 'keyColumn' => 'id',
684 'labelColumn' => 'title',
685 'prefetch' => 'FALSE',
686 ],
a9d0587b 687 'add' => '3.4',
c3fc2621
CW
688 ],
689 ];
346aaaba 690 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 691 }
346aaaba 692 return Civi::$statics[__CLASS__]['fields'];
e501603b 693 }
c3fc2621 694
e501603b 695 /**
bd8e0b14 696 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
697 *
698 * @return array
bd8e0b14 699 * Array(string $name => string $uniqueName).
e501603b 700 */
c3fc2621 701 public static function &fieldKeys() {
bd8e0b14
TO
702 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
703 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 704 }
bd8e0b14 705 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 706 }
c3fc2621 707
e501603b
TO
708 /**
709 * Returns the names of this table
710 *
711 * @return string
712 */
c3fc2621 713 public static function getTableName() {
e501603b
TO
714 return self::$_tableName;
715 }
c3fc2621 716
e501603b
TO
717 /**
718 * Returns if this table needs to be logged
719 *
c3fc2621 720 * @return bool
e501603b 721 */
c3fc2621 722 public function getLog() {
e501603b
TO
723 return self::$_log;
724 }
c3fc2621 725
e501603b
TO
726 /**
727 * Returns the list of fields that can be imported
728 *
729 * @param bool $prefix
730 *
731 * @return array
732 */
c3fc2621
CW
733 public static function &import($prefix = FALSE) {
734 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, []);
60808919 735 return $r;
e501603b 736 }
c3fc2621 737
e501603b
TO
738 /**
739 * Returns the list of fields that can be exported
740 *
741 * @param bool $prefix
742 *
743 * @return array
744 */
c3fc2621
CW
745 public static function &export($prefix = FALSE) {
746 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, []);
60808919 747 return $r;
e501603b 748 }
c3fc2621 749
e7a6b91a
AS
750 /**
751 * Returns the list of indices
c3fc2621
CW
752 *
753 * @param bool $localize
754 *
755 * @return array
e7a6b91a
AS
756 */
757 public static function indices($localize = TRUE) {
c3fc2621
CW
758 $indices = [
759 'index_status' => [
e7a6b91a 760 'name' => 'index_status',
c3fc2621 761 'field' => [
e7a6b91a 762 0 => 'status_id',
c3fc2621
CW
763 ],
764 'localizable' => FALSE,
e7a6b91a 765 'sig' => 'civicrm_pledge::0::status_id',
c3fc2621
CW
766 ],
767 ];
e7a6b91a
AS
768 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
769 }
c3fc2621 770
e501603b 771}