| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Contribute/ContributionSoft.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:4b5e273fabfbab2591c227fed3d0214a) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the ContributionSoft entity. |
| 14 | */ |
| 15 | class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO { |
| 16 | |
| 17 | /** |
| 18 | * Static instance to hold the table name. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | public static $_tableName = 'civicrm_contribution_soft'; |
| 23 | |
| 24 | /** |
| 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | public static $_log = TRUE; |
| 30 | |
| 31 | /** |
| 32 | * Soft Contribution ID |
| 33 | * |
| 34 | * @var int |
| 35 | */ |
| 36 | public $id; |
| 37 | |
| 38 | /** |
| 39 | * FK to contribution table. |
| 40 | * |
| 41 | * @var int |
| 42 | */ |
| 43 | public $contribution_id; |
| 44 | |
| 45 | /** |
| 46 | * FK to Contact ID |
| 47 | * |
| 48 | * @var int |
| 49 | */ |
| 50 | public $contact_id; |
| 51 | |
| 52 | /** |
| 53 | * Amount of this soft contribution. |
| 54 | * |
| 55 | * @var float |
| 56 | */ |
| 57 | public $amount; |
| 58 | |
| 59 | /** |
| 60 | * 3 character string, value from config setting or input via user. |
| 61 | * |
| 62 | * @var string |
| 63 | */ |
| 64 | public $currency; |
| 65 | |
| 66 | /** |
| 67 | * FK to civicrm_pcp.id |
| 68 | * |
| 69 | * @var int |
| 70 | */ |
| 71 | public $pcp_id; |
| 72 | |
| 73 | /** |
| 74 | * @var bool |
| 75 | */ |
| 76 | public $pcp_display_in_roll; |
| 77 | |
| 78 | /** |
| 79 | * @var string |
| 80 | */ |
| 81 | public $pcp_roll_nickname; |
| 82 | |
| 83 | /** |
| 84 | * @var string |
| 85 | */ |
| 86 | public $pcp_personal_note; |
| 87 | |
| 88 | /** |
| 89 | * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type. |
| 90 | * |
| 91 | * @var int |
| 92 | */ |
| 93 | public $soft_credit_type_id; |
| 94 | |
| 95 | /** |
| 96 | * Class constructor. |
| 97 | */ |
| 98 | public function __construct() { |
| 99 | $this->__table = 'civicrm_contribution_soft'; |
| 100 | parent::__construct(); |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Returns foreign keys and entity references. |
| 105 | * |
| 106 | * @return array |
| 107 | * [CRM_Core_Reference_Interface] |
| 108 | */ |
| 109 | public static function getReferenceColumns() { |
| 110 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
| 111 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
| 112 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); |
| 113 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
| 114 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pcp_id', 'civicrm_pcp', 'id'); |
| 115 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
| 116 | } |
| 117 | return Civi::$statics[__CLASS__]['links']; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Returns all the column names of this table |
| 122 | * |
| 123 | * @return array |
| 124 | */ |
| 125 | public static function &fields() { |
| 126 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 127 | Civi::$statics[__CLASS__]['fields'] = [ |
| 128 | 'contribution_soft_id' => [ |
| 129 | 'name' => 'id', |
| 130 | 'type' => CRM_Utils_Type::T_INT, |
| 131 | 'title' => ts('Soft Contribution ID'), |
| 132 | 'description' => ts('Soft Contribution ID'), |
| 133 | 'required' => TRUE, |
| 134 | 'import' => TRUE, |
| 135 | 'where' => 'civicrm_contribution_soft.id', |
| 136 | 'export' => TRUE, |
| 137 | 'table_name' => 'civicrm_contribution_soft', |
| 138 | 'entity' => 'ContributionSoft', |
| 139 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 140 | 'localizable' => 0, |
| 141 | ], |
| 142 | 'contribution_id' => [ |
| 143 | 'name' => 'contribution_id', |
| 144 | 'type' => CRM_Utils_Type::T_INT, |
| 145 | 'title' => ts('Soft Contribution - Contribution'), |
| 146 | 'description' => ts('FK to contribution table.'), |
| 147 | 'required' => TRUE, |
| 148 | 'where' => 'civicrm_contribution_soft.contribution_id', |
| 149 | 'table_name' => 'civicrm_contribution_soft', |
| 150 | 'entity' => 'ContributionSoft', |
| 151 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 152 | 'localizable' => 0, |
| 153 | 'FKClassName' => 'CRM_Contribute_DAO_Contribution', |
| 154 | ], |
| 155 | 'contribution_soft_contact_id' => [ |
| 156 | 'name' => 'contact_id', |
| 157 | 'type' => CRM_Utils_Type::T_INT, |
| 158 | 'title' => ts('Contact ID'), |
| 159 | 'description' => ts('FK to Contact ID'), |
| 160 | 'required' => TRUE, |
| 161 | 'import' => TRUE, |
| 162 | 'where' => 'civicrm_contribution_soft.contact_id', |
| 163 | 'headerPattern' => '/contact(.?id)?/i', |
| 164 | 'dataPattern' => '/^\d+$/', |
| 165 | 'export' => TRUE, |
| 166 | 'table_name' => 'civicrm_contribution_soft', |
| 167 | 'entity' => 'ContributionSoft', |
| 168 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 169 | 'localizable' => 0, |
| 170 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
| 171 | ], |
| 172 | 'amount' => [ |
| 173 | 'name' => 'amount', |
| 174 | 'type' => CRM_Utils_Type::T_MONEY, |
| 175 | 'title' => ts('Soft Contribution Amount'), |
| 176 | 'description' => ts('Amount of this soft contribution.'), |
| 177 | 'required' => TRUE, |
| 178 | 'precision' => [ |
| 179 | 20, |
| 180 | 2, |
| 181 | ], |
| 182 | 'import' => TRUE, |
| 183 | 'where' => 'civicrm_contribution_soft.amount', |
| 184 | 'headerPattern' => '/total(.?am(ou)?nt)?/i', |
| 185 | 'dataPattern' => '/^\d+(\.\d{2})?$/', |
| 186 | 'export' => TRUE, |
| 187 | 'table_name' => 'civicrm_contribution_soft', |
| 188 | 'entity' => 'ContributionSoft', |
| 189 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 190 | 'localizable' => 0, |
| 191 | ], |
| 192 | 'currency' => [ |
| 193 | 'name' => 'currency', |
| 194 | 'type' => CRM_Utils_Type::T_STRING, |
| 195 | 'title' => ts('Soft Contribution Currency'), |
| 196 | 'description' => ts('3 character string, value from config setting or input via user.'), |
| 197 | 'maxlength' => 3, |
| 198 | 'size' => CRM_Utils_Type::FOUR, |
| 199 | 'where' => 'civicrm_contribution_soft.currency', |
| 200 | 'default' => 'NULL', |
| 201 | 'table_name' => 'civicrm_contribution_soft', |
| 202 | 'entity' => 'ContributionSoft', |
| 203 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 204 | 'localizable' => 0, |
| 205 | 'html' => [ |
| 206 | 'type' => 'Select', |
| 207 | ], |
| 208 | 'pseudoconstant' => [ |
| 209 | 'table' => 'civicrm_currency', |
| 210 | 'keyColumn' => 'name', |
| 211 | 'labelColumn' => 'full_name', |
| 212 | 'nameColumn' => 'name', |
| 213 | 'abbrColumn' => 'symbol', |
| 214 | ], |
| 215 | ], |
| 216 | 'pcp_id' => [ |
| 217 | 'name' => 'pcp_id', |
| 218 | 'type' => CRM_Utils_Type::T_INT, |
| 219 | 'title' => ts('Soft Contribution PCP'), |
| 220 | 'description' => ts('FK to civicrm_pcp.id'), |
| 221 | 'where' => 'civicrm_contribution_soft.pcp_id', |
| 222 | 'default' => 'NULL', |
| 223 | 'table_name' => 'civicrm_contribution_soft', |
| 224 | 'entity' => 'ContributionSoft', |
| 225 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 226 | 'localizable' => 0, |
| 227 | 'FKClassName' => 'CRM_PCP_DAO_PCP', |
| 228 | 'pseudoconstant' => [ |
| 229 | 'table' => 'civicrm_pcp', |
| 230 | 'keyColumn' => 'id', |
| 231 | 'labelColumn' => 'title', |
| 232 | ], |
| 233 | ], |
| 234 | 'pcp_display_in_roll' => [ |
| 235 | 'name' => 'pcp_display_in_roll', |
| 236 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 237 | 'title' => ts('Soft Contribution Display on PCP'), |
| 238 | 'where' => 'civicrm_contribution_soft.pcp_display_in_roll', |
| 239 | 'default' => '0', |
| 240 | 'table_name' => 'civicrm_contribution_soft', |
| 241 | 'entity' => 'ContributionSoft', |
| 242 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 243 | 'localizable' => 0, |
| 244 | ], |
| 245 | 'pcp_roll_nickname' => [ |
| 246 | 'name' => 'pcp_roll_nickname', |
| 247 | 'type' => CRM_Utils_Type::T_STRING, |
| 248 | 'title' => ts('Soft Contribution PCP Nickname'), |
| 249 | 'maxlength' => 255, |
| 250 | 'size' => CRM_Utils_Type::HUGE, |
| 251 | 'where' => 'civicrm_contribution_soft.pcp_roll_nickname', |
| 252 | 'default' => 'NULL', |
| 253 | 'table_name' => 'civicrm_contribution_soft', |
| 254 | 'entity' => 'ContributionSoft', |
| 255 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 256 | 'localizable' => 0, |
| 257 | ], |
| 258 | 'pcp_personal_note' => [ |
| 259 | 'name' => 'pcp_personal_note', |
| 260 | 'type' => CRM_Utils_Type::T_STRING, |
| 261 | 'title' => ts('Soft Contribution PCP Note'), |
| 262 | 'maxlength' => 255, |
| 263 | 'size' => CRM_Utils_Type::HUGE, |
| 264 | 'where' => 'civicrm_contribution_soft.pcp_personal_note', |
| 265 | 'default' => 'NULL', |
| 266 | 'table_name' => 'civicrm_contribution_soft', |
| 267 | 'entity' => 'ContributionSoft', |
| 268 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 269 | 'localizable' => 0, |
| 270 | 'html' => [ |
| 271 | 'type' => 'TextArea', |
| 272 | ], |
| 273 | ], |
| 274 | 'soft_credit_type_id' => [ |
| 275 | 'name' => 'soft_credit_type_id', |
| 276 | 'type' => CRM_Utils_Type::T_INT, |
| 277 | 'title' => ts('Soft Credit Type'), |
| 278 | 'description' => ts('Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.'), |
| 279 | 'where' => 'civicrm_contribution_soft.soft_credit_type_id', |
| 280 | 'default' => 'NULL', |
| 281 | 'table_name' => 'civicrm_contribution_soft', |
| 282 | 'entity' => 'ContributionSoft', |
| 283 | 'bao' => 'CRM_Contribute_BAO_ContributionSoft', |
| 284 | 'localizable' => 0, |
| 285 | 'pseudoconstant' => [ |
| 286 | 'optionGroupName' => 'soft_credit_type', |
| 287 | 'optionEditPath' => 'civicrm/admin/options/soft_credit_type', |
| 288 | ], |
| 289 | ], |
| 290 | ]; |
| 291 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 292 | } |
| 293 | return Civi::$statics[__CLASS__]['fields']; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 298 | * |
| 299 | * @return array |
| 300 | * Array(string $name => string $uniqueName). |
| 301 | */ |
| 302 | public static function &fieldKeys() { |
| 303 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 304 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 305 | } |
| 306 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * Returns the names of this table |
| 311 | * |
| 312 | * @return string |
| 313 | */ |
| 314 | public static function getTableName() { |
| 315 | return self::$_tableName; |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * Returns if this table needs to be logged |
| 320 | * |
| 321 | * @return bool |
| 322 | */ |
| 323 | public function getLog() { |
| 324 | return self::$_log; |
| 325 | } |
| 326 | |
| 327 | /** |
| 328 | * Returns the list of fields that can be imported |
| 329 | * |
| 330 | * @param bool $prefix |
| 331 | * |
| 332 | * @return array |
| 333 | */ |
| 334 | public static function &import($prefix = FALSE) { |
| 335 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, []); |
| 336 | return $r; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * Returns the list of fields that can be exported |
| 341 | * |
| 342 | * @param bool $prefix |
| 343 | * |
| 344 | * @return array |
| 345 | */ |
| 346 | public static function &export($prefix = FALSE) { |
| 347 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, []); |
| 348 | return $r; |
| 349 | } |
| 350 | |
| 351 | /** |
| 352 | * Returns the list of indices |
| 353 | * |
| 354 | * @param bool $localize |
| 355 | * |
| 356 | * @return array |
| 357 | */ |
| 358 | public static function indices($localize = TRUE) { |
| 359 | $indices = [ |
| 360 | 'index_id' => [ |
| 361 | 'name' => 'index_id', |
| 362 | 'field' => [ |
| 363 | 0 => 'pcp_id', |
| 364 | ], |
| 365 | 'localizable' => FALSE, |
| 366 | 'sig' => 'civicrm_contribution_soft::0::pcp_id', |
| 367 | ], |
| 368 | ]; |
| 369 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 370 | } |
| 371 | |
| 372 | } |