Merge pull request #19308 from eileenmcnaughton/ev
[civicrm-core.git] / CRM / Financial / DAO / FinancialType.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Financial/FinancialType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ddbf4faec2a77ef3fa7b9d126c9d0443)
10 */
11
12 /**
13 * Database access object for the FinancialType entity.
14 */
15 class CRM_Financial_DAO_FinancialType extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.3';
18 const COMPONENT = 'CiviContribute';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_financial_type';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = TRUE;
33
34 /**
35 * ID of original financial_type so you can search this table by the financial_type.id and then select the relevant version based on the timestamp
36 *
37 * @var int
38 */
39 public $id;
40
41 /**
42 * Financial Type Name.
43 *
44 * @var string
45 */
46 public $name;
47
48 /**
49 * Financial Type Description.
50 *
51 * @var string
52 */
53 public $description;
54
55 /**
56 * Is this financial type tax-deductible? If true, contributions of this type may be fully OR partially deductible - non-deductible amount is stored in the Contribution record.
57 *
58 * @var bool
59 */
60 public $is_deductible;
61
62 /**
63 * Is this a predefined system object?
64 *
65 * @var bool
66 */
67 public $is_reserved;
68
69 /**
70 * Is this property active?
71 *
72 * @var bool
73 */
74 public $is_active;
75
76 /**
77 * Class constructor.
78 */
79 public function __construct() {
80 $this->__table = 'civicrm_financial_type';
81 parent::__construct();
82 }
83
84 /**
85 * Returns localized title of this entity.
86 *
87 * @param bool $plural
88 * Whether to return the plural version of the title.
89 */
90 public static function getEntityTitle($plural = FALSE) {
91 return $plural ? ts('Financial Types') : ts('Financial Type');
92 }
93
94 /**
95 * Returns all the column names of this table
96 *
97 * @return array
98 */
99 public static function &fields() {
100 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
101 Civi::$statics[__CLASS__]['fields'] = [
102 'id' => [
103 'name' => 'id',
104 'type' => CRM_Utils_Type::T_INT,
105 'title' => ts('Financial Type ID'),
106 'description' => ts('ID of original financial_type so you can search this table by the financial_type.id and then select the relevant version based on the timestamp'),
107 'required' => TRUE,
108 'where' => 'civicrm_financial_type.id',
109 'table_name' => 'civicrm_financial_type',
110 'entity' => 'FinancialType',
111 'bao' => 'CRM_Financial_BAO_FinancialType',
112 'localizable' => 0,
113 'add' => '1.3',
114 ],
115 'financial_type' => [
116 'name' => 'name',
117 'type' => CRM_Utils_Type::T_STRING,
118 'title' => ts('Financial Type'),
119 'description' => ts('Financial Type Name.'),
120 'required' => TRUE,
121 'maxlength' => 64,
122 'size' => CRM_Utils_Type::BIG,
123 'import' => TRUE,
124 'where' => 'civicrm_financial_type.name',
125 'headerPattern' => '/(finan(cial)?)?type/i',
126 'dataPattern' => '/donation|member|campaign/i',
127 'export' => TRUE,
128 'table_name' => 'civicrm_financial_type',
129 'entity' => 'FinancialType',
130 'bao' => 'CRM_Financial_BAO_FinancialType',
131 'localizable' => 0,
132 'html' => [
133 'type' => 'Text',
134 'label' => ts("Name"),
135 ],
136 'add' => '1.3',
137 ],
138 'description' => [
139 'name' => 'description',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Description'),
142 'description' => ts('Financial Type Description.'),
143 'maxlength' => 255,
144 'size' => CRM_Utils_Type::HUGE,
145 'where' => 'civicrm_financial_type.description',
146 'table_name' => 'civicrm_financial_type',
147 'entity' => 'FinancialType',
148 'bao' => 'CRM_Financial_BAO_FinancialType',
149 'localizable' => 0,
150 'html' => [
151 'type' => 'TextArea',
152 'label' => ts("Description"),
153 ],
154 'add' => '1.3',
155 ],
156 'is_deductible' => [
157 'name' => 'is_deductible',
158 'type' => CRM_Utils_Type::T_BOOLEAN,
159 'title' => ts('Is Tax Deductible?'),
160 'description' => ts('Is this financial type tax-deductible? If true, contributions of this type may be fully OR partially deductible - non-deductible amount is stored in the Contribution record.'),
161 'required' => TRUE,
162 'where' => 'civicrm_financial_type.is_deductible',
163 'default' => '0',
164 'table_name' => 'civicrm_financial_type',
165 'entity' => 'FinancialType',
166 'bao' => 'CRM_Financial_BAO_FinancialType',
167 'localizable' => 0,
168 'html' => [
169 'type' => 'CheckBox',
170 'label' => ts("Tax-Deductible?"),
171 ],
172 'add' => '1.3',
173 ],
174 'is_reserved' => [
175 'name' => 'is_reserved',
176 'type' => CRM_Utils_Type::T_BOOLEAN,
177 'title' => ts('Financial Type is Reserved?'),
178 'description' => ts('Is this a predefined system object?'),
179 'required' => TRUE,
180 'where' => 'civicrm_financial_type.is_reserved',
181 'default' => '0',
182 'table_name' => 'civicrm_financial_type',
183 'entity' => 'FinancialType',
184 'bao' => 'CRM_Financial_BAO_FinancialType',
185 'localizable' => 0,
186 'html' => [
187 'type' => 'CheckBox',
188 'label' => ts("Reserved?"),
189 ],
190 'add' => '1.3',
191 ],
192 'is_active' => [
193 'name' => 'is_active',
194 'type' => CRM_Utils_Type::T_BOOLEAN,
195 'title' => ts('Financial Type Is Active?'),
196 'description' => ts('Is this property active?'),
197 'required' => TRUE,
198 'where' => 'civicrm_financial_type.is_active',
199 'default' => '1',
200 'table_name' => 'civicrm_financial_type',
201 'entity' => 'FinancialType',
202 'bao' => 'CRM_Financial_BAO_FinancialType',
203 'localizable' => 0,
204 'html' => [
205 'type' => 'CheckBox',
206 'label' => ts("Enabled?"),
207 ],
208 'add' => '1.3',
209 ],
210 ];
211 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
212 }
213 return Civi::$statics[__CLASS__]['fields'];
214 }
215
216 /**
217 * Return a mapping from field-name to the corresponding key (as used in fields()).
218 *
219 * @return array
220 * Array(string $name => string $uniqueName).
221 */
222 public static function &fieldKeys() {
223 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
224 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
225 }
226 return Civi::$statics[__CLASS__]['fieldKeys'];
227 }
228
229 /**
230 * Returns the names of this table
231 *
232 * @return string
233 */
234 public static function getTableName() {
235 return self::$_tableName;
236 }
237
238 /**
239 * Returns if this table needs to be logged
240 *
241 * @return bool
242 */
243 public function getLog() {
244 return self::$_log;
245 }
246
247 /**
248 * Returns the list of fields that can be imported
249 *
250 * @param bool $prefix
251 *
252 * @return array
253 */
254 public static function &import($prefix = FALSE) {
255 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_type', $prefix, []);
256 return $r;
257 }
258
259 /**
260 * Returns the list of fields that can be exported
261 *
262 * @param bool $prefix
263 *
264 * @return array
265 */
266 public static function &export($prefix = FALSE) {
267 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_type', $prefix, []);
268 return $r;
269 }
270
271 /**
272 * Returns the list of indices
273 *
274 * @param bool $localize
275 *
276 * @return array
277 */
278 public static function indices($localize = TRUE) {
279 $indices = [
280 'UI_id' => [
281 'name' => 'UI_id',
282 'field' => [
283 0 => 'id',
284 ],
285 'localizable' => FALSE,
286 'unique' => TRUE,
287 'sig' => 'civicrm_financial_type::1::id',
288 ],
289 ];
290 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
291 }
292
293 }