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