Merge pull request #11142 from JMAConsulting/CRM-21260
[civicrm-core.git] / CRM / Pledge / DAO / Pledge.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
0f03f337 5 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Pledge/Pledge.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
db517dfe 9 * (GenCodeChecksum:0e2129564a1877226e6dfce2840ce831)
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 */
22 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 */
c3fc2621
CW
29 static $_log = TRUE;
30
e501603b
TO
31 /**
32 * Pledge ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Foreign key to civicrm_contact.id .
40 *
41 * @var int unsigned
42 */
43 public $contact_id;
c3fc2621 44
e501603b
TO
45 /**
46 * FK to Financial Type
47 *
48 * @var int unsigned
49 */
50 public $financial_type_id;
c3fc2621 51
e501603b
TO
52 /**
53 * The Contribution Page which triggered this contribution
54 *
55 * @var int unsigned
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 *
90 * @var int unsigned
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 *
97 * @var int unsigned
98 */
99 public $frequency_day;
c3fc2621 100
e501603b
TO
101 /**
102 * Total number of payments to be made.
103 *
104 * @var int unsigned
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 *
153 * @var int unsigned
154 */
155 public $max_reminders;
c3fc2621 156
e501603b
TO
157 /**
158 * Send initial reminder this many days prior to the payment due date.
159 *
160 * @var int unsigned
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 *
167 * @var int unsigned
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
TO
173 *
174 * @var int unsigned
175 */
176 public $status_id;
c3fc2621 177
e501603b 178 /**
e501603b
TO
179 * @var boolean
180 */
181 public $is_test;
c3fc2621 182
e501603b
TO
183 /**
184 * The campaign for which this pledge has been initiated.
185 *
186 * @var int unsigned
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
TO
205 if (!isset(Civi::$statics[__CLASS__]['links'])) {
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'),
e501603b 228 'description' => 'Pledge ID',
c3fc2621
CW
229 'required' => TRUE,
230 'import' => TRUE,
e501603b
TO
231 'where' => 'civicrm_pledge.id',
232 'headerPattern' => '',
233 'dataPattern' => '',
c3fc2621 234 'export' => TRUE,
522a26c9 235 'table_name' => 'civicrm_pledge',
236 'entity' => 'Pledge',
237 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 238 'localizable' => 0,
c3fc2621
CW
239 ],
240 'pledge_contact_id' => [
e501603b
TO
241 'name' => 'contact_id',
242 'type' => CRM_Utils_Type::T_INT,
c3fc2621 243 'title' => ts('Contact ID'),
e501603b 244 'description' => 'Foreign key to civicrm_contact.id .',
c3fc2621
CW
245 'required' => TRUE,
246 'import' => TRUE,
e501603b
TO
247 'where' => 'civicrm_pledge.contact_id',
248 'headerPattern' => '',
249 'dataPattern' => '',
c3fc2621 250 'export' => TRUE,
522a26c9 251 'table_name' => 'civicrm_pledge',
252 'entity' => 'Pledge',
253 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 254 'localizable' => 0,
e501603b 255 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 256 'html' => [
e501603b 257 'type' => 'EntityRef',
c3fc2621
CW
258 ],
259 ],
260 'pledge_financial_type_id' => [
e501603b
TO
261 'name' => 'financial_type_id',
262 'type' => CRM_Utils_Type::T_INT,
c3fc2621 263 'title' => ts('Type'),
e501603b 264 'description' => 'FK to Financial Type',
522a26c9 265 'table_name' => 'civicrm_pledge',
266 'entity' => 'Pledge',
267 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 268 'localizable' => 0,
e501603b 269 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 270 'html' => [
e501603b 271 'type' => 'Select',
c3fc2621
CW
272 ],
273 'pseudoconstant' => [
e501603b
TO
274 'table' => 'civicrm_financial_type',
275 'keyColumn' => 'id',
276 'labelColumn' => 'name',
c3fc2621
CW
277 ]
278 ],
279 'pledge_contribution_page_id' => [
e501603b
TO
280 'name' => 'contribution_page_id',
281 'type' => CRM_Utils_Type::T_INT,
c3fc2621 282 'title' => ts('Pledge Contribution Page'),
e501603b 283 'description' => 'The Contribution Page which triggered this contribution',
522a26c9 284 'table_name' => 'civicrm_pledge',
285 'entity' => 'Pledge',
286 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 287 'localizable' => 0,
e501603b 288 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
c3fc2621
CW
289 ],
290 'pledge_amount' => [
e501603b
TO
291 'name' => 'amount',
292 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 293 'title' => ts('Total Pledged'),
e501603b 294 'description' => 'Total pledged amount.',
c3fc2621
CW
295 'required' => TRUE,
296 'precision' => [
e501603b
TO
297 20,
298 2
c3fc2621
CW
299 ],
300 'import' => TRUE,
e501603b
TO
301 'where' => 'civicrm_pledge.amount',
302 'headerPattern' => '',
303 'dataPattern' => '',
c3fc2621 304 'export' => TRUE,
522a26c9 305 'table_name' => 'civicrm_pledge',
306 'entity' => 'Pledge',
307 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 308 'localizable' => 0,
c3fc2621 309 'html' => [
e501603b 310 'type' => 'Text',
c3fc2621
CW
311 ],
312 ],
313 'pledge_original_installment_amount' => [
e501603b
TO
314 'name' => 'original_installment_amount',
315 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 316 'title' => ts('Original Installment Amount'),
e501603b 317 'description' => 'Original amount for each of the installments.',
c3fc2621
CW
318 'required' => TRUE,
319 'precision' => [
e501603b
TO
320 20,
321 2
c3fc2621
CW
322 ],
323 'export' => TRUE,
db517dfe
NM
324 'where' => 'civicrm_pledge.original_installment_amount',
325 'headerPattern' => '',
326 'dataPattern' => '',
522a26c9 327 'table_name' => 'civicrm_pledge',
328 'entity' => 'Pledge',
329 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 330 'localizable' => 0,
c3fc2621 331 'html' => [
e501603b 332 'type' => 'Text',
c3fc2621
CW
333 ],
334 ],
335 'currency' => [
e501603b
TO
336 'name' => 'currency',
337 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 338 'title' => ts('Pledge Currency'),
e501603b
TO
339 'description' => '3 character string, value from config setting or input via user.',
340 'maxlength' => 3,
341 'size' => CRM_Utils_Type::FOUR,
342 'default' => 'NULL',
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' => 'Select',
c3fc2621
CW
349 ],
350 'pseudoconstant' => [
e501603b
TO
351 'table' => 'civicrm_currency',
352 'keyColumn' => 'name',
353 'labelColumn' => 'full_name',
354 'nameColumn' => 'name',
c3fc2621
CW
355 ]
356 ],
357 'pledge_frequency_unit' => [
e501603b
TO
358 'name' => 'frequency_unit',
359 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 360 'title' => ts('Pledge Frequency Unit'),
e501603b
TO
361 'description' => 'Time units for recurrence of pledge payments.',
362 'maxlength' => 8,
363 'size' => CRM_Utils_Type::EIGHT,
364 'default' => 'month',
522a26c9 365 'table_name' => 'civicrm_pledge',
366 'entity' => 'Pledge',
367 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 368 'localizable' => 0,
c3fc2621 369 'html' => [
e501603b 370 'type' => 'Select',
c3fc2621
CW
371 ],
372 'pseudoconstant' => [
e501603b
TO
373 'optionGroupName' => 'recur_frequency_units',
374 'keyColumn' => 'name',
375 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
c3fc2621
CW
376 ]
377 ],
378 'pledge_frequency_interval' => [
e501603b
TO
379 'name' => 'frequency_interval',
380 'type' => CRM_Utils_Type::T_INT,
c3fc2621 381 'title' => ts('Pledge Frequency Interval'),
e501603b 382 'description' => 'Number of time units for recurrence of pledge payments.',
c3fc2621 383 'required' => TRUE,
e501603b 384 'default' => '1',
522a26c9 385 'table_name' => 'civicrm_pledge',
386 'entity' => 'Pledge',
387 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 388 'localizable' => 0,
c3fc2621 389 'html' => [
e501603b 390 'type' => 'Text',
c3fc2621
CW
391 ],
392 ],
393 'frequency_day' => [
e501603b
TO
394 'name' => 'frequency_day',
395 'type' => CRM_Utils_Type::T_INT,
c3fc2621 396 'title' => ts('Pledge day'),
e501603b 397 'description' => '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 398 'required' => TRUE,
e501603b 399 'default' => '3',
522a26c9 400 'table_name' => 'civicrm_pledge',
401 'entity' => 'Pledge',
402 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 403 'localizable' => 0,
c3fc2621 404 'html' => [
e501603b 405 'type' => 'Select',
c3fc2621
CW
406 ],
407 ],
408 'installments' => [
e501603b
TO
409 'name' => 'installments',
410 'type' => CRM_Utils_Type::T_INT,
c3fc2621 411 'title' => ts('Pledge Number of Installments'),
e501603b 412 'description' => 'Total number of payments to be made.',
c3fc2621 413 'export' => TRUE,
db517dfe
NM
414 'where' => 'civicrm_pledge.installments',
415 'headerPattern' => '',
416 'dataPattern' => '',
e501603b 417 'default' => '1',
522a26c9 418 'table_name' => 'civicrm_pledge',
419 'entity' => 'Pledge',
420 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 421 'localizable' => 0,
c3fc2621 422 'html' => [
e501603b 423 'type' => 'Text',
c3fc2621
CW
424 ],
425 ],
426 'start_date' => [
e501603b
TO
427 'name' => 'start_date',
428 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 429 'title' => ts('Pledge Start Date'),
e501603b 430 'description' => 'The date the first scheduled pledge occurs.',
c3fc2621 431 'required' => TRUE,
522a26c9 432 'table_name' => 'civicrm_pledge',
433 'entity' => 'Pledge',
434 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 435 'localizable' => 0,
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'),
e501603b 444 'description' => 'When this pledge record was created.',
c3fc2621
CW
445 'required' => TRUE,
446 'import' => TRUE,
e501603b
TO
447 'where' => 'civicrm_pledge.create_date',
448 'headerPattern' => '',
449 'dataPattern' => '',
c3fc2621 450 'export' => TRUE,
522a26c9 451 'table_name' => 'civicrm_pledge',
452 'entity' => 'Pledge',
453 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 454 'localizable' => 0,
c3fc2621 455 'html' => [
e501603b 456 'type' => 'Select Date',
c3fc2621
CW
457 ],
458 ],
459 'acknowledge_date' => [
e501603b
TO
460 'name' => 'acknowledge_date',
461 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 462 'title' => ts('Pledge Acknowledged'),
e501603b 463 'description' => 'When a pledge acknowledgement message was sent to the contributor.',
522a26c9 464 'table_name' => 'civicrm_pledge',
465 'entity' => 'Pledge',
466 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 467 'localizable' => 0,
c3fc2621 468 'html' => [
e501603b 469 'type' => 'Select Date',
c3fc2621
CW
470 ],
471 ],
472 'modified_date' => [
e501603b
TO
473 'name' => 'modified_date',
474 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 475 'title' => ts('Pledge Modified Date'),
e501603b 476 'description' => 'Last updated date for this pledge record.',
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'),
e501603b 486 'description' => 'Date this pledge was cancelled by contributor.',
522a26c9 487 'table_name' => 'civicrm_pledge',
488 'entity' => 'Pledge',
489 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 490 'localizable' => 0,
c3fc2621 491 'html' => [
e501603b 492 'type' => 'Select Date',
c3fc2621
CW
493 ],
494 ],
495 'end_date' => [
e501603b
TO
496 'name' => 'end_date',
497 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 498 'title' => ts('Pledge End Date'),
e501603b 499 'description' => 'Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).',
522a26c9 500 'table_name' => 'civicrm_pledge',
501 'entity' => 'Pledge',
502 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 503 'localizable' => 0,
c3fc2621 504 'html' => [
e501603b 505 'type' => 'Select Date',
c3fc2621
CW
506 ],
507 ],
508 'max_reminders' => [
e501603b
TO
509 'name' => 'max_reminders',
510 'type' => CRM_Utils_Type::T_INT,
c3fc2621 511 'title' => ts('Maximum Number of Reminders'),
e501603b
TO
512 'description' => 'The maximum number of payment reminders to send for any given payment.',
513 'default' => '1',
522a26c9 514 'table_name' => 'civicrm_pledge',
515 'entity' => 'Pledge',
516 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 517 'localizable' => 0,
c3fc2621 518 'html' => [
e501603b 519 'type' => 'Text',
c3fc2621
CW
520 ],
521 ],
522 'initial_reminder_day' => [
e501603b
TO
523 'name' => 'initial_reminder_day',
524 'type' => CRM_Utils_Type::T_INT,
c3fc2621 525 'title' => ts('Initial Reminder Day'),
e501603b
TO
526 'description' => 'Send initial reminder this many days prior to the payment due date.',
527 'default' => '5',
522a26c9 528 'table_name' => 'civicrm_pledge',
529 'entity' => 'Pledge',
530 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 531 'localizable' => 0,
c3fc2621 532 'html' => [
e501603b 533 'type' => 'Select',
c3fc2621
CW
534 ],
535 ],
536 'additional_reminder_day' => [
e501603b
TO
537 'name' => 'additional_reminder_day',
538 'type' => CRM_Utils_Type::T_INT,
c3fc2621 539 'title' => ts('Additional Reminder Days'),
e501603b
TO
540 'description' => 'Send additional reminder this many days after last one sent, up to maximum number of reminders.',
541 'default' => '5',
522a26c9 542 'table_name' => 'civicrm_pledge',
543 'entity' => 'Pledge',
544 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 545 'localizable' => 0,
c3fc2621 546 'html' => [
e501603b 547 'type' => 'Text',
c3fc2621
CW
548 ],
549 ],
550 'pledge_status_id' => [
e501603b
TO
551 'name' => 'status_id',
552 'type' => CRM_Utils_Type::T_INT,
c3fc2621 553 'title' => ts('Pledge Status Id'),
01dac399 554 'description' => 'Implicit foreign key to civicrm_option_values in the pledge_status option group.',
c3fc2621 555 'import' => TRUE,
e501603b
TO
556 'where' => 'civicrm_pledge.status_id',
557 'headerPattern' => '',
558 'dataPattern' => '',
c3fc2621 559 'export' => FALSE,
522a26c9 560 'table_name' => 'civicrm_pledge',
561 'entity' => 'Pledge',
562 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 563 'localizable' => 0,
c3fc2621 564 'pseudoconstant' => [
01dac399
JP
565 'optionGroupName' => 'pledge_status',
566 'optionEditPath' => 'civicrm/admin/options/pledge_status',
c3fc2621
CW
567 ]
568 ],
569 'pledge_is_test' => [
e501603b
TO
570 'name' => 'is_test',
571 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
572 'title' => ts('Test'),
573 'import' => TRUE,
e501603b
TO
574 'where' => 'civicrm_pledge.is_test',
575 'headerPattern' => '',
576 'dataPattern' => '',
c3fc2621 577 'export' => TRUE,
522a26c9 578 'table_name' => 'civicrm_pledge',
579 'entity' => 'Pledge',
580 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 581 'localizable' => 0,
c3fc2621 582 'html' => [
e501603b 583 'type' => 'CheckBox',
c3fc2621
CW
584 ],
585 ],
586 'pledge_campaign_id' => [
e501603b
TO
587 'name' => 'campaign_id',
588 'type' => CRM_Utils_Type::T_INT,
c3fc2621 589 'title' => ts('Campaign'),
e501603b 590 'description' => 'The campaign for which this pledge has been initiated.',
c3fc2621 591 'import' => TRUE,
e501603b
TO
592 'where' => 'civicrm_pledge.campaign_id',
593 'headerPattern' => '',
594 'dataPattern' => '',
c3fc2621 595 'export' => TRUE,
522a26c9 596 'table_name' => 'civicrm_pledge',
597 'entity' => 'Pledge',
598 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 599 'localizable' => 0,
e501603b 600 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
c3fc2621 601 'html' => [
e501603b 602 'type' => 'Select',
c3fc2621
CW
603 ],
604 'pseudoconstant' => [
e501603b
TO
605 'table' => 'civicrm_campaign',
606 'keyColumn' => 'id',
607 'labelColumn' => 'title',
c3fc2621
CW
608 ]
609 ],
610 ];
346aaaba 611 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 612 }
346aaaba 613 return Civi::$statics[__CLASS__]['fields'];
e501603b 614 }
c3fc2621 615
e501603b 616 /**
bd8e0b14 617 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
618 *
619 * @return array
bd8e0b14 620 * Array(string $name => string $uniqueName).
e501603b 621 */
c3fc2621 622 public static function &fieldKeys() {
bd8e0b14
TO
623 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
624 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 625 }
bd8e0b14 626 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 627 }
c3fc2621 628
e501603b
TO
629 /**
630 * Returns the names of this table
631 *
632 * @return string
633 */
c3fc2621 634 public static function getTableName() {
e501603b
TO
635 return self::$_tableName;
636 }
c3fc2621 637
e501603b
TO
638 /**
639 * Returns if this table needs to be logged
640 *
c3fc2621 641 * @return bool
e501603b 642 */
c3fc2621 643 public function getLog() {
e501603b
TO
644 return self::$_log;
645 }
c3fc2621 646
e501603b
TO
647 /**
648 * Returns the list of fields that can be imported
649 *
650 * @param bool $prefix
651 *
652 * @return array
653 */
c3fc2621
CW
654 public static function &import($prefix = FALSE) {
655 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, []);
60808919 656 return $r;
e501603b 657 }
c3fc2621 658
e501603b
TO
659 /**
660 * Returns the list of fields that can be exported
661 *
662 * @param bool $prefix
663 *
664 * @return array
665 */
c3fc2621
CW
666 public static function &export($prefix = FALSE) {
667 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, []);
60808919 668 return $r;
e501603b 669 }
c3fc2621 670
e7a6b91a
AS
671 /**
672 * Returns the list of indices
c3fc2621
CW
673 *
674 * @param bool $localize
675 *
676 * @return array
e7a6b91a
AS
677 */
678 public static function indices($localize = TRUE) {
c3fc2621
CW
679 $indices = [
680 'index_status' => [
e7a6b91a 681 'name' => 'index_status',
c3fc2621 682 'field' => [
e7a6b91a 683 0 => 'status_id',
c3fc2621
CW
684 ],
685 'localizable' => FALSE,
e7a6b91a 686 'sig' => 'civicrm_pledge::0::status_id',
c3fc2621
CW
687 ],
688 ];
e7a6b91a
AS
689 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
690 }
c3fc2621 691
e501603b 692}