Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Financial/FinancialType.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 9 | * (GenCodeChecksum:9d787931917508983d68631821eea721) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
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'), |
e501603b | 93 | 'description' => '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, |
522a26c9 | 95 | 'table_name' => 'civicrm_financial_type', |
96 | 'entity' => 'FinancialType', | |
97 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 98 | 'localizable' => 0, |
c3fc2621 CW |
99 | ], |
100 | 'financial_type' => [ | |
e501603b TO |
101 | 'name' => 'name', |
102 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 103 | 'title' => ts('Financial Type'), |
e501603b | 104 | 'description' => 'Financial Type Name.', |
c3fc2621 | 105 | 'required' => TRUE, |
e501603b TO |
106 | 'maxlength' => 64, |
107 | 'size' => CRM_Utils_Type::BIG, | |
c3fc2621 | 108 | 'import' => TRUE, |
e501603b TO |
109 | 'where' => 'civicrm_financial_type.name', |
110 | 'headerPattern' => '/(finan(cial)?)?type/i', | |
111 | 'dataPattern' => '/donation|member|campaign/i', | |
c3fc2621 | 112 | 'export' => TRUE, |
522a26c9 | 113 | 'table_name' => 'civicrm_financial_type', |
114 | 'entity' => 'FinancialType', | |
115 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 116 | 'localizable' => 0, |
c3fc2621 CW |
117 | ], |
118 | 'description' => [ | |
e501603b TO |
119 | 'name' => 'description', |
120 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 121 | 'title' => ts('Description'), |
e501603b TO |
122 | 'description' => 'Financial Type Description.', |
123 | 'maxlength' => 255, | |
124 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 125 | 'table_name' => 'civicrm_financial_type', |
126 | 'entity' => 'FinancialType', | |
127 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 128 | 'localizable' => 0, |
c3fc2621 CW |
129 | ], |
130 | 'is_deductible' => [ | |
e501603b TO |
131 | 'name' => 'is_deductible', |
132 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 133 | 'title' => ts('Is Tax Deductible?'), |
e501603b TO |
134 | 'description' => '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.', |
135 | 'default' => '1', | |
522a26c9 | 136 | 'table_name' => 'civicrm_financial_type', |
137 | 'entity' => 'FinancialType', | |
138 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 139 | 'localizable' => 0, |
c3fc2621 CW |
140 | ], |
141 | 'is_reserved' => [ | |
e501603b TO |
142 | 'name' => 'is_reserved', |
143 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 144 | 'title' => ts('Financial Type is Reserved?'), |
e501603b | 145 | 'description' => 'Is this a predefined system object?', |
522a26c9 | 146 | 'table_name' => 'civicrm_financial_type', |
147 | 'entity' => 'FinancialType', | |
148 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 149 | 'localizable' => 0, |
c3fc2621 CW |
150 | ], |
151 | 'is_active' => [ | |
e501603b TO |
152 | 'name' => 'is_active', |
153 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 154 | 'title' => ts('Financial Type Is Active?'), |
e501603b | 155 | 'description' => 'Is this property active?', |
522a26c9 | 156 | 'table_name' => 'civicrm_financial_type', |
157 | 'entity' => 'FinancialType', | |
158 | 'bao' => 'CRM_Financial_BAO_FinancialType', | |
6a7e5e5d | 159 | 'localizable' => 0, |
c3fc2621 CW |
160 | ], |
161 | ]; | |
346aaaba | 162 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 163 | } |
346aaaba | 164 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 165 | } |
c3fc2621 | 166 | |
e501603b | 167 | /** |
bd8e0b14 | 168 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
169 | * |
170 | * @return array | |
bd8e0b14 | 171 | * Array(string $name => string $uniqueName). |
e501603b | 172 | */ |
c3fc2621 | 173 | public static function &fieldKeys() { |
bd8e0b14 TO |
174 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
175 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 176 | } |
bd8e0b14 | 177 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 178 | } |
c3fc2621 | 179 | |
e501603b TO |
180 | /** |
181 | * Returns the names of this table | |
182 | * | |
183 | * @return string | |
184 | */ | |
c3fc2621 | 185 | public static function getTableName() { |
e501603b TO |
186 | return self::$_tableName; |
187 | } | |
c3fc2621 | 188 | |
e501603b TO |
189 | /** |
190 | * Returns if this table needs to be logged | |
191 | * | |
c3fc2621 | 192 | * @return bool |
e501603b | 193 | */ |
c3fc2621 | 194 | public function getLog() { |
e501603b TO |
195 | return self::$_log; |
196 | } | |
c3fc2621 | 197 | |
e501603b TO |
198 | /** |
199 | * Returns the list of fields that can be imported | |
200 | * | |
201 | * @param bool $prefix | |
202 | * | |
203 | * @return array | |
204 | */ | |
c3fc2621 CW |
205 | public static function &import($prefix = FALSE) { |
206 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_type', $prefix, []); | |
60808919 | 207 | return $r; |
e501603b | 208 | } |
c3fc2621 | 209 | |
e501603b TO |
210 | /** |
211 | * Returns the list of fields that can be exported | |
212 | * | |
213 | * @param bool $prefix | |
214 | * | |
215 | * @return array | |
216 | */ | |
c3fc2621 CW |
217 | public static function &export($prefix = FALSE) { |
218 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_type', $prefix, []); | |
60808919 | 219 | return $r; |
e501603b | 220 | } |
c3fc2621 | 221 | |
e7a6b91a AS |
222 | /** |
223 | * Returns the list of indices | |
c3fc2621 CW |
224 | * |
225 | * @param bool $localize | |
226 | * | |
227 | * @return array | |
e7a6b91a AS |
228 | */ |
229 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
230 | $indices = [ |
231 | 'UI_id' => [ | |
e7a6b91a | 232 | 'name' => 'UI_id', |
c3fc2621 | 233 | 'field' => [ |
e7a6b91a | 234 | 0 => 'id', |
c3fc2621 CW |
235 | ], |
236 | 'localizable' => FALSE, | |
237 | 'unique' => TRUE, | |
e7a6b91a | 238 | 'sig' => 'civicrm_financial_type::1::id', |
c3fc2621 CW |
239 | ], |
240 | ]; | |
e7a6b91a AS |
241 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
242 | } | |
c3fc2621 | 243 | |
e501603b | 244 | } |