-
- // The insertField inserts a custom field for team.
- static function insertField($field_name, $field_type, $required) {
-
- global $user;
-
- $mdb2 = getConnection();
-
- $sql = "insert into tt_custom_fields (team_id, type, label, required, status) values($user->team_id, $field_type, ".$mdb2->quote($field_name).", $required, 1)";
+
+ // The insertField inserts a custom field for group.
+ static function insertField($field_name, $entity_type, $field_type, $required) {
+ global $user;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
+ $sql = "insert into tt_custom_fields (group_id, org_id, entity_type, type, label, required, status)".
+ " values($group_id, $org_id, $entity_type, $field_type, ".$mdb2->quote($field_name).", $required, 1)";