Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Financial/FinancialType.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
042043f1 | 9 | * (GenCodeChecksum:fa0f85a79c4128a5eb67a364b1f78b0e) |
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 | * | |
34 | * @var int unsigned | |
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 | * | |
55 | * @var boolean | |
56 | */ | |
57 | public $is_deductible; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Is this a predefined system object? | |
61 | * | |
62 | * @var boolean | |
63 | */ | |
64 | public $is_reserved; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Is this property active? | |
68 | * | |
69 | * @var boolean | |
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 | |
e501603b TO |
81 | /** |
82 | * Returns all the column names of this table | |
83 | * | |
84 | * @return array | |
85 | */ | |
c3fc2621 | 86 | public static function &fields() { |
346aaaba | 87 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
88 | Civi::$statics[__CLASS__]['fields'] = [ |
89 | 'id' => [ | |
e501603b TO |
90 | 'name' => 'id', |
91 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 92 | 'title' => ts('Financial Type ID'), |
215b423e | 93 | '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 | 94 | 'required' => TRUE, |
a36434b9 | 95 | 'where' => 'civicrm_financial_type.id', |
522a26c9 | 96 | 'table_name' => 'civicrm_financial_type', |
97 | 'entity' => 'FinancialType', | |
98 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 99 | 'localizable' => 0, |
c3fc2621 CW |
100 | ], |
101 | 'financial_type' => [ | |
e501603b TO |
102 | 'name' => 'name', |
103 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 104 | 'title' => ts('Financial Type'), |
215b423e | 105 | 'description' => ts('Financial Type Name.'), |
c3fc2621 | 106 | 'required' => TRUE, |
e501603b TO |
107 | 'maxlength' => 64, |
108 | 'size' => CRM_Utils_Type::BIG, | |
c3fc2621 | 109 | 'import' => TRUE, |
e501603b TO |
110 | 'where' => 'civicrm_financial_type.name', |
111 | 'headerPattern' => '/(finan(cial)?)?type/i', | |
112 | 'dataPattern' => '/donation|member|campaign/i', | |
c3fc2621 | 113 | 'export' => TRUE, |
522a26c9 | 114 | 'table_name' => 'civicrm_financial_type', |
115 | 'entity' => 'FinancialType', | |
116 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 117 | 'localizable' => 0, |
251808cb PN |
118 | 'html' => [ |
119 | 'type' => 'Text', | |
120 | 'label' => ts("Name"), | |
121 | ], | |
c3fc2621 CW |
122 | ], |
123 | 'description' => [ | |
e501603b TO |
124 | 'name' => 'description', |
125 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 126 | 'title' => ts('Description'), |
215b423e | 127 | 'description' => ts('Financial Type Description.'), |
e501603b TO |
128 | 'maxlength' => 255, |
129 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 130 | 'where' => 'civicrm_financial_type.description', |
522a26c9 | 131 | 'table_name' => 'civicrm_financial_type', |
132 | 'entity' => 'FinancialType', | |
133 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 134 | 'localizable' => 0, |
251808cb PN |
135 | 'html' => [ |
136 | 'type' => 'TextArea', | |
137 | 'label' => ts("Description"), | |
138 | ], | |
c3fc2621 CW |
139 | ], |
140 | 'is_deductible' => [ | |
e501603b TO |
141 | 'name' => 'is_deductible', |
142 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 143 | 'title' => ts('Is Tax Deductible?'), |
215b423e | 144 | '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 | 145 | 'where' => 'civicrm_financial_type.is_deductible', |
e501603b | 146 | 'default' => '1', |
522a26c9 | 147 | 'table_name' => 'civicrm_financial_type', |
148 | 'entity' => 'FinancialType', | |
149 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 150 | 'localizable' => 0, |
251808cb PN |
151 | 'html' => [ |
152 | 'type' => 'CheckBox', | |
153 | 'label' => ts("Tax-Deductible?"), | |
154 | ], | |
c3fc2621 CW |
155 | ], |
156 | 'is_reserved' => [ | |
e501603b TO |
157 | 'name' => 'is_reserved', |
158 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 159 | 'title' => ts('Financial Type is Reserved?'), |
215b423e | 160 | 'description' => ts('Is this a predefined system object?'), |
a36434b9 | 161 | 'where' => 'civicrm_financial_type.is_reserved', |
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("Reserved?"), | |
169 | ], | |
c3fc2621 CW |
170 | ], |
171 | 'is_active' => [ | |
e501603b TO |
172 | 'name' => 'is_active', |
173 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 174 | 'title' => ts('Financial Type Is Active?'), |
215b423e | 175 | 'description' => ts('Is this property active?'), |
a36434b9 | 176 | 'where' => 'civicrm_financial_type.is_active', |
522a26c9 | 177 | 'table_name' => 'civicrm_financial_type', |
178 | 'entity' => 'FinancialType', | |
179 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 180 | 'localizable' => 0, |
251808cb PN |
181 | 'html' => [ |
182 | 'type' => 'CheckBox', | |
183 | 'label' => ts("Enabled?"), | |
184 | ], | |
c3fc2621 CW |
185 | ], |
186 | ]; | |
346aaaba | 187 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 188 | } |
346aaaba | 189 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 190 | } |
c3fc2621 | 191 | |
e501603b | 192 | /** |
bd8e0b14 | 193 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
194 | * |
195 | * @return array | |
bd8e0b14 | 196 | * Array(string $name => string $uniqueName). |
e501603b | 197 | */ |
c3fc2621 | 198 | public static function &fieldKeys() { |
bd8e0b14 TO |
199 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
200 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 201 | } |
bd8e0b14 | 202 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 203 | } |
c3fc2621 | 204 | |
e501603b TO |
205 | /** |
206 | * Returns the names of this table | |
207 | * | |
208 | * @return string | |
209 | */ | |
c3fc2621 | 210 | public static function getTableName() { |
e501603b TO |
211 | return self::$_tableName; |
212 | } | |
c3fc2621 | 213 | |
e501603b TO |
214 | /** |
215 | * Returns if this table needs to be logged | |
216 | * | |
c3fc2621 | 217 | * @return bool |
e501603b | 218 | */ |
c3fc2621 | 219 | public function getLog() { |
e501603b TO |
220 | return self::$_log; |
221 | } | |
c3fc2621 | 222 | |
e501603b TO |
223 | /** |
224 | * Returns the list of fields that can be imported | |
225 | * | |
226 | * @param bool $prefix | |
227 | * | |
228 | * @return array | |
229 | */ | |
c3fc2621 CW |
230 | public static function &import($prefix = FALSE) { |
231 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_type', $prefix, []); | |
60808919 | 232 | return $r; |
e501603b | 233 | } |
c3fc2621 | 234 | |
e501603b TO |
235 | /** |
236 | * Returns the list of fields that can be exported | |
237 | * | |
238 | * @param bool $prefix | |
239 | * | |
240 | * @return array | |
241 | */ | |
c3fc2621 CW |
242 | public static function &export($prefix = FALSE) { |
243 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_type', $prefix, []); | |
60808919 | 244 | return $r; |
e501603b | 245 | } |
c3fc2621 | 246 | |
e7a6b91a AS |
247 | /** |
248 | * Returns the list of indices | |
c3fc2621 CW |
249 | * |
250 | * @param bool $localize | |
251 | * | |
252 | * @return array | |
e7a6b91a AS |
253 | */ |
254 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
255 | $indices = [ |
256 | 'UI_id' => [ | |
e7a6b91a | 257 | 'name' => 'UI_id', |
c3fc2621 | 258 | 'field' => [ |
e7a6b91a | 259 | 0 => 'id', |
c3fc2621 CW |
260 | ], |
261 | 'localizable' => FALSE, | |
262 | 'unique' => TRUE, | |
e7a6b91a | 263 | 'sig' => 'civicrm_financial_type::1::id', |
c3fc2621 CW |
264 | ], |
265 | ]; | |
e7a6b91a AS |
266 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
267 | } | |
c3fc2621 | 268 | |
e501603b | 269 | } |