Merge pull request #17719 from civicrm/5.27
[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
449c4e6b 9 * (GenCodeChecksum:c03f89f9fba7d8b9c3b863393e617a78)
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
449c4e6b
CW
103 /**
104 * Returns localized title of this entity.
105 */
106 public static function getEntityTitle() {
107 return ts('Contribution Softs');
108 }
109
e501603b 110 /**
f41f0342 111 * Returns foreign keys and entity references.
e501603b
TO
112 *
113 * @return array
114 * [CRM_Core_Reference_Interface]
115 */
c3fc2621 116 public static function getReferenceColumns() {
346aaaba 117 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 118 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
119 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
120 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
121 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pcp_id', 'civicrm_pcp', 'id');
346aaaba 122 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 123 }
346aaaba 124 return Civi::$statics[__CLASS__]['links'];
e501603b 125 }
c3fc2621 126
e501603b
TO
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
c3fc2621 132 public static function &fields() {
346aaaba 133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
134 Civi::$statics[__CLASS__]['fields'] = [
135 'contribution_soft_id' => [
e501603b
TO
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
c3fc2621 138 'title' => ts('Soft Contribution ID'),
215b423e 139 'description' => ts('Soft Contribution ID'),
c3fc2621
CW
140 'required' => TRUE,
141 'import' => TRUE,
e501603b 142 'where' => 'civicrm_contribution_soft.id',
c3fc2621 143 'export' => TRUE,
522a26c9 144 'table_name' => 'civicrm_contribution_soft',
145 'entity' => 'ContributionSoft',
146 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 147 'localizable' => 0,
c3fc2621
CW
148 ],
149 'contribution_id' => [
e501603b
TO
150 'name' => 'contribution_id',
151 'type' => CRM_Utils_Type::T_INT,
c3fc2621 152 'title' => ts('Soft Contribution - Contribution'),
215b423e 153 'description' => ts('FK to contribution table.'),
c3fc2621 154 'required' => TRUE,
a36434b9 155 'where' => 'civicrm_contribution_soft.contribution_id',
522a26c9 156 'table_name' => 'civicrm_contribution_soft',
157 'entity' => 'ContributionSoft',
158 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 159 'localizable' => 0,
e501603b 160 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
c3fc2621
CW
161 ],
162 'contribution_soft_contact_id' => [
e501603b
TO
163 'name' => 'contact_id',
164 'type' => CRM_Utils_Type::T_INT,
c3fc2621 165 'title' => ts('Contact ID'),
215b423e 166 'description' => ts('FK to Contact ID'),
c3fc2621
CW
167 'required' => TRUE,
168 'import' => TRUE,
e501603b
TO
169 'where' => 'civicrm_contribution_soft.contact_id',
170 'headerPattern' => '/contact(.?id)?/i',
171 'dataPattern' => '/^\d+$/',
c3fc2621 172 'export' => TRUE,
522a26c9 173 'table_name' => 'civicrm_contribution_soft',
174 'entity' => 'ContributionSoft',
175 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 176 'localizable' => 0,
e501603b 177 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
178 ],
179 'amount' => [
e501603b
TO
180 'name' => 'amount',
181 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 182 'title' => ts('Soft Contribution Amount'),
215b423e 183 'description' => ts('Amount of this soft contribution.'),
c3fc2621
CW
184 'required' => TRUE,
185 'precision' => [
e501603b 186 20,
fb607354 187 2,
c3fc2621
CW
188 ],
189 'import' => TRUE,
e501603b
TO
190 'where' => 'civicrm_contribution_soft.amount',
191 'headerPattern' => '/total(.?am(ou)?nt)?/i',
192 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 193 'export' => TRUE,
522a26c9 194 'table_name' => 'civicrm_contribution_soft',
195 'entity' => 'ContributionSoft',
196 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 197 'localizable' => 0,
c3fc2621
CW
198 ],
199 'currency' => [
e501603b
TO
200 'name' => 'currency',
201 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 202 'title' => ts('Soft Contribution Currency'),
215b423e 203 'description' => ts('3 character string, value from config setting or input via user.'),
e501603b
TO
204 'maxlength' => 3,
205 'size' => CRM_Utils_Type::FOUR,
a36434b9 206 'where' => 'civicrm_contribution_soft.currency',
e501603b 207 'default' => 'NULL',
522a26c9 208 'table_name' => 'civicrm_contribution_soft',
209 'entity' => 'ContributionSoft',
210 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 211 'localizable' => 0,
c3fc2621 212 'html' => [
e501603b 213 'type' => 'Select',
c3fc2621
CW
214 ],
215 'pseudoconstant' => [
e501603b
TO
216 'table' => 'civicrm_currency',
217 'keyColumn' => 'name',
218 'labelColumn' => 'full_name',
219 'nameColumn' => 'name',
a8fdb24e 220 'abbrColumn' => 'symbol',
e6ca0a57 221 ],
c3fc2621
CW
222 ],
223 'pcp_id' => [
e501603b
TO
224 'name' => 'pcp_id',
225 'type' => CRM_Utils_Type::T_INT,
c3fc2621 226 'title' => ts('Soft Contribution PCP'),
215b423e 227 'description' => ts('FK to civicrm_pcp.id'),
a36434b9 228 'where' => 'civicrm_contribution_soft.pcp_id',
e501603b 229 'default' => 'NULL',
522a26c9 230 'table_name' => 'civicrm_contribution_soft',
231 'entity' => 'ContributionSoft',
232 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 233 'localizable' => 0,
e501603b 234 'FKClassName' => 'CRM_PCP_DAO_PCP',
c3fc2621 235 'pseudoconstant' => [
e501603b
TO
236 'table' => 'civicrm_pcp',
237 'keyColumn' => 'id',
238 'labelColumn' => 'title',
e6ca0a57 239 ],
c3fc2621
CW
240 ],
241 'pcp_display_in_roll' => [
e501603b
TO
242 'name' => 'pcp_display_in_roll',
243 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 244 'title' => ts('Soft Contribution Display on PCP'),
a36434b9 245 'where' => 'civicrm_contribution_soft.pcp_display_in_roll',
45a83e42 246 'default' => '0',
522a26c9 247 'table_name' => 'civicrm_contribution_soft',
248 'entity' => 'ContributionSoft',
249 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 250 'localizable' => 0,
c3fc2621
CW
251 ],
252 'pcp_roll_nickname' => [
e501603b
TO
253 'name' => 'pcp_roll_nickname',
254 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 255 'title' => ts('Soft Contribution PCP Nickname'),
e501603b
TO
256 'maxlength' => 255,
257 'size' => CRM_Utils_Type::HUGE,
a36434b9 258 'where' => 'civicrm_contribution_soft.pcp_roll_nickname',
e501603b 259 'default' => 'NULL',
522a26c9 260 'table_name' => 'civicrm_contribution_soft',
261 'entity' => 'ContributionSoft',
262 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 263 'localizable' => 0,
c3fc2621
CW
264 ],
265 'pcp_personal_note' => [
e501603b
TO
266 'name' => 'pcp_personal_note',
267 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 268 'title' => ts('Soft Contribution PCP Note'),
e501603b
TO
269 'maxlength' => 255,
270 'size' => CRM_Utils_Type::HUGE,
a36434b9 271 'where' => 'civicrm_contribution_soft.pcp_personal_note',
e501603b 272 'default' => 'NULL',
522a26c9 273 'table_name' => 'civicrm_contribution_soft',
274 'entity' => 'ContributionSoft',
275 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 276 'localizable' => 0,
bddddc63 277 'html' => [
278 'type' => 'TextArea',
279 ],
c3fc2621
CW
280 ],
281 'soft_credit_type_id' => [
e501603b
TO
282 'name' => 'soft_credit_type_id',
283 'type' => CRM_Utils_Type::T_INT,
c3fc2621 284 'title' => ts('Soft Credit Type'),
215b423e 285 'description' => ts('Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.'),
a36434b9 286 'where' => 'civicrm_contribution_soft.soft_credit_type_id',
e501603b 287 'default' => 'NULL',
522a26c9 288 'table_name' => 'civicrm_contribution_soft',
289 'entity' => 'ContributionSoft',
290 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
6a7e5e5d 291 'localizable' => 0,
c3fc2621 292 'pseudoconstant' => [
e501603b
TO
293 'optionGroupName' => 'soft_credit_type',
294 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
e6ca0a57 295 ],
c3fc2621
CW
296 ],
297 ];
346aaaba 298 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 299 }
346aaaba 300 return Civi::$statics[__CLASS__]['fields'];
e501603b 301 }
c3fc2621 302
e501603b 303 /**
bd8e0b14 304 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
305 *
306 * @return array
bd8e0b14 307 * Array(string $name => string $uniqueName).
e501603b 308 */
c3fc2621 309 public static function &fieldKeys() {
bd8e0b14
TO
310 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
311 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 312 }
bd8e0b14 313 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 314 }
c3fc2621 315
e501603b
TO
316 /**
317 * Returns the names of this table
318 *
319 * @return string
320 */
c3fc2621 321 public static function getTableName() {
e501603b
TO
322 return self::$_tableName;
323 }
c3fc2621 324
e501603b
TO
325 /**
326 * Returns if this table needs to be logged
327 *
c3fc2621 328 * @return bool
e501603b 329 */
c3fc2621 330 public function getLog() {
e501603b
TO
331 return self::$_log;
332 }
c3fc2621 333
e501603b
TO
334 /**
335 * Returns the list of fields that can be imported
336 *
337 * @param bool $prefix
338 *
339 * @return array
340 */
c3fc2621
CW
341 public static function &import($prefix = FALSE) {
342 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, []);
60808919 343 return $r;
e501603b 344 }
c3fc2621 345
e501603b
TO
346 /**
347 * Returns the list of fields that can be exported
348 *
349 * @param bool $prefix
350 *
351 * @return array
352 */
c3fc2621
CW
353 public static function &export($prefix = FALSE) {
354 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, []);
60808919 355 return $r;
e501603b 356 }
c3fc2621 357
e7a6b91a
AS
358 /**
359 * Returns the list of indices
c3fc2621
CW
360 *
361 * @param bool $localize
362 *
363 * @return array
e7a6b91a
AS
364 */
365 public static function indices($localize = TRUE) {
c3fc2621
CW
366 $indices = [
367 'index_id' => [
e7a6b91a 368 'name' => 'index_id',
c3fc2621 369 'field' => [
e7a6b91a 370 0 => 'pcp_id',
c3fc2621
CW
371 ],
372 'localizable' => FALSE,
e7a6b91a 373 'sig' => 'civicrm_contribution_soft::0::pcp_id',
c3fc2621
CW
374 ],
375 ];
e7a6b91a
AS
376 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
377 }
c3fc2621 378
e501603b 379}