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