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