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