CRM-13857
[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
TO
12 <type>int unsigned</type>
13 <length>10</length>
3c7d2158 14 <required>true</required>
15 <comment></comment>
6a488035 16 <add>4.3</add>
3c7d2158 17 </field>
18 <primaryKey>
19 <name>id</name>
20 <autoincrement>true</autoincrement>
21 </primaryKey>
6a488035
TO
22 <field>
23 <name>created_date</name>
24 <type>timestamp</type>
3c7d2158 25 <required>true</required>
26 <default>CURRENT_TIMESTAMP</default>
6a488035
TO
27 <comment>Date and time the item was created</comment>
28 <add>4.3</add>
3c7d2158 29 </field>
6a488035
TO
30 <field>
31 <name>transaction_date</name>
32 <type>datetime</type>
3c7d2158 33 <required>true</required>
6a488035
TO
34 <comment>Date and time of the source transaction</comment>
35 <add>4.3</add>
3c7d2158 36 </field>
6a488035
TO
37 <field>
38 <name>contact_id</name>
39 <type>int unsigned</type>
3c7d2158 40 <required>true</required>
6a488035
TO
41 <export>true</export>
42 <comment>FK to Contact ID of contact the item is from</comment>
43 <add>4.3</add>
44 </field>
45 <foreignKey>
46 <name>contact_id</name>
47 <table>civicrm_contact</table>
48 <key>id</key>
49 <onDelete>CASCADE</onDelete>
50 <add>4.3</add>
51 </foreignKey>
52 <field>
53 <name>description</name>
54 <type>varchar</type>
55 <length>255</length>
56 <comment>Human readable description of this item, to ease display without lookup of source item.</comment>
57 <add>4.3</add>
58 </field>
3c7d2158 59 <field>
60 <name>amount</name>
6a488035
TO
61 <title>Amount</title>
62 <type>decimal</type>
63 <default>0</default>
3c7d2158 64 <required>true</required>
6a488035
TO
65 <headerPattern>/unit?.?amoun/i</headerPattern>
66 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
3c7d2158 67 <comment>Total amount of this item</comment>
68 <add>4.3</add>
6a488035 69 </field>
3c7d2158 70 <field>
6a488035
TO
71 <name>currency</name>
72 <export>true</export>
73 <type>varchar</type>
74 <length>3</length>
75 <comment>Currency for the amount</comment>
76 <add>4.3</add>
bd44e0df
AS
77 <pseudoconstant>
78 <table>civicrm_currency</table>
79 <keyColumn>name</keyColumn>
a38a89fc
CW
80 <labelColumn>full_name</labelColumn>
81 <nameColumn>numeric_code</nameColumn>
bd44e0df 82 </pseudoconstant>
6a488035
TO
83 </field>
84 <field>
85 <name>financial_account_id</name>
86 <type>int unsigned</type>
87 <comment>FK to civicrm_financial_account</comment>
88 <add>4.3</add>
7611ae71
AS
89 <pseudoconstant>
90 <table>civicrm_financial_account</table>
91 <keyColumn>id</keyColumn>
92 <labelColumn>name</labelColumn>
93 </pseudoconstant>
6a488035
TO
94 </field>
95 <foreignKey>
96 <name>financial_account_id</name>
97 <table>civicrm_financial_account</table>
98 <key>id</key>
99 <add>4.3</add>
100 </foreignKey>
101 <field>
102 <name>status_id</name>
103 <export>true</export>
104 <type>int unsigned</type>
105 <comment>Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)</comment>
106 <add>4.3</add>
7611ae71
AS
107 <pseudoconstant>
108 <optionGroupName>financial_item_status</optionGroupName>
109 </pseudoconstant>
6a488035
TO
110 </field>
111 <field>
112 <name>entity_table</name>
113 <type>varchar</type>
114 <length>64</length>
115 <comment>The table providing the source of this item such as civicrm_line_item</comment>
116 <add>4.3</add>
117 </field>
118 <field>
119 <name>entity_id</name>
120 <type>int unsigned</type>
121 <comment>The specific source item that is responsible for the creation of this financial_item</comment>
122 <add>4.3</add>
123 </field>
71e5aa5c
ARW
124 <dynamicForeignKey>
125 <idColumn>entity_id</idColumn>
126 <typeColumn>entity_table</typeColumn>
127 <add>4.3</add>
128 </dynamicForeignKey>
6a488035
TO
129 <index>
130 <name>UI_id</name>
131 <fieldName>id</fieldName>
132 <unique>true</unique>
133 <add>4.3</add>
134 </index>
135 <index>
136 <name>IX_created_date</name>
137 <fieldName>created_date</fieldName>
138 <add>4.3</add>
139 </index>
140 <index>
141 <name>IX_transaction_date</name>
142 <fieldName>transaction_date</fieldName>
143 <add>4.3</add>
144 </index>
145 <index>
146 <name>IX_entity</name>
147 <fieldName>entity_table</fieldName>
148 <fieldName>entity_id</fieldName>
149 <add>4.3</add>
150 </index>
151 <index>
152 <name>IX_entity</name>
153 <fieldName>entity_table</fieldName>
154 <fieldName>entity_id</fieldName>
155 <add>4.3</add>
156 </index>
157</table>