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