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