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