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