Commit | Line | Data |
---|---|---|
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 | |
a8fdb24e | 9 | * (GenCodeChecksum:5e5bb725caa46ae10f0c5d039a03c675) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Pledge entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class 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 | ], | |
423 | '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', |
522a26c9 | 430 | 'table_name' => 'civicrm_pledge', |
431 | 'entity' => 'Pledge', | |
432 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 433 | 'localizable' => 0, |
c3fc2621 | 434 | 'html' => [ |
e501603b | 435 | 'type' => 'Select Date', |
c3fc2621 CW |
436 | ], |
437 | ], | |
438 | 'pledge_create_date' => [ | |
e501603b TO |
439 | 'name' => 'create_date', |
440 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 441 | 'title' => ts('Pledge Made'), |
215b423e | 442 | 'description' => ts('When this pledge record was created.'), |
c3fc2621 CW |
443 | 'required' => TRUE, |
444 | 'import' => TRUE, | |
e501603b | 445 | 'where' => 'civicrm_pledge.create_date', |
c3fc2621 | 446 | 'export' => TRUE, |
522a26c9 | 447 | 'table_name' => 'civicrm_pledge', |
448 | 'entity' => 'Pledge', | |
449 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 450 | 'localizable' => 0, |
c3fc2621 | 451 | 'html' => [ |
e501603b | 452 | 'type' => 'Select Date', |
c3fc2621 CW |
453 | ], |
454 | ], | |
455 | 'acknowledge_date' => [ | |
e501603b TO |
456 | 'name' => 'acknowledge_date', |
457 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 458 | 'title' => ts('Pledge Acknowledged'), |
215b423e | 459 | 'description' => ts('When a pledge acknowledgement message was sent to the contributor.'), |
a36434b9 | 460 | 'where' => 'civicrm_pledge.acknowledge_date', |
522a26c9 | 461 | 'table_name' => 'civicrm_pledge', |
462 | 'entity' => 'Pledge', | |
463 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 464 | 'localizable' => 0, |
c3fc2621 | 465 | 'html' => [ |
e501603b | 466 | 'type' => 'Select Date', |
c3fc2621 CW |
467 | ], |
468 | ], | |
469 | 'modified_date' => [ | |
e501603b TO |
470 | 'name' => 'modified_date', |
471 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 472 | 'title' => ts('Pledge Modified Date'), |
215b423e | 473 | 'description' => ts('Last updated date for this pledge record.'), |
a36434b9 | 474 | 'where' => 'civicrm_pledge.modified_date', |
522a26c9 | 475 | 'table_name' => 'civicrm_pledge', |
476 | 'entity' => 'Pledge', | |
477 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 478 | 'localizable' => 0, |
c3fc2621 CW |
479 | ], |
480 | 'cancel_date' => [ | |
e501603b TO |
481 | 'name' => 'cancel_date', |
482 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 483 | 'title' => ts('Pledge Cancelled Date'), |
215b423e | 484 | 'description' => ts('Date this pledge was cancelled by contributor.'), |
a36434b9 | 485 | 'where' => 'civicrm_pledge.cancel_date', |
522a26c9 | 486 | 'table_name' => 'civicrm_pledge', |
487 | 'entity' => 'Pledge', | |
488 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 489 | 'localizable' => 0, |
c3fc2621 | 490 | 'html' => [ |
e501603b | 491 | 'type' => 'Select Date', |
c3fc2621 CW |
492 | ], |
493 | ], | |
494 | 'end_date' => [ | |
e501603b TO |
495 | 'name' => 'end_date', |
496 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 497 | 'title' => ts('Pledge End Date'), |
215b423e | 498 | 'description' => ts('Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).'), |
a36434b9 | 499 | 'where' => 'civicrm_pledge.end_date', |
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'), |
215b423e | 512 | 'description' => ts('The maximum number of payment reminders to send for any given payment.'), |
a36434b9 | 513 | 'where' => 'civicrm_pledge.max_reminders', |
e501603b | 514 | 'default' => '1', |
522a26c9 | 515 | 'table_name' => 'civicrm_pledge', |
516 | 'entity' => 'Pledge', | |
517 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 518 | 'localizable' => 0, |
c3fc2621 | 519 | 'html' => [ |
e501603b | 520 | 'type' => 'Text', |
c3fc2621 CW |
521 | ], |
522 | ], | |
523 | 'initial_reminder_day' => [ | |
e501603b TO |
524 | 'name' => 'initial_reminder_day', |
525 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 526 | 'title' => ts('Initial Reminder Day'), |
215b423e | 527 | 'description' => ts('Send initial reminder this many days prior to the payment due date.'), |
a36434b9 | 528 | 'where' => 'civicrm_pledge.initial_reminder_day', |
e501603b | 529 | 'default' => '5', |
522a26c9 | 530 | 'table_name' => 'civicrm_pledge', |
531 | 'entity' => 'Pledge', | |
532 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 533 | 'localizable' => 0, |
c3fc2621 | 534 | 'html' => [ |
e501603b | 535 | 'type' => 'Select', |
c3fc2621 CW |
536 | ], |
537 | ], | |
538 | 'additional_reminder_day' => [ | |
e501603b TO |
539 | 'name' => 'additional_reminder_day', |
540 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 541 | 'title' => ts('Additional Reminder Days'), |
215b423e | 542 | 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'), |
a36434b9 | 543 | 'where' => 'civicrm_pledge.additional_reminder_day', |
e501603b | 544 | 'default' => '5', |
522a26c9 | 545 | 'table_name' => 'civicrm_pledge', |
546 | 'entity' => 'Pledge', | |
547 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 548 | 'localizable' => 0, |
c3fc2621 | 549 | 'html' => [ |
e501603b | 550 | 'type' => 'Text', |
c3fc2621 CW |
551 | ], |
552 | ], | |
553 | 'pledge_status_id' => [ | |
e501603b TO |
554 | 'name' => 'status_id', |
555 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 556 | 'title' => ts('Pledge Status Id'), |
215b423e | 557 | 'description' => ts('Implicit foreign key to civicrm_option_values in the pledge_status option group.'), |
c3fc2621 | 558 | 'import' => TRUE, |
e501603b | 559 | 'where' => 'civicrm_pledge.status_id', |
c3fc2621 | 560 | 'export' => FALSE, |
522a26c9 | 561 | 'table_name' => 'civicrm_pledge', |
562 | 'entity' => 'Pledge', | |
563 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 564 | 'localizable' => 0, |
52ddd94d | 565 | 'html' => [ |
566 | 'type' => 'Select', | |
567 | ], | |
c3fc2621 | 568 | 'pseudoconstant' => [ |
01dac399 JP |
569 | 'optionGroupName' => 'pledge_status', |
570 | 'optionEditPath' => 'civicrm/admin/options/pledge_status', | |
e6ca0a57 | 571 | ], |
c3fc2621 CW |
572 | ], |
573 | 'pledge_is_test' => [ | |
e501603b TO |
574 | 'name' => 'is_test', |
575 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
576 | 'title' => ts('Test'), |
577 | 'import' => TRUE, | |
e501603b | 578 | 'where' => 'civicrm_pledge.is_test', |
c3fc2621 | 579 | 'export' => TRUE, |
45a83e42 | 580 | 'default' => '0', |
522a26c9 | 581 | 'table_name' => 'civicrm_pledge', |
582 | 'entity' => 'Pledge', | |
583 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 584 | 'localizable' => 0, |
c3fc2621 | 585 | 'html' => [ |
e501603b | 586 | 'type' => 'CheckBox', |
c3fc2621 CW |
587 | ], |
588 | ], | |
589 | 'pledge_campaign_id' => [ | |
e501603b TO |
590 | 'name' => 'campaign_id', |
591 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 592 | 'title' => ts('Campaign'), |
215b423e | 593 | 'description' => ts('The campaign for which this pledge has been initiated.'), |
c3fc2621 | 594 | 'import' => TRUE, |
e501603b | 595 | 'where' => 'civicrm_pledge.campaign_id', |
c3fc2621 | 596 | 'export' => TRUE, |
522a26c9 | 597 | 'table_name' => 'civicrm_pledge', |
598 | 'entity' => 'Pledge', | |
599 | 'bao' => 'CRM_Pledge_BAO_Pledge', | |
6a7e5e5d | 600 | 'localizable' => 0, |
e501603b | 601 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 602 | 'html' => [ |
e501603b | 603 | 'type' => 'Select', |
c3fc2621 CW |
604 | ], |
605 | 'pseudoconstant' => [ | |
e501603b TO |
606 | 'table' => 'civicrm_campaign', |
607 | 'keyColumn' => 'id', | |
608 | 'labelColumn' => 'title', | |
e6ca0a57 | 609 | ], |
c3fc2621 CW |
610 | ], |
611 | ]; | |
346aaaba | 612 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 613 | } |
346aaaba | 614 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 615 | } |
c3fc2621 | 616 | |
e501603b | 617 | /** |
bd8e0b14 | 618 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
619 | * |
620 | * @return array | |
bd8e0b14 | 621 | * Array(string $name => string $uniqueName). |
e501603b | 622 | */ |
c3fc2621 | 623 | public static function &fieldKeys() { |
bd8e0b14 TO |
624 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
625 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 626 | } |
bd8e0b14 | 627 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 628 | } |
c3fc2621 | 629 | |
e501603b TO |
630 | /** |
631 | * Returns the names of this table | |
632 | * | |
633 | * @return string | |
634 | */ | |
c3fc2621 | 635 | public static function getTableName() { |
e501603b TO |
636 | return self::$_tableName; |
637 | } | |
c3fc2621 | 638 | |
e501603b TO |
639 | /** |
640 | * Returns if this table needs to be logged | |
641 | * | |
c3fc2621 | 642 | * @return bool |
e501603b | 643 | */ |
c3fc2621 | 644 | public function getLog() { |
e501603b TO |
645 | return self::$_log; |
646 | } | |
c3fc2621 | 647 | |
e501603b TO |
648 | /** |
649 | * Returns the list of fields that can be imported | |
650 | * | |
651 | * @param bool $prefix | |
652 | * | |
653 | * @return array | |
654 | */ | |
c3fc2621 CW |
655 | public static function &import($prefix = FALSE) { |
656 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, []); | |
60808919 | 657 | return $r; |
e501603b | 658 | } |
c3fc2621 | 659 | |
e501603b TO |
660 | /** |
661 | * Returns the list of fields that can be exported | |
662 | * | |
663 | * @param bool $prefix | |
664 | * | |
665 | * @return array | |
666 | */ | |
c3fc2621 CW |
667 | public static function &export($prefix = FALSE) { |
668 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, []); | |
60808919 | 669 | return $r; |
e501603b | 670 | } |
c3fc2621 | 671 | |
e7a6b91a AS |
672 | /** |
673 | * Returns the list of indices | |
c3fc2621 CW |
674 | * |
675 | * @param bool $localize | |
676 | * | |
677 | * @return array | |
e7a6b91a AS |
678 | */ |
679 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
680 | $indices = [ |
681 | 'index_status' => [ | |
e7a6b91a | 682 | 'name' => 'index_status', |
c3fc2621 | 683 | 'field' => [ |
e7a6b91a | 684 | 0 => 'status_id', |
c3fc2621 CW |
685 | ], |
686 | 'localizable' => FALSE, | |
e7a6b91a | 687 | 'sig' => 'civicrm_pledge::0::status_id', |
c3fc2621 CW |
688 | ], |
689 | ]; | |
e7a6b91a AS |
690 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
691 | } | |
c3fc2621 | 692 | |
e501603b | 693 | } |