Merge pull request #13324 from agileware/CIVICRM-947
[civicrm-core.git] / xml / schema / Financial / FinancialItem.xml
CommitLineData
3c7d2158 1<?xml version="1.0" encoding="iso-8859-1" ?>
6a488035 2
3c7d2158 3<table>
4 <base>CRM/Financial</base>
5 <class>FinancialItem</class>
6 <name>civicrm_financial_item</name>
7 <add>4.3</add>
6a488035 8 <comment>Financial data for civicrm_line_item, etc.</comment>
3c7d2158 9 <log>true</log>
10 <field>
11 <name>id</name>
6a488035 12 <type>int unsigned</type>
e117e295 13 <title>Financial Item ID</title>
6a488035 14 <length>10</length>
3c7d2158 15 <required>true</required>
16 <comment></comment>
6a488035 17 <add>4.3</add>
3c7d2158 18 </field>
19 <primaryKey>
20 <name>id</name>
21 <autoincrement>true</autoincrement>
22 </primaryKey>
6a488035
TO
23 <field>
24 <name>created_date</name>
25 <type>timestamp</type>
e117e295 26 <title>Financial Item Created Date</title>
3c7d2158 27 <required>true</required>
28 <default>CURRENT_TIMESTAMP</default>
6a488035
TO
29 <comment>Date and time the item was created</comment>
30 <add>4.3</add>
3c7d2158 31 </field>
6a488035
TO
32 <field>
33 <name>transaction_date</name>
34 <type>datetime</type>
e117e295 35 <title>Financial Item Transaction Date</title>
3c7d2158 36 <required>true</required>
6a488035
TO
37 <comment>Date and time of the source transaction</comment>
38 <add>4.3</add>
3c7d2158 39 </field>
6a488035
TO
40 <field>
41 <name>contact_id</name>
42 <type>int unsigned</type>
e117e295 43 <title>Financial Item Contact ID</title>
3c7d2158 44 <required>true</required>
6a488035
TO
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>
e117e295 59 <title>Financial Item Description</title>
6a488035
TO
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>
3c7d2158 64 <field>
65 <name>amount</name>
6a488035
TO
66 <title>Amount</title>
67 <type>decimal</type>
68 <default>0</default>
3c7d2158 69 <required>true</required>
6a488035
TO
70 <headerPattern>/unit?.?amoun/i</headerPattern>
71 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
3c7d2158 72 <comment>Total amount of this item</comment>
73 <add>4.3</add>
6a488035 74 </field>
3c7d2158 75 <field>
6a488035
TO
76 <name>currency</name>
77 <export>true</export>
78 <type>varchar</type>
e117e295 79 <title>Financial Item Currency</title>
6a488035
TO
80 <length>3</length>
81 <comment>Currency for the amount</comment>
82 <add>4.3</add>
bd44e0df
AS
83 <pseudoconstant>
84 <table>civicrm_currency</table>
85 <keyColumn>name</keyColumn>
a38a89fc 86 <labelColumn>full_name</labelColumn>
c3de5c5a 87 <nameColumn>name</nameColumn>
bd44e0df 88 </pseudoconstant>
614d72ec 89 <html>
e0991796 90 <type>Select</type>
614d72ec 91 </html>
6a488035
TO
92 </field>
93 <field>
94 <name>financial_account_id</name>
95 <type>int unsigned</type>
e117e295 96 <title>Financial Account ID</title>
6a488035
TO
97 <comment>FK to civicrm_financial_account</comment>
98 <add>4.3</add>
7611ae71
AS
99 <pseudoconstant>
100 <table>civicrm_financial_account</table>
101 <keyColumn>id</keyColumn>
102 <labelColumn>name</labelColumn>
103 </pseudoconstant>
614d72ec 104 <html>
e0991796 105 <type>Select</type>
614d72ec 106 </html>
6a488035
TO
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>
e117e295 117 <title>Financial Item Status ID</title>
6a488035
TO
118 <type>int unsigned</type>
119 <comment>Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)</comment>
120 <add>4.3</add>
7611ae71
AS
121 <pseudoconstant>
122 <optionGroupName>financial_item_status</optionGroupName>
123 </pseudoconstant>
614d72ec 124 <html>
e0991796 125 <type>Select</type>
614d72ec 126 </html>
6a488035
TO
127 </field>
128 <field>
129 <name>entity_table</name>
130 <type>varchar</type>
e117e295 131 <title>Entity Table</title>
6a488035
TO
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>
e117e295 138 <title>Entity ID</title>
6a488035
TO
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>
71e5aa5c
ARW
143 <dynamicForeignKey>
144 <idColumn>entity_id</idColumn>
145 <typeColumn>entity_table</typeColumn>
146 <add>4.3</add>
147 </dynamicForeignKey>
6a488035
TO
148 <index>
149 <name>UI_id</name>
150 <fieldName>id</fieldName>
151 <unique>true</unique>
152 <add>4.3</add>
2179c899 153 <drop>4.7</drop>
6a488035
TO
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>
2179c899 170 <drop>4.7</drop>
6a488035
TO
171 </index>
172 <index>
2179c899 173 <name>index_entity_id_entity_table</name>
6a488035 174 <fieldName>entity_id</fieldName>
2179c899 175 <fieldName>entity_table</fieldName>
176 <add>4.7</add>
6a488035
TO
177 </index>
178</table>