correct getLatestTDoc for polymorphic families (refs #4279)
correct gettdoc functions for polymorphic documents (refs #4279)
add test for gettdoc functions (refs #4279)