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