Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | /** | |
28 | * @package CRM | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
022785d8 | 33 | * (GenCodeChecksum:ebf620763b584524906dc13f45a3fbdf) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Financial_DAO_EntityFinancialTrxn constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_entity_financial_trxn'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = false; | |
53 | /** | |
54 | * ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $entity_table; | |
65 | /** | |
66 | * | |
67 | * @var int unsigned | |
68 | */ | |
69 | public $entity_id; | |
70 | /** | |
71 | * | |
72 | * @var int unsigned | |
73 | */ | |
74 | public $financial_trxn_id; | |
75 | /** | |
76 | * allocated amount of transaction to this entity | |
77 | * | |
78 | * @var float | |
79 | */ | |
80 | public $amount; | |
81 | /** | |
f41f0342 | 82 | * Class constructor. |
e501603b TO |
83 | */ |
84 | function __construct() { | |
85 | $this->__table = 'civicrm_entity_financial_trxn'; | |
86 | parent::__construct(); | |
87 | } | |
88 | /** | |
f41f0342 | 89 | * Returns foreign keys and entity references. |
e501603b TO |
90 | * |
91 | * @return array | |
92 | * [CRM_Core_Reference_Interface] | |
93 | */ | |
94 | static function getReferenceColumns() { | |
346aaaba TO |
95 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
96 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
97 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_trxn_id', 'civicrm_financial_trxn', 'id'); | |
98 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); | |
99 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 100 | } |
346aaaba | 101 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
102 | } |
103 | /** | |
104 | * Returns all the column names of this table | |
105 | * | |
106 | * @return array | |
107 | */ | |
108 | static function &fields() { | |
346aaaba TO |
109 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
110 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
111 | 'id' => array( |
112 | 'name' => 'id', | |
113 | 'type' => CRM_Utils_Type::T_INT, | |
114 | 'title' => ts('Entity Financial Transaction ID') , | |
115 | 'description' => 'ID', | |
116 | 'required' => true, | |
522a26c9 | 117 | 'table_name' => 'civicrm_entity_financial_trxn', |
118 | 'entity' => 'EntityFinancialTrxn', | |
119 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
e501603b TO |
120 | ) , |
121 | 'entity_table' => array( | |
122 | 'name' => 'entity_table', | |
123 | 'type' => CRM_Utils_Type::T_STRING, | |
124 | 'title' => ts('Entity Table') , | |
125 | 'description' => 'May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc', | |
126 | 'required' => true, | |
127 | 'maxlength' => 64, | |
128 | 'size' => CRM_Utils_Type::BIG, | |
129 | 'import' => true, | |
130 | 'where' => 'civicrm_entity_financial_trxn.entity_table', | |
131 | 'headerPattern' => '', | |
132 | 'dataPattern' => '', | |
133 | 'export' => true, | |
522a26c9 | 134 | 'table_name' => 'civicrm_entity_financial_trxn', |
135 | 'entity' => 'EntityFinancialTrxn', | |
136 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
e501603b TO |
137 | ) , |
138 | 'entity_id' => array( | |
139 | 'name' => 'entity_id', | |
140 | 'type' => CRM_Utils_Type::T_INT, | |
141 | 'title' => ts('Entity ID') , | |
142 | 'required' => true, | |
522a26c9 | 143 | 'table_name' => 'civicrm_entity_financial_trxn', |
144 | 'entity' => 'EntityFinancialTrxn', | |
145 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
e501603b TO |
146 | ) , |
147 | 'financial_trxn_id' => array( | |
148 | 'name' => 'financial_trxn_id', | |
149 | 'type' => CRM_Utils_Type::T_INT, | |
150 | 'title' => ts('Financial Transaction Id') , | |
522a26c9 | 151 | 'table_name' => 'civicrm_entity_financial_trxn', |
152 | 'entity' => 'EntityFinancialTrxn', | |
153 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
e501603b TO |
154 | 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn', |
155 | ) , | |
156 | 'amount' => array( | |
157 | 'name' => 'amount', | |
158 | 'type' => CRM_Utils_Type::T_MONEY, | |
159 | 'title' => ts('Amount') , | |
160 | 'description' => 'allocated amount of transaction to this entity', | |
161 | 'required' => true, | |
162 | 'precision' => array( | |
163 | 20, | |
164 | 2 | |
165 | ) , | |
166 | 'import' => true, | |
167 | 'where' => 'civicrm_entity_financial_trxn.amount', | |
168 | 'headerPattern' => '/amount/i', | |
169 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
170 | 'export' => true, | |
522a26c9 | 171 | 'table_name' => 'civicrm_entity_financial_trxn', |
172 | 'entity' => 'EntityFinancialTrxn', | |
173 | 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', | |
e501603b TO |
174 | ) , |
175 | ); | |
346aaaba | 176 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 177 | } |
346aaaba | 178 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
179 | } |
180 | /** | |
bd8e0b14 | 181 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
182 | * |
183 | * @return array | |
bd8e0b14 | 184 | * Array(string $name => string $uniqueName). |
e501603b TO |
185 | */ |
186 | static function &fieldKeys() { | |
bd8e0b14 TO |
187 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
188 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 189 | } |
bd8e0b14 | 190 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
191 | } |
192 | /** | |
193 | * Returns the names of this table | |
194 | * | |
195 | * @return string | |
196 | */ | |
197 | static function getTableName() { | |
198 | return self::$_tableName; | |
199 | } | |
200 | /** | |
201 | * Returns if this table needs to be logged | |
202 | * | |
203 | * @return boolean | |
204 | */ | |
205 | function getLog() { | |
206 | return self::$_log; | |
207 | } | |
208 | /** | |
209 | * Returns the list of fields that can be imported | |
210 | * | |
211 | * @param bool $prefix | |
212 | * | |
213 | * @return array | |
214 | */ | |
215 | static function &import($prefix = false) { | |
60808919 TO |
216 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_trxn', $prefix, array()); |
217 | return $r; | |
e501603b TO |
218 | } |
219 | /** | |
220 | * Returns the list of fields that can be exported | |
221 | * | |
222 | * @param bool $prefix | |
223 | * | |
224 | * @return array | |
225 | */ | |
226 | static function &export($prefix = false) { | |
60808919 TO |
227 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_trxn', $prefix, array()); |
228 | return $r; | |
e501603b TO |
229 | } |
230 | } |