Refactored out of CRM_Core_PseudoConstant: ufGroup(), currencySymbols(). CRM-12464
[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 <length>10</length>
14 <required>true</required>
15 <comment></comment>
16 <add>4.3</add>
17 </field>
18 <primaryKey>
19 <name>id</name>
20 <autoincrement>true</autoincrement>
21 </primaryKey>
22 <field>
23 <name>created_date</name>
24 <type>timestamp</type>
25 <required>true</required>
26 <default>CURRENT_TIMESTAMP</default>
27 <comment>Date and time the item was created</comment>
28 <add>4.3</add>
29 </field>
30 <field>
31 <name>transaction_date</name>
32 <type>datetime</type>
33 <required>true</required>
34 <comment>Date and time of the source transaction</comment>
35 <add>4.3</add>
36 </field>
37 <field>
38 <name>contact_id</name>
39 <type>int unsigned</type>
40 <required>true</required>
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>
59 <field>
60 <name>amount</name>
61 <title>Amount</title>
62 <type>decimal</type>
63 <default>0</default>
64 <required>true</required>
65 <headerPattern>/unit?.?amoun/i</headerPattern>
66 <dataPattern>/^\d+(\.\d{2})?$/</dataPattern>
67 <comment>Total amount of this item</comment>
68 <add>4.3</add>
69 </field>
70 <field>
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>
77 <pseudoconstant>
78 <table>civicrm_currency</table>
79 <keyColumn>name</keyColumn>
80 <labelColumn>symbol</labelColumn>
81 </pseudoconstant>
82 </field>
83 <field>
84 <name>financial_account_id</name>
85 <type>int unsigned</type>
86 <comment>FK to civicrm_financial_account</comment>
87 <add>4.3</add>
88 </field>
89 <foreignKey>
90 <name>financial_account_id</name>
91 <table>civicrm_financial_account</table>
92 <key>id</key>
93 <add>4.3</add>
94 </foreignKey>
95 <field>
96 <name>status_id</name>
97 <export>true</export>
98 <type>int unsigned</type>
99 <comment>Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)</comment>
100 <add>4.3</add>
101 </field>
102 <field>
103 <name>entity_table</name>
104 <type>varchar</type>
105 <length>64</length>
106 <comment>The table providing the source of this item such as civicrm_line_item</comment>
107 <add>4.3</add>
108 </field>
109 <field>
110 <name>entity_id</name>
111 <type>int unsigned</type>
112 <comment>The specific source item that is responsible for the creation of this financial_item</comment>
113 <add>4.3</add>
114 </field>
115 <dynamicForeignKey>
116 <idColumn>entity_id</idColumn>
117 <typeColumn>entity_table</typeColumn>
118 <add>4.3</add>
119 </dynamicForeignKey>
120 <index>
121 <name>UI_id</name>
122 <fieldName>id</fieldName>
123 <unique>true</unique>
124 <add>4.3</add>
125 </index>
126 <index>
127 <name>IX_created_date</name>
128 <fieldName>created_date</fieldName>
129 <add>4.3</add>
130 </index>
131 <index>
132 <name>IX_transaction_date</name>
133 <fieldName>transaction_date</fieldName>
134 <add>4.3</add>
135 </index>
136 <index>
137 <name>IX_entity</name>
138 <fieldName>entity_table</fieldName>
139 <fieldName>entity_id</fieldName>
140 <add>4.3</add>
141 </index>
142 <index>
143 <name>IX_entity</name>
144 <fieldName>entity_table</fieldName>
145 <fieldName>entity_id</fieldName>
146 <add>4.3</add>
147 </index>
148 </table>