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