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