Merge pull request #13324 from agileware/CIVICRM-947
[civicrm-core.git] / xml / schema / Financial / FinancialItem.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Financial</base>
5 <class>FinancialItem</class>
6 <name>civicrm_financial_item</name>
7 <add>4.3</add>
8 <comment>Financial data for civicrm_line_item, etc.</comment>
9 <log>true</log>
10 <field>
11 <name>id</name>
12 <type>int unsigned</type>
13 <title>Financial Item ID</title>
14 <length>10</length>
15 <required>true</required>
16 <comment></comment>
17 <add>4.3</add>
18 </field>
19 <primaryKey>
20 <name>id</name>
21 <autoincrement>true</autoincrement>
22 </primaryKey>
23 <field>
24 <name>created_date</name>
25 <type>timestamp</type>
26 <title>Financial Item Created Date</title>
27 <required>true</required>
28 <default>CURRENT_TIMESTAMP</default>
29 <comment>Date and time the item was created</comment>
30 <add>4.3</add>
31 </field>
32 <field>
33 <name>transaction_date</name>
34 <type>datetime</type>
35 <title>Financial Item Transaction Date</title>
36 <required>true</required>
37 <comment>Date and time of the source transaction</comment>
38 <add>4.3</add>
39 </field>
40 <field>
41 <name>contact_id</name>
42 <type>int unsigned</type>
43 <title>Financial Item Contact ID</title>
44 <required>true</required>
45 <export>true</export>
46 <comment>FK to Contact ID of contact the item is from</comment>
47 <add>4.3</add>
48 </field>
49 <foreignKey>
50 <name>contact_id</name>
51 <table>civicrm_contact</table>
52 <key>id</key>
53 <onDelete>CASCADE</onDelete>
54 <add>4.3</add>
55 </foreignKey>
56 <field>
57 <name>description</name>
58 <type>varchar</type>
59 <title>Financial Item Description</title>
60 <length>255</length>
61 <comment>Human readable description of this item, to ease display without lookup of source item.</comment>
62 <add>4.3</add>
63 </field>
64 <field>
65 <name>amount</name>
66 <title>Amount</title>
67 <type>decimal</type>
68 <default>0</default>
69 <required>true</required>
70 <headerPattern>/unit?.?amoun/i</headerPattern>
71 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
72 <comment>Total amount of this item</comment>
73 <add>4.3</add>
74 </field>
75 <field>
76 <name>currency</name>
77 <export>true</export>
78 <type>varchar</type>
79 <title>Financial Item Currency</title>
80 <length>3</length>
81 <comment>Currency for the amount</comment>
82 <add>4.3</add>
83 <pseudoconstant>
84 <table>civicrm_currency</table>
85 <keyColumn>name</keyColumn>
86 <labelColumn>full_name</labelColumn>
87 <nameColumn>name</nameColumn>
88 </pseudoconstant>
89 <html>
90 <type>Select</type>
91 </html>
92 </field>
93 <field>
94 <name>financial_account_id</name>
95 <type>int unsigned</type>
96 <title>Financial Account ID</title>
97 <comment>FK to civicrm_financial_account</comment>
98 <add>4.3</add>
99 <pseudoconstant>
100 <table>civicrm_financial_account</table>
101 <keyColumn>id</keyColumn>
102 <labelColumn>name</labelColumn>
103 </pseudoconstant>
104 <html>
105 <type>Select</type>
106 </html>
107 </field>
108 <foreignKey>
109 <name>financial_account_id</name>
110 <table>civicrm_financial_account</table>
111 <key>id</key>
112 <add>4.3</add>
113 </foreignKey>
114 <field>
115 <name>status_id</name>
116 <export>true</export>
117 <title>Financial Item Status ID</title>
118 <type>int unsigned</type>
119 <comment>Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)</comment>
120 <add>4.3</add>
121 <pseudoconstant>
122 <optionGroupName>financial_item_status</optionGroupName>
123 </pseudoconstant>
124 <html>
125 <type>Select</type>
126 </html>
127 </field>
128 <field>
129 <name>entity_table</name>
130 <type>varchar</type>
131 <title>Entity Table</title>
132 <length>64</length>
133 <comment>The table providing the source of this item such as civicrm_line_item</comment>
134 <add>4.3</add>
135 </field>
136 <field>
137 <name>entity_id</name>
138 <title>Entity ID</title>
139 <type>int unsigned</type>
140 <comment>The specific source item that is responsible for the creation of this financial_item</comment>
141 <add>4.3</add>
142 </field>
143 <dynamicForeignKey>
144 <idColumn>entity_id</idColumn>
145 <typeColumn>entity_table</typeColumn>
146 <add>4.3</add>
147 </dynamicForeignKey>
148 <index>
149 <name>UI_id</name>
150 <fieldName>id</fieldName>
151 <unique>true</unique>
152 <add>4.3</add>
153 <drop>4.7</drop>
154 </index>
155 <index>
156 <name>IX_created_date</name>
157 <fieldName>created_date</fieldName>
158 <add>4.3</add>
159 </index>
160 <index>
161 <name>IX_transaction_date</name>
162 <fieldName>transaction_date</fieldName>
163 <add>4.3</add>
164 </index>
165 <index>
166 <name>IX_entity</name>
167 <fieldName>entity_table</fieldName>
168 <fieldName>entity_id</fieldName>
169 <add>4.3</add>
170 <drop>4.7</drop>
171 </index>
172 <index>
173 <name>index_entity_id_entity_table</name>
174 <fieldName>entity_id</fieldName>
175 <fieldName>entity_table</fieldName>
176 <add>4.7</add>
177 </index>
178 </table>