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