Merge pull request #9632 from yashodha/CRM-19795
[civicrm-core.git] / CRM / Contribute / DAO / ContributionSoft.php
CommitLineData
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
437fafcf 33 * (GenCodeChecksum:ea8abcdf53630758c538439bb186c717)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_contribution_soft';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = true;
51 /**
52 * Soft Contribution ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * FK to contribution table.
59 *
60 * @var int unsigned
61 */
62 public $contribution_id;
63 /**
64 * FK to Contact ID
65 *
66 * @var int unsigned
67 */
68 public $contact_id;
69 /**
70 * Amount of this soft contribution.
71 *
72 * @var float
73 */
74 public $amount;
75 /**
76 * 3 character string, value from config setting or input via user.
77 *
78 * @var string
79 */
80 public $currency;
81 /**
82 * FK to civicrm_pcp.id
83 *
84 * @var int unsigned
85 */
86 public $pcp_id;
87 /**
88 *
89 * @var boolean
90 */
91 public $pcp_display_in_roll;
92 /**
93 *
94 * @var string
95 */
96 public $pcp_roll_nickname;
97 /**
98 *
99 * @var string
100 */
101 public $pcp_personal_note;
102 /**
103 * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.
104 *
105 * @var int unsigned
106 */
107 public $soft_credit_type_id;
108 /**
109 * class constructor
110 *
111 * @return civicrm_contribution_soft
112 */
113 function __construct() {
114 $this->__table = 'civicrm_contribution_soft';
115 parent::__construct();
116 }
117 /**
118 * Returns foreign keys and entity references
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,
152 ) ,
153 'contribution_id' => array(
154 'name' => 'contribution_id',
155 'type' => CRM_Utils_Type::T_INT,
156 'title' => ts('Soft Contribution - Contribution') ,
157 'description' => 'FK to contribution table.',
158 'required' => true,
159 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
160 ) ,
161 'contribution_soft_contact_id' => array(
162 'name' => 'contact_id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Contact ID') ,
165 'description' => 'FK to Contact ID',
166 'required' => true,
167 'import' => true,
168 'where' => 'civicrm_contribution_soft.contact_id',
169 'headerPattern' => '/contact(.?id)?/i',
170 'dataPattern' => '/^\d+$/',
171 'export' => true,
172 'FKClassName' => 'CRM_Contact_DAO_Contact',
173 ) ,
174 'amount' => array(
175 'name' => 'amount',
176 'type' => CRM_Utils_Type::T_MONEY,
177 'title' => ts('Soft Contribution Amount') ,
178 'description' => 'Amount of this soft contribution.',
179 'required' => true,
180 'precision' => array(
181 20,
182 2
183 ) ,
184 'import' => true,
185 'where' => 'civicrm_contribution_soft.amount',
186 'headerPattern' => '/total(.?am(ou)?nt)?/i',
187 'dataPattern' => '/^\d+(\.\d{2})?$/',
188 'export' => true,
189 ) ,
190 'currency' => array(
191 'name' => 'currency',
192 'type' => CRM_Utils_Type::T_STRING,
193 'title' => ts('Soft Contribution Currency') ,
194 'description' => '3 character string, value from config setting or input via user.',
195 'maxlength' => 3,
196 'size' => CRM_Utils_Type::FOUR,
197 'default' => 'NULL',
198 'html' => array(
199 'type' => 'Select',
200 ) ,
201 'pseudoconstant' => array(
202 'table' => 'civicrm_currency',
203 'keyColumn' => 'name',
204 'labelColumn' => 'full_name',
205 'nameColumn' => 'name',
206 )
207 ) ,
208 'pcp_id' => array(
209 'name' => 'pcp_id',
210 'type' => CRM_Utils_Type::T_INT,
211 'title' => ts('Soft Contribution PCP') ,
212 'description' => 'FK to civicrm_pcp.id',
213 'default' => 'NULL',
214 'FKClassName' => 'CRM_PCP_DAO_PCP',
215 'pseudoconstant' => array(
216 'table' => 'civicrm_pcp',
217 'keyColumn' => 'id',
218 'labelColumn' => 'title',
219 )
220 ) ,
221 'pcp_display_in_roll' => array(
222 'name' => 'pcp_display_in_roll',
223 'type' => CRM_Utils_Type::T_BOOLEAN,
224 'title' => ts('Soft Contribution Display on PCP') ,
225 ) ,
226 'pcp_roll_nickname' => array(
227 'name' => 'pcp_roll_nickname',
228 'type' => CRM_Utils_Type::T_STRING,
229 'title' => ts('Soft Contribution PCP Nickname') ,
230 'maxlength' => 255,
231 'size' => CRM_Utils_Type::HUGE,
232 'default' => 'NULL',
233 ) ,
234 'pcp_personal_note' => array(
235 'name' => 'pcp_personal_note',
236 'type' => CRM_Utils_Type::T_STRING,
237 'title' => ts('Soft Contribution PCP Note') ,
238 'maxlength' => 255,
239 'size' => CRM_Utils_Type::HUGE,
240 'default' => 'NULL',
241 ) ,
242 'soft_credit_type_id' => array(
243 'name' => 'soft_credit_type_id',
244 'type' => CRM_Utils_Type::T_INT,
245 'title' => ts('Soft Credit Type') ,
246 'description' => 'Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.',
247 'default' => 'NULL',
248 'pseudoconstant' => array(
249 'optionGroupName' => 'soft_credit_type',
250 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
251 )
252 ) ,
253 );
346aaaba 254 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 255 }
346aaaba 256 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
257 }
258 /**
bd8e0b14 259 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
260 *
261 * @return array
bd8e0b14 262 * Array(string $name => string $uniqueName).
e501603b
TO
263 */
264 static function &fieldKeys() {
bd8e0b14
TO
265 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
266 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 267 }
bd8e0b14 268 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
269 }
270 /**
271 * Returns the names of this table
272 *
273 * @return string
274 */
275 static function getTableName() {
276 return self::$_tableName;
277 }
278 /**
279 * Returns if this table needs to be logged
280 *
281 * @return boolean
282 */
283 function getLog() {
284 return self::$_log;
285 }
286 /**
287 * Returns the list of fields that can be imported
288 *
289 * @param bool $prefix
290 *
291 * @return array
292 */
293 static function &import($prefix = false) {
60808919
TO
294 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, array());
295 return $r;
e501603b
TO
296 }
297 /**
298 * Returns the list of fields that can be exported
299 *
300 * @param bool $prefix
301 *
302 * @return array
303 */
304 static function &export($prefix = false) {
60808919
TO
305 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, array());
306 return $r;
e501603b
TO
307 }
308}