Merge pull request #22912 from eileenmcnaughton/group
[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 <paths>
12 <view>civicrm/contact/view/rel?action=view&amp;reset=1&amp;cid=[contact_id_a]&amp;id=[id]</view>
13 <delete>civicrm/contact/view/rel?action=delete&amp;reset=1&amp;cid=[contact_id_a]&amp;id=[id]</delete>
14 </paths>
15
16 <field>
17 <name>id</name>
18 <type>int unsigned</type>
19 <title>Relationship ID</title>
20 <required>true</required>
21 <comment>Relationship ID</comment>
22 <html>
23 <type>Number</type>
24 </html>
25 <add>1.1</add>
26 </field>
27 <primaryKey>
28 <name>id</name>
29 <autoincrement>true</autoincrement>
30 </primaryKey>
31 <field>
32 <name>contact_id_a</name>
33 <type>int unsigned</type>
34 <title>Contact A ID</title>
35 <required>true</required>
36 <comment>id of the first contact</comment>
37 <html>
38 <label>Contact A</label>
39 </html>
40 <add>1.1</add>
41 </field>
42 <foreignKey>
43 <name>contact_id_a</name>
44 <table>civicrm_contact</table>
45 <key>id</key>
46 <add>1.1</add>
47 <onDelete>CASCADE</onDelete>
48 </foreignKey>
49 <field>
50 <name>contact_id_b</name>
51 <type>int unsigned</type>
52 <title>Contact B ID</title>
53 <required>true</required>
54 <comment>id of the second contact</comment>
55 <add>1.1</add>
56 <html>
57 <type>EntityRef</type>
58 <label>Contact B</label>
59 </html>
60 </field>
61 <foreignKey>
62 <name>contact_id_b</name>
63 <table>civicrm_contact</table>
64 <key>id</key>
65 <add>1.1</add>
66 <onDelete>CASCADE</onDelete>
67 </foreignKey>
68 <field>
69 <name>relationship_type_id</name>
70 <type>int unsigned</type>
71 <title>Relationship Type ID</title>
72 <required>true</required>
73 <comment>Type of relationship</comment>
74 <add>1.1</add>
75 <html>
76 <type>Select</type>
77 <label>Relationship Type</label>
78 </html>
79 <pseudoconstant>
80 <table>civicrm_relationship_type</table>
81 <keyColumn>id</keyColumn>
82 <nameColumn>name_a_b</nameColumn>
83 <labelColumn>label_a_b</labelColumn>
84 </pseudoconstant>
85 </field>
86 <foreignKey>
87 <name>relationship_type_id</name>
88 <table>civicrm_relationship_type</table>
89 <key>id</key>
90 <add>1.1</add>
91 <onDelete>CASCADE</onDelete>
92 </foreignKey>
93 <field>
94 <name>start_date</name>
95 <uniqueName>relationship_start_date</uniqueName>
96 <type>date</type>
97 <title>Relationship Start Date</title>
98 <comment>date when the relationship started</comment>
99 <add>1.1</add>
100 <html>
101 <type>Select Date</type>
102 <formatType>activityDate</formatType>
103 </html>
104 </field>
105 <field>
106 <name>end_date</name>
107 <uniqueName>relationship_end_date</uniqueName>
108 <type>date</type>
109 <title>Relationship End Date</title>
110 <comment>date when the relationship ended</comment>
111 <add>1.1</add>
112 <html>
113 <type>Select Date</type>
114 <formatType>activityDate</formatType>
115 </html>
116 </field>
117 <field>
118 <name>is_active</name>
119 <type>boolean</type>
120 <title>Relationship Is Active</title>
121 <default>1</default>
122 <comment>is the relationship active ?</comment>
123 <add>1.1</add>
124 <html>
125 <type>CheckBox</type>
126 </html>
127 </field>
128 <field>
129 <name>description</name>
130 <type>varchar</type>
131 <title>Relationship Description</title>
132 <length>255</length>
133 <comment>Optional verbose description for the relationship.</comment>
134 <add>1.5</add>
135 <html>
136 <type>Text</type>
137 </html>
138 </field>
139 <field>
140 <name>is_permission_a_b</name>
141 <type>int unsigned</type>
142 <title>Contact A has Permission Over Contact B</title>
143 <required>true</required>
144 <default>0</default>
145 <comment>Permission that Contact A has to view/update Contact B</comment>
146 <add>2.1</add>
147 <pseudoconstant>
148 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
149 </pseudoconstant>
150 <html>
151 <type>Radio</type>
152 </html>
153 </field>
154 <field>
155 <name>is_permission_b_a</name>
156 <type>int unsigned</type>
157 <title>Contact B has Permission Over Contact A</title>
158 <required>true</required>
159 <default>0</default>
160 <comment>Permission that Contact B has to view/update Contact A</comment>
161 <add>2.1</add>
162 <pseudoconstant>
163 <callback>CRM_Core_SelectValues::getPermissionedRelationshipOptions</callback>
164 </pseudoconstant>
165 <html>
166 <type>Radio</type>
167 </html>
168 </field>
169 <field>
170 <name>case_id</name>
171 <type>int unsigned</type>
172 <component>CiviCase</component>
173 <title>Case ID</title>
174 <default>NULL</default>
175 <comment>FK to civicrm_case</comment>
176 <html>
177 <label>Case</label>
178 </html>
179 <add>2.2</add>
180 </field>
181 <field>
182 <name>created_date</name>
183 <type>timestamp</type>
184 <comment>Relationship created date.</comment>
185 <required>true</required>
186 <default>CURRENT_TIMESTAMP</default>
187 <add>5.47</add>
188 </field>
189 <field>
190 <name>modified_date</name>
191 <title>Relationship Modified Date</title>
192 <type>timestamp</type>
193 <required>true</required>
194 <comment>Relationship last modified.</comment>
195 <default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
196 <add>5.47</add>
197 <readonly>true</readonly>
198 </field>
199 <foreignKey>
200 <name>case_id</name>
201 <table>civicrm_case</table>
202 <key>id</key>
203 <add>2.2</add>
204 <onDelete>CASCADE</onDelete>
205 </foreignKey>
206 </table>