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