Merge remote-tracking branch 'upstream/4.3' into 4.3-4.4-2013-10-28-14-52-15
[civicrm-core.git] / xml / schema / Financial / FinancialTrxn.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Financial</base>
5 <class>FinancialTrxn</class>
6 <name>civicrm_financial_trxn</name>
7 <add>1.3</add>
8 <log>true</log>
9 <field>
10 <name>id</name>
11 <type>int unsigned</type>
12 <required>true</required>
13 <add>1.3</add>
14 </field>
15 <primaryKey>
16 <name>id</name>
17 <autoincrement>true</autoincrement>
18 </primaryKey>
19 <field>
20 <name>from_account_id</name>
21 <type>int unsigned</type>
22 <comment>FK to financial_account table.</comment>
23 <add>3.2</add>
24 <drop>4.3</drop>
25 </field>
26 <foreignKey>
27 <name>from_account_id</name>
28 <table>civicrm_financial_account</table>
29 <key>id</key>
30 <add>3.2</add>
31 <drop>4.3</drop>
32 </foreignKey>
33 <field>
34 <name>to_account_id</name>
35 <type>int unsigned</type>
36 <comment>FK to financial_account table.</comment>
37 <add>3.2</add>
38 <drop>4.3</drop>
39 </field>
40 <foreignKey>
41 <name>to_account_id</name>
42 <table>civicrm_financial_account</table>
43 <key>id</key>
44 <add>3.2</add>
45 <drop>4.3</drop>
46 </foreignKey>
47 <field>
48 <name>from_financial_account_id</name>
49 <type>int unsigned</type>
50 <comment>FK to financial_account table.</comment>
51 <add>4.3</add>
52 <pseudoconstant>
53 <table>civicrm_financial_account</table>
54 <keyColumn>id</keyColumn>
55 <labelColumn>name</labelColumn>
56 </pseudoconstant>
57 </field>
58 <foreignKey>
59 <name>from_financial_account_id</name>
60 <table>civicrm_financial_account</table>
61 <key>id</key>
62 <add>4.3</add>
63 </foreignKey>
64 <field>
65 <name>to_financial_account_id</name>
66 <type>int unsigned</type>
67 <comment>FK to financial_financial_account table.</comment>
68 <add>4.3</add>
69 <pseudoconstant>
70 <table>civicrm_financial_account</table>
71 <keyColumn>id</keyColumn>
72 <labelColumn>name</labelColumn>
73 </pseudoconstant>
74 </field>
75 <foreignKey>
76 <name>to_financial_account_id</name>
77 <table>civicrm_financial_account</table>
78 <key>id</key>
79 <add>4.3</add>
80 </foreignKey>
81 <field>
82 <name>trxn_date</name>
83 <type>datetime</type>
84 <default>NULL</default>
85 <comment>date transaction occurred</comment>
86 <add>1.3</add>
87 </field>
88 <field>
89 <name>trxn_type</name>
90 <type>enum</type>
91 <values>Debit,Credit</values>
92 <required>true</required>
93 <add>1.3</add>
94 <drop>4.3</drop>
95 </field>
96 <field>
97 <name>total_amount</name>
98 <type>decimal</type>
99 <required>true</required>
100 <comment>amount of transaction</comment>
101 <add>1.3</add>
102 </field>
103 <field>
104 <name>fee_amount</name>
105 <type>decimal</type>
106 <comment>actual processor fee if known - may be 0.</comment>
107 <add>1.3</add>
108 </field>
109 <field>
110 <name>net_amount</name>
111 <type>decimal</type>
112 <comment>actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.</comment>
113 <add>1.3</add>
114 </field>
115 <field>
116 <name>currency</name>
117 <type>varchar</type>
118 <length>3</length>
119 <default>NULL</default>
120 <import>true</import>
121 <headerPattern>/cur(rency)?/i</headerPattern>
122 <dataPattern>/^[A-Z]{3}$/</dataPattern>
123 <comment>3 character string, value from config setting or input via user.</comment>
124 <add>1.3</add>
125 <pseudoconstant>
126 <table>civicrm_currency</table>
127 <keyColumn>name</keyColumn>
128 <labelColumn>full_name</labelColumn>
129 <nameColumn>numeric_code</nameColumn>
130 </pseudoconstant>
131 </field>
132 <field>
133 <name>payment_processor</name>
134 <type>varchar</type>
135 <length>64</length>
136 <required>true</required>
137 <comment>derived from Processor setting in civicrm.settings.php.</comment>
138 <add>1.3</add>
139 <drop>4.3</drop>
140 </field>
141 <field>
142 <name>trxn_id</name>
143 <type>varchar</type>
144 <length>255</length>
145 <comment>user-specified unique processor transaction id, bank id + trans id,... depending on payment_method</comment>
146 <add>1.3</add>
147 </field>
148 <field>
149 <name>trxn_result_code</name>
150 <type>varchar</type>
151 <length>255</length>
152 <comment>processor result code</comment>
153 <add>1.3</add>
154 </field>
155 <field>
156 <name>status_id</name>
157 <title>Financial Transaction Status Id</title>
158 <type>int unsigned</type>
159 <import>true</import>
160 <export>true</export>
161 <comment>pseudo FK to civicrm_option_value of financial_item status option_group</comment>
162 <headerPattern>/status/i</headerPattern>
163 <add>4.3</add>
164 </field>
165 <field>
166 <name>payment_processor_id</name>
167 <type>int unsigned</type>
168 <comment>Payment Processor for this financial transaction</comment>
169 <add>4.3</add>
170 </field>
171 <foreignKey>
172 <name>payment_processor_id</name>
173 <table>civicrm_payment_processor</table>
174 <key>id</key>
175 <onDelete>SET NULL</onDelete>
176 <add>4.3</add>
177 </foreignKey>
178 <field>
179 <name>payment_instrument_id</name>
180 <uniqueName>financial_trxn_payment_instrument_id</uniqueName>
181 <title>Payment Instrument</title>
182 <type>int unsigned</type>
183 <comment>FK to payment_instrument option group values</comment>
184 <pseudoconstant>
185 <optionGroupName>payment_instrument</optionGroupName>
186 </pseudoconstant>
187 <add>4.3</add>
188 </field>
189 <index>
190 <name>UI_ftrxn_payment_instrument_id</name>
191 <fieldName>payment_instrument_id</fieldName>
192 <add>4.3</add>
193 </index>
194 <field>
195 <name>check_number</name>
196 <uniqueName>financial_trxn_check_number</uniqueName>
197 <title>Check Number</title>
198 <comment>Check number</comment>
199 <type>varchar</type>
200 <length>255</length>
201 <size>SIX</size>
202 <add>4.3</add>
203 </field>
204 <index>
205 <name>UI_ftrxn_check_number</name>
206 <fieldName>check_number</fieldName>
207 <add>4.3</add>
208 </index>
209 </table>
210