public static function getById($field_id, $lab_config_id, $tabletype) { # Returns a custom field entry # $tabletype = 1 for specimen custom field # $tabletype = 2 for patient custom field # $tabletype = 3 for labtitle custom field $table_name = ""; if ($tabletype == 1) { $table_name = "specimen_custom_field"; } else { if ($tabletype == 2) { $table_name = "patient_custom_field"; } else { if ($tabletype == 3) { $table_name = "labtitle_custom_field"; } else { return null; } } } $query_string = "SELECT * FROM {$table_name} " . "WHERE id={$field_id}"; $saved_db = DbUtil::switchToLabConfig($lab_config_id); $record = query_associative_one($query_string); DbUtil::switchRestore($saved_db); return CustomField::getObject($record); }