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