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