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