Merge pull request #15731 from eileenmcnaughton/rel_clean
[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 <abbrColumn>symbol</abbrColumn>
89 </pseudoconstant>
90 <html>
91 <type>Select</type>
92 </html>
93 </field>
94 <field>
95 <name>financial_account_id</name>
96 <type>int unsigned</type>
97 <title>Financial Account ID</title>
98 <comment>FK to civicrm_financial_account</comment>
99 <add>4.3</add>
100 <pseudoconstant>
101 <table>civicrm_financial_account</table>
102 <keyColumn>id</keyColumn>
103 <labelColumn>name</labelColumn>
104 </pseudoconstant>
105 <html>
106 <type>Select</type>
107 </html>
108 </field>
109 <foreignKey>
110 <name>financial_account_id</name>
111 <table>civicrm_financial_account</table>
112 <key>id</key>
113 <add>4.3</add>
114 </foreignKey>
115 <field>
116 <name>status_id</name>
117 <export>true</export>
118 <title>Financial Item Status ID</title>
119 <type>int unsigned</type>
120 <comment>Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)</comment>
121 <add>4.3</add>
122 <pseudoconstant>
123 <optionGroupName>financial_item_status</optionGroupName>
124 </pseudoconstant>
125 <html>
126 <type>Select</type>
127 </html>
128 </field>
129 <field>
130 <name>entity_table</name>
131 <type>varchar</type>
132 <title>Entity Table</title>
133 <length>64</length>
134 <comment>The table providing the source of this item such as civicrm_line_item</comment>
135 <add>4.3</add>
136 </field>
137 <field>
138 <name>entity_id</name>
139 <title>Entity ID</title>
140 <type>int unsigned</type>
141 <comment>The specific source item that is responsible for the creation of this financial_item</comment>
142 <add>4.3</add>
143 </field>
144 <dynamicForeignKey>
145 <idColumn>entity_id</idColumn>
146 <typeColumn>entity_table</typeColumn>
147 <add>4.3</add>
148 </dynamicForeignKey>
149 <index>
150 <name>UI_id</name>
151 <fieldName>id</fieldName>
152 <unique>true</unique>
153 <add>4.3</add>
154 <drop>4.7</drop>
155 </index>
156 <index>
157 <name>IX_created_date</name>
158 <fieldName>created_date</fieldName>
159 <add>4.3</add>
160 </index>
161 <index>
162 <name>IX_transaction_date</name>
163 <fieldName>transaction_date</fieldName>
164 <add>4.3</add>
165 </index>
166 <index>
167 <name>IX_entity</name>
168 <fieldName>entity_table</fieldName>
169 <fieldName>entity_id</fieldName>
170 <add>4.3</add>
171 <drop>4.7</drop>
172 </index>
173 <index>
174 <name>index_entity_id_entity_table</name>
175 <fieldName>entity_id</fieldName>
176 <fieldName>entity_table</fieldName>
177 <add>4.7</add>
178 </index>
179 </table>