Merge pull request #19086 from agileware/CIVICRM-1617
[civicrm-core.git] / xml / schema / Contact / Relationship.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Contact</base>
5 <class>Relationship</class>
6 <name>civicrm_relationship</name>
7 <comment>Relationship between any 2 types of contacts.</comment>
8 <add>1.1</add>
9 <log>true</log>
10 <icon>fa-handshake-o</icon>
11 <field>
12 <name>id</name>
13 <type>int unsigned</type>
14 <title>Relationship ID</title>
15 <required>true</required>
16 <comment>Relationship ID</comment>
17 <add>1.1</add>
18 </field>
19 <primaryKey>
20 <name>id</name>
21 <autoincrement>true</autoincrement>
22 </primaryKey>
23 <field>
24 <name>contact_id_a</name>
25 <type>int unsigned</type>
26 <title>Contact A</title>
27 <required>true</required>
28 <comment>id of the first contact</comment>
29 <add>1.1</add>
30 </field>
31 <foreignKey>
32 <name>contact_id_a</name>
33 <table>civicrm_contact</table>
34 <key>id</key>
35 <add>1.1</add>
36 <onDelete>CASCADE</onDelete>
37 </foreignKey>
38 <field>
39 <name>contact_id_b</name>
40 <type>int unsigned</type>
41 <title>Contact B</title>
42 <required>true</required>
43 <comment>id of the second contact</comment>
44 <add>1.1</add>
45 <html>
46 <type>EntityRef</type>
47 </html>
48 </field>
49 <foreignKey>
50 <name>contact_id_b</name>
51 <table>civicrm_contact</table>
52 <key>id</key>
53 <add>1.1</add>
54 <onDelete>CASCADE</onDelete>
55 </foreignKey>
56 <field>
57 <name>relationship_type_id</name>
58 <type>int unsigned</type>
59 <title>Relationship Type</title>
60 <required>true</required>
61 <comment>id of the relationship</comment>
62 <add>1.1</add>
63 <html>
64 <type>Select</type>
65 </html>
66 </field>
67 <foreignKey>
68 <name>relationship_type_id</name>
69 <table>civicrm_relationship_type</table>
70 <key>id</key>
71 <add>1.1</add>
72 <onDelete>CASCADE</onDelete>
73 </foreignKey>
74 <field>
75 <name>start_date</name>
76 <uniqueName>relationship_start_date</uniqueName>
77 <type>date</type>
78 <title>Relationship Start Date</title>
79 <comment>date when the relationship started</comment>
80 <add>1.1</add>
81 <html>
82 <type>Select Date</type>
83 <formatType>activityDate</formatType>
84 </html>
85 </field>
86 <field>
87 <name>end_date</name>
88 <uniqueName>relationship_end_date</uniqueName>
89 <type>date</type>
90 <title>Relationship End Date</title>
91 <comment>date when the relationship ended</comment>
92 <add>1.1</add>
93 <html>
94 <type>Select Date</type>
95 <formatType>activityDate</formatType>
96 </html>
97 </field>
98 <field>
99 <name>is_active</name>
100 <type>boolean</type>
101 <title>Relationship Is Active</title>
102 <default>1</default>
103 <comment>is the relationship active ?</comment>
104 <add>1.1</add>
105 <html>
106 <type>CheckBox</type>
107 </html>
108 </field>
109 <field>
110 <name>description</name>
111 <type>varchar</type>
112 <title>Relationship Description</title>
113 <length>255</length>
114 <comment>Optional verbose description for the relationship.</comment>
115 <add>1.5</add>
116 <html>
117 <type>Text</type>
118 </html>
119 </field>
120 <field>
121 <name>is_permission_a_b</name>
122 <type>int unsigned</type>
123 <title>Contact A has Permission Over Contact B</title>
124 <required>true</required>
125 <default>0</default>
126 <comment>Permission that Contact A has to view/update Contact B</comment>
127 <add>2.1</add>
128 <pseudoconstant>
129 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
130 </pseudoconstant>
131 <html>
132 <type>Radio</type>
133 </html>
134 </field>
135 <field>
136 <name>is_permission_b_a</name>
137 <type>int unsigned</type>
138 <title>Contact B has Permission Over Contact A</title>
139 <required>true</required>
140 <default>0</default>
141 <comment>Permission that Contact B has to view/update Contact A</comment>
142 <add>2.1</add>
143 <pseudoconstant>
144 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
145 </pseudoconstant>
146 <html>
147 <type>Radio</type>
148 </html>
149 </field>
150 <field>
151 <name>case_id</name>
152 <type>int unsigned</type>
153 <title>Relationship Case</title>
154 <default>NULL</default>
155 <comment>FK to civicrm_case</comment>
156 <add>2.2</add>
157 </field>
158 <foreignKey>
159 <name>case_id</name>
160 <table>civicrm_case</table>
161 <key>id</key>
162 <add>2.2</add>
163 <onDelete>CASCADE</onDelete>
164 </foreignKey>
165 </table>