-
- // Our overall intention is to keep the code simple and manageable.
- // If a users wishes to delete a field, we will delete all its options and log entries.
- // Otherwise we have to do conditional queries depending on field status (this complicates things).
-
- global $user;
- $mdb2 = getConnection();
-
- // First make sure that the field is ours so that we can safely delete it.
- $sql = "select team_id from tt_custom_fields where id = $field_id";
- $res = $mdb2->query($sql);
- if (is_a($res, 'PEAR_Error'))
- return false;
- $val = $res->fetchRow();
- if ($user->team_id != $val['team_id'])
- return false;
-
- // Mark log entries as deleted.
- $sql = "update tt_custom_field_log set status = NULL where field_id = $field_id";
+
+ // Our overall intention is to keep the code simple and manageable.
+ // If a user wishes to delete a field, we will delete all its options and log entries.
+ // Otherwise we have to do conditional queries depending on field status (this complicates things).
+
+ global $user;
+ $mdb2 = getConnection();
+
+ // First make sure that the field is ours so that we can safely delete it.
+ $sql = "select team_id from tt_custom_fields where id = $field_id";
+ $res = $mdb2->query($sql);
+ if (is_a($res, 'PEAR_Error'))
+ return false;
+ $val = $res->fetchRow();
+ if ($user->team_id != $val['team_id'])
+ return false;
+
+ // Mark log entries as deleted.
+ $sql = "update tt_custom_field_log set status = NULL where field_id = $field_id";