5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Financial/FinancialType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:896dd0256e12220dc174740a9f66012f)
13 * Database access object for the FinancialType entity.
15 class CRM_Financial_DAO_FinancialType
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.3';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_financial_type';
28 * Field to show when displaying a record.
32 public static $_labelField = 'name';
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 public static $_log = TRUE;
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
44 * @var int|string|null
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
51 * Financial Type Name.
54 * (SQL type: varchar(64))
55 * Note that values will be retrieved from the database as a string.
60 * Financial Type Description.
63 * (SQL type: varchar(255))
64 * Note that values will be retrieved from the database as a string.
69 * 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.
73 * Note that values will be retrieved from the database as a string.
75 public $is_deductible;
78 * Is this a predefined system object?
82 * Note that values will be retrieved from the database as a string.
87 * Is this property active?
91 * Note that values will be retrieved from the database as a string.
98 public function __construct() {
99 $this->__table
= 'civicrm_financial_type';
100 parent
::__construct();
104 * Returns localized title of this entity.
106 * @param bool $plural
107 * Whether to return the plural version of the title.
109 public static function getEntityTitle($plural = FALSE) {
110 return $plural ?
ts('Financial Types') : ts('Financial Type');
114 * Returns all the column names of this table
118 public static function &fields() {
119 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
120 Civi
::$statics[__CLASS__
]['fields'] = [
123 'type' => CRM_Utils_Type
::T_INT
,
124 'title' => ts('Financial Type ID'),
125 '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'),
127 'where' => 'civicrm_financial_type.id',
128 'table_name' => 'civicrm_financial_type',
129 'entity' => 'FinancialType',
130 'bao' => 'CRM_Financial_BAO_FinancialType',
138 'financial_type' => [
140 'type' => CRM_Utils_Type
::T_STRING
,
141 'title' => ts('Financial Type'),
142 'description' => ts('Financial Type Name.'),
145 'size' => CRM_Utils_Type
::BIG
,
147 'where' => 'civicrm_financial_type.name',
148 'headerPattern' => '/(finan(cial)?)?type/i',
149 'dataPattern' => '/donation|member|campaign/i',
151 'table_name' => 'civicrm_financial_type',
152 'entity' => 'FinancialType',
153 'bao' => 'CRM_Financial_BAO_FinancialType',
157 'label' => ts("Name"),
162 'name' => 'description',
163 'type' => CRM_Utils_Type
::T_STRING
,
164 'title' => ts('Description'),
165 'description' => ts('Financial Type Description.'),
167 'size' => CRM_Utils_Type
::HUGE
,
168 'where' => 'civicrm_financial_type.description',
169 'table_name' => 'civicrm_financial_type',
170 'entity' => 'FinancialType',
171 'bao' => 'CRM_Financial_BAO_FinancialType',
174 'type' => 'TextArea',
175 'label' => ts("Description"),
180 'name' => 'is_deductible',
181 'type' => CRM_Utils_Type
::T_BOOLEAN
,
182 'title' => ts('Is Tax Deductible?'),
183 '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.'),
185 'where' => 'civicrm_financial_type.is_deductible',
187 'table_name' => 'civicrm_financial_type',
188 'entity' => 'FinancialType',
189 'bao' => 'CRM_Financial_BAO_FinancialType',
192 'type' => 'CheckBox',
193 'label' => ts("Tax-Deductible?"),
198 'name' => 'is_reserved',
199 'type' => CRM_Utils_Type
::T_BOOLEAN
,
200 'title' => ts('Financial Type is Reserved?'),
201 'description' => ts('Is this a predefined system object?'),
203 'where' => 'civicrm_financial_type.is_reserved',
205 'table_name' => 'civicrm_financial_type',
206 'entity' => 'FinancialType',
207 'bao' => 'CRM_Financial_BAO_FinancialType',
210 'type' => 'CheckBox',
211 'label' => ts("Reserved?"),
216 'name' => 'is_active',
217 'type' => CRM_Utils_Type
::T_BOOLEAN
,
218 'title' => ts('Financial Type Is Active?'),
219 'description' => ts('Is this property active?'),
221 'where' => 'civicrm_financial_type.is_active',
223 'table_name' => 'civicrm_financial_type',
224 'entity' => 'FinancialType',
225 'bao' => 'CRM_Financial_BAO_FinancialType',
228 'type' => 'CheckBox',
229 'label' => ts("Enabled?"),
234 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
236 return Civi
::$statics[__CLASS__
]['fields'];
240 * Return a mapping from field-name to the corresponding key (as used in fields()).
243 * Array(string $name => string $uniqueName).
245 public static function &fieldKeys() {
246 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
247 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
249 return Civi
::$statics[__CLASS__
]['fieldKeys'];
253 * Returns the names of this table
257 public static function getTableName() {
258 return self
::$_tableName;
262 * Returns if this table needs to be logged
266 public function getLog() {
271 * Returns the list of fields that can be imported
273 * @param bool $prefix
277 public static function &import($prefix = FALSE) {
278 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'financial_type', $prefix, []);
283 * Returns the list of fields that can be exported
285 * @param bool $prefix
289 public static function &export($prefix = FALSE) {
290 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'financial_type', $prefix, []);
295 * Returns the list of indices
297 * @param bool $localize
301 public static function indices($localize = TRUE) {
303 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;