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