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