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