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