Merge pull request #21917 from braders/feature/translate-set-title-calls
[civicrm-core.git] / CRM / Pledge / DAO / PledgePayment.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Pledge/PledgePayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:bfa7183802af9f28111c1d7c7dc6af5a)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PledgePayment entity.
f41f0342 14 */
e501603b 15class CRM_Pledge_DAO_PledgePayment 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_payment';
c3fc2621 26
e501603b 27 /**
f41f0342 28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 29 *
c3fc2621 30 * @var bool
e501603b 31 */
fa45b5b9 32 public static $_log = TRUE;
c3fc2621 33
e501603b 34 /**
e6ca0a57 35 * @var int
e501603b
TO
36 */
37 public $id;
c3fc2621 38
e501603b
TO
39 /**
40 * FK to Pledge table
41 *
e6ca0a57 42 * @var int
e501603b
TO
43 */
44 public $pledge_id;
c3fc2621 45
e501603b
TO
46 /**
47 * FK to contribution table.
48 *
e6ca0a57 49 * @var int
e501603b
TO
50 */
51 public $contribution_id;
c3fc2621 52
e501603b
TO
53 /**
54 * Pledged amount for this payment (the actual contribution amount might be different).
55 *
56 * @var float
57 */
58 public $scheduled_amount;
c3fc2621 59
e501603b
TO
60 /**
61 * Actual amount that is paid as the Pledged installment amount.
62 *
63 * @var float
64 */
65 public $actual_amount;
c3fc2621 66
e501603b
TO
67 /**
68 * 3 character string, value from config setting or input via user.
69 *
70 * @var string
71 */
72 public $currency;
c3fc2621 73
e501603b
TO
74 /**
75 * The date the pledge payment is supposed to happen.
76 *
77 * @var datetime
78 */
79 public $scheduled_date;
c3fc2621 80
e501603b
TO
81 /**
82 * The date that the most recent payment reminder was sent.
83 *
84 * @var datetime
85 */
86 public $reminder_date;
c3fc2621 87
e501603b
TO
88 /**
89 * The number of payment reminders sent.
90 *
e6ca0a57 91 * @var int
e501603b
TO
92 */
93 public $reminder_count;
c3fc2621 94
e501603b 95 /**
e6ca0a57 96 * @var int
e501603b
TO
97 */
98 public $status_id;
c3fc2621 99
e501603b 100 /**
f41f0342 101 * Class constructor.
e501603b 102 */
c3fc2621 103 public function __construct() {
e501603b
TO
104 $this->__table = 'civicrm_pledge_payment';
105 parent::__construct();
106 }
c3fc2621 107
449c4e6b
CW
108 /**
109 * Returns localized title of this entity.
7b66c3b5
AH
110 *
111 * @param bool $plural
112 * Whether to return the plural version of the title.
449c4e6b 113 */
7b66c3b5
AH
114 public static function getEntityTitle($plural = FALSE) {
115 return $plural ? ts('Pledge Payments') : ts('Pledge Payment');
449c4e6b
CW
116 }
117
e501603b 118 /**
f41f0342 119 * Returns foreign keys and entity references.
e501603b
TO
120 *
121 * @return array
122 * [CRM_Core_Reference_Interface]
123 */
c3fc2621 124 public static function getReferenceColumns() {
346aaaba 125 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 126 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
127 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pledge_id', 'civicrm_pledge', 'id');
128 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
346aaaba 129 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 130 }
346aaaba 131 return Civi::$statics[__CLASS__]['links'];
e501603b 132 }
c3fc2621 133
e501603b
TO
134 /**
135 * Returns all the column names of this table
136 *
137 * @return array
138 */
c3fc2621 139 public static function &fields() {
346aaaba 140 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
141 Civi::$statics[__CLASS__]['fields'] = [
142 'pledge_payment_id' => [
e501603b
TO
143 'name' => 'id',
144 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
145 'title' => ts('Payment ID'),
146 'required' => TRUE,
147 'import' => TRUE,
e501603b 148 'where' => 'civicrm_pledge_payment.id',
c3fc2621 149 'export' => TRUE,
522a26c9 150 'table_name' => 'civicrm_pledge_payment',
151 'entity' => 'PledgePayment',
152 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 153 'localizable' => 0,
2cbbebe8
A
154 'html' => [
155 'type' => 'Number',
156 ],
1fe423d6 157 'readonly' => TRUE,
a9d0587b 158 'add' => '2.1',
c3fc2621
CW
159 ],
160 'pledge_id' => [
e501603b
TO
161 'name' => 'pledge_id',
162 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 163 'title' => ts('Pledge ID'),
215b423e 164 'description' => ts('FK to Pledge table'),
c3fc2621 165 'required' => TRUE,
a36434b9 166 'where' => 'civicrm_pledge_payment.pledge_id',
522a26c9 167 'table_name' => 'civicrm_pledge_payment',
168 'entity' => 'PledgePayment',
169 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 170 'localizable' => 0,
e501603b 171 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
2cbbebe8
A
172 'html' => [
173 'label' => ts("Pledge"),
174 ],
a9d0587b 175 'add' => '2.1',
c3fc2621
CW
176 ],
177 'contribution_id' => [
e501603b
TO
178 'name' => 'contribution_id',
179 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 180 'title' => ts('Contribution ID'),
215b423e 181 'description' => ts('FK to contribution table.'),
a36434b9 182 'where' => 'civicrm_pledge_payment.contribution_id',
522a26c9 183 'table_name' => 'civicrm_pledge_payment',
184 'entity' => 'PledgePayment',
185 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 186 'localizable' => 0,
e501603b 187 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
2cbbebe8
A
188 'html' => [
189 'label' => ts("Contribution"),
190 ],
a9d0587b 191 'add' => '2.1',
c3fc2621
CW
192 ],
193 'pledge_payment_scheduled_amount' => [
e501603b
TO
194 'name' => 'scheduled_amount',
195 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 196 'title' => ts('Scheduled Amount'),
215b423e 197 'description' => ts('Pledged amount for this payment (the actual contribution amount might be different).'),
c3fc2621
CW
198 'required' => TRUE,
199 'precision' => [
e501603b 200 20,
fb607354 201 2,
c3fc2621
CW
202 ],
203 'import' => TRUE,
e501603b 204 'where' => 'civicrm_pledge_payment.scheduled_amount',
c3fc2621 205 'export' => TRUE,
522a26c9 206 'table_name' => 'civicrm_pledge_payment',
207 'entity' => 'PledgePayment',
208 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 209 'localizable' => 0,
a9d0587b 210 'add' => '2.1',
c3fc2621
CW
211 ],
212 'pledge_payment_actual_amount' => [
e501603b
TO
213 'name' => 'actual_amount',
214 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 215 'title' => ts('Actual Amount'),
215b423e 216 'description' => ts('Actual amount that is paid as the Pledged installment amount.'),
c3fc2621 217 'precision' => [
e501603b 218 20,
fb607354 219 2,
c3fc2621
CW
220 ],
221 'import' => TRUE,
e501603b 222 'where' => 'civicrm_pledge_payment.actual_amount',
c3fc2621 223 'export' => TRUE,
522a26c9 224 'table_name' => 'civicrm_pledge_payment',
225 'entity' => 'PledgePayment',
226 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 227 'localizable' => 0,
a9d0587b 228 'add' => '3.2',
c3fc2621
CW
229 ],
230 'currency' => [
e501603b
TO
231 'name' => 'currency',
232 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 233 'title' => ts('Currency'),
215b423e 234 'description' => ts('3 character string, value from config setting or input via user.'),
e501603b
TO
235 'maxlength' => 3,
236 'size' => CRM_Utils_Type::FOUR,
a36434b9 237 'where' => 'civicrm_pledge_payment.currency',
5fb0de1f 238 'default' => NULL,
522a26c9 239 'table_name' => 'civicrm_pledge_payment',
240 'entity' => 'PledgePayment',
241 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 242 'localizable' => 0,
c3fc2621 243 'html' => [
e501603b 244 'type' => 'Select',
c3fc2621
CW
245 ],
246 'pseudoconstant' => [
e501603b
TO
247 'table' => 'civicrm_currency',
248 'keyColumn' => 'name',
249 'labelColumn' => 'full_name',
250 'nameColumn' => 'name',
a8fdb24e 251 'abbrColumn' => 'symbol',
e6ca0a57 252 ],
a9d0587b 253 'add' => '3.2',
c3fc2621
CW
254 ],
255 'pledge_payment_scheduled_date' => [
e501603b
TO
256 'name' => 'scheduled_date',
257 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 258 'title' => ts('Scheduled Date'),
215b423e 259 'description' => ts('The date the pledge payment is supposed to happen.'),
c3fc2621
CW
260 'required' => TRUE,
261 'import' => TRUE,
e501603b 262 'where' => 'civicrm_pledge_payment.scheduled_date',
c3fc2621 263 'export' => TRUE,
522a26c9 264 'table_name' => 'civicrm_pledge_payment',
265 'entity' => 'PledgePayment',
266 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 267 'localizable' => 0,
1519c828 268 'unique_title' => ts('Payment Scheduled'),
267fb11a
SL
269 'html' => [
270 'type' => 'Select Date',
271 'formatType' => 'activityDate',
272 ],
a9d0587b 273 'add' => '2.1',
c3fc2621
CW
274 ],
275 'pledge_payment_reminder_date' => [
e501603b
TO
276 'name' => 'reminder_date',
277 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 278 'title' => ts('Last Reminder'),
215b423e 279 'description' => ts('The date that the most recent payment reminder was sent.'),
c3fc2621 280 'import' => TRUE,
e501603b 281 'where' => 'civicrm_pledge_payment.reminder_date',
c3fc2621 282 'export' => TRUE,
522a26c9 283 'table_name' => 'civicrm_pledge_payment',
284 'entity' => 'PledgePayment',
285 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 286 'localizable' => 0,
a9d0587b 287 'add' => '2.1',
c3fc2621
CW
288 ],
289 'pledge_payment_reminder_count' => [
e501603b
TO
290 'name' => 'reminder_count',
291 'type' => CRM_Utils_Type::T_INT,
c3fc2621 292 'title' => ts('Reminders Sent'),
215b423e 293 'description' => ts('The number of payment reminders sent.'),
c3fc2621 294 'import' => TRUE,
e501603b 295 'where' => 'civicrm_pledge_payment.reminder_count',
c3fc2621 296 'export' => TRUE,
45a83e42 297 'default' => '0',
522a26c9 298 'table_name' => 'civicrm_pledge_payment',
299 'entity' => 'PledgePayment',
300 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 301 'localizable' => 0,
a9d0587b 302 'add' => '2.1',
c3fc2621
CW
303 ],
304 'pledge_payment_status_id' => [
e501603b
TO
305 'name' => 'status_id',
306 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
307 'title' => ts('Payment Status'),
308 'import' => TRUE,
e501603b 309 'where' => 'civicrm_pledge_payment.status_id',
c3fc2621 310 'export' => FALSE,
522a26c9 311 'table_name' => 'civicrm_pledge_payment',
312 'entity' => 'PledgePayment',
313 'bao' => 'CRM_Pledge_BAO_PledgePayment',
6a7e5e5d 314 'localizable' => 0,
c3fc2621 315 'pseudoconstant' => [
e501603b
TO
316 'optionGroupName' => 'contribution_status',
317 'optionEditPath' => 'civicrm/admin/options/contribution_status',
e6ca0a57 318 ],
a9d0587b 319 'add' => '2.1',
c3fc2621
CW
320 ],
321 ];
346aaaba 322 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 323 }
346aaaba 324 return Civi::$statics[__CLASS__]['fields'];
e501603b 325 }
c3fc2621 326
e501603b 327 /**
bd8e0b14 328 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
329 *
330 * @return array
bd8e0b14 331 * Array(string $name => string $uniqueName).
e501603b 332 */
c3fc2621 333 public static function &fieldKeys() {
bd8e0b14
TO
334 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
335 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 336 }
bd8e0b14 337 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 338 }
c3fc2621 339
e501603b
TO
340 /**
341 * Returns the names of this table
342 *
343 * @return string
344 */
c3fc2621 345 public static function getTableName() {
e501603b
TO
346 return self::$_tableName;
347 }
c3fc2621 348
e501603b
TO
349 /**
350 * Returns if this table needs to be logged
351 *
c3fc2621 352 * @return bool
e501603b 353 */
c3fc2621 354 public function getLog() {
e501603b
TO
355 return self::$_log;
356 }
c3fc2621 357
e501603b
TO
358 /**
359 * Returns the list of fields that can be imported
360 *
361 * @param bool $prefix
362 *
363 * @return array
364 */
c3fc2621
CW
365 public static function &import($prefix = FALSE) {
366 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_payment', $prefix, []);
60808919 367 return $r;
e501603b 368 }
c3fc2621 369
e501603b
TO
370 /**
371 * Returns the list of fields that can be exported
372 *
373 * @param bool $prefix
374 *
375 * @return array
376 */
c3fc2621
CW
377 public static function &export($prefix = FALSE) {
378 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_payment', $prefix, []);
60808919 379 return $r;
e501603b 380 }
c3fc2621 381
e7a6b91a
AS
382 /**
383 * Returns the list of indices
c3fc2621
CW
384 *
385 * @param bool $localize
386 *
387 * @return array
e7a6b91a
AS
388 */
389 public static function indices($localize = TRUE) {
c3fc2621
CW
390 $indices = [
391 'index_contribution_pledge' => [
e7a6b91a 392 'name' => 'index_contribution_pledge',
c3fc2621 393 'field' => [
e7a6b91a
AS
394 0 => 'contribution_id',
395 1 => 'pledge_id',
c3fc2621
CW
396 ],
397 'localizable' => FALSE,
e7a6b91a 398 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id',
c3fc2621
CW
399 ],
400 'index_status' => [
e7a6b91a 401 'name' => 'index_status',
c3fc2621 402 'field' => [
e7a6b91a 403 0 => 'status_id',
c3fc2621
CW
404 ],
405 'localizable' => FALSE,
e7a6b91a 406 'sig' => 'civicrm_pledge_payment::0::status_id',
c3fc2621
CW
407 ],
408 ];
e7a6b91a
AS
409 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
410 }
c3fc2621 411
e501603b 412}