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