Merge pull request #12270 from eileenmcnaughton/systememail
[civicrm-core.git] / CRM / Financial / DAO / FinancialType.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Financial/FinancialType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:9d787931917508983d68631821eea721)
10 */
11
12 /**
13 * Database access object for the FinancialType entity.
14 */
15 class CRM_Financial_DAO_FinancialType extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_financial_type';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = TRUE;
30
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;
37
38 /**
39 * Financial Type Name.
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * Financial Type Description.
47 *
48 * @var string
49 */
50 public $description;
51
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;
58
59 /**
60 * Is this a predefined system object?
61 *
62 * @var boolean
63 */
64 public $is_reserved;
65
66 /**
67 * Is this property active?
68 *
69 * @var boolean
70 */
71 public $is_active;
72
73 /**
74 * Class constructor.
75 */
76 public function __construct() {
77 $this->__table = 'civicrm_financial_type';
78 parent::__construct();
79 }
80
81 /**
82 * Returns all the column names of this table
83 *
84 * @return array
85 */
86 public static function &fields() {
87 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
88 Civi::$statics[__CLASS__]['fields'] = [
89 'id' => [
90 'name' => 'id',
91 'type' => CRM_Utils_Type::T_INT,
92 'title' => ts('Financial Type ID'),
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',
94 'required' => TRUE,
95 'table_name' => 'civicrm_financial_type',
96 'entity' => 'FinancialType',
97 'bao' => 'CRM_Financial_BAO_FinancialType',
98 'localizable' => 0,
99 ],
100 'financial_type' => [
101 'name' => 'name',
102 'type' => CRM_Utils_Type::T_STRING,
103 'title' => ts('Financial Type'),
104 'description' => 'Financial Type Name.',
105 'required' => TRUE,
106 'maxlength' => 64,
107 'size' => CRM_Utils_Type::BIG,
108 'import' => TRUE,
109 'where' => 'civicrm_financial_type.name',
110 'headerPattern' => '/(finan(cial)?)?type/i',
111 'dataPattern' => '/donation|member|campaign/i',
112 'export' => TRUE,
113 'table_name' => 'civicrm_financial_type',
114 'entity' => 'FinancialType',
115 'bao' => 'CRM_Financial_BAO_FinancialType',
116 'localizable' => 0,
117 ],
118 'description' => [
119 'name' => 'description',
120 'type' => CRM_Utils_Type::T_STRING,
121 'title' => ts('Description'),
122 'description' => 'Financial Type Description.',
123 'maxlength' => 255,
124 'size' => CRM_Utils_Type::HUGE,
125 'table_name' => 'civicrm_financial_type',
126 'entity' => 'FinancialType',
127 'bao' => 'CRM_Financial_BAO_FinancialType',
128 'localizable' => 0,
129 ],
130 'is_deductible' => [
131 'name' => 'is_deductible',
132 'type' => CRM_Utils_Type::T_BOOLEAN,
133 'title' => ts('Is Tax Deductible?'),
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',
136 'table_name' => 'civicrm_financial_type',
137 'entity' => 'FinancialType',
138 'bao' => 'CRM_Financial_BAO_FinancialType',
139 'localizable' => 0,
140 ],
141 'is_reserved' => [
142 'name' => 'is_reserved',
143 'type' => CRM_Utils_Type::T_BOOLEAN,
144 'title' => ts('Financial Type is Reserved?'),
145 'description' => 'Is this a predefined system object?',
146 'table_name' => 'civicrm_financial_type',
147 'entity' => 'FinancialType',
148 'bao' => 'CRM_Financial_BAO_FinancialType',
149 'localizable' => 0,
150 ],
151 'is_active' => [
152 'name' => 'is_active',
153 'type' => CRM_Utils_Type::T_BOOLEAN,
154 'title' => ts('Financial Type Is Active?'),
155 'description' => 'Is this property active?',
156 'table_name' => 'civicrm_financial_type',
157 'entity' => 'FinancialType',
158 'bao' => 'CRM_Financial_BAO_FinancialType',
159 'localizable' => 0,
160 ],
161 ];
162 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
163 }
164 return Civi::$statics[__CLASS__]['fields'];
165 }
166
167 /**
168 * Return a mapping from field-name to the corresponding key (as used in fields()).
169 *
170 * @return array
171 * Array(string $name => string $uniqueName).
172 */
173 public static function &fieldKeys() {
174 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
175 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
176 }
177 return Civi::$statics[__CLASS__]['fieldKeys'];
178 }
179
180 /**
181 * Returns the names of this table
182 *
183 * @return string
184 */
185 public static function getTableName() {
186 return self::$_tableName;
187 }
188
189 /**
190 * Returns if this table needs to be logged
191 *
192 * @return bool
193 */
194 public function getLog() {
195 return self::$_log;
196 }
197
198 /**
199 * Returns the list of fields that can be imported
200 *
201 * @param bool $prefix
202 *
203 * @return array
204 */
205 public static function &import($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_type', $prefix, []);
207 return $r;
208 }
209
210 /**
211 * Returns the list of fields that can be exported
212 *
213 * @param bool $prefix
214 *
215 * @return array
216 */
217 public static function &export($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_type', $prefix, []);
219 return $r;
220 }
221
222 /**
223 * Returns the list of indices
224 *
225 * @param bool $localize
226 *
227 * @return array
228 */
229 public static function indices($localize = TRUE) {
230 $indices = [
231 'UI_id' => [
232 'name' => 'UI_id',
233 'field' => [
234 0 => 'id',
235 ],
236 'localizable' => FALSE,
237 'unique' => TRUE,
238 'sig' => 'civicrm_financial_type::1::id',
239 ],
240 ];
241 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
242 }
243
244 }