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