/**
  * Returns the date to use to calculate the ValidUntil if any
  *
  * @param string $fieldSource Source for field from round
  * @param string $fieldName Name from round
  * @param int $prevRoundId Id from round
  * @param \Gems_Tracker_Token $token
  * @param \Gems_Tracker_RespondentTrack $respTrack
  * @param \MUtil_Date $validFrom The calculated new valid from value
  * @return \MUtil_Date date time or null
  */
 protected function getValidUntilDate($fieldSource, $fieldName, $prevRoundId, \Gems_Tracker_Token $token, \Gems_Tracker_RespondentTrack $respTrack, $validFrom)
 {
     $date = null;
     switch ($fieldSource) {
         case parent::ANSWER_TABLE:
             if ($prev = $respTrack->getActiveRoundToken($prevRoundId, $token)) {
                 $date = $prev->getAnswerDateTime($fieldName);
             }
             break;
         case parent::TOKEN_TABLE:
             if ($prev = $respTrack->getActiveRoundToken($prevRoundId, $token)) {
                 if (false !== $validFrom && $prev === $token && $fieldName == 'gto_valid_from') {
                     $date = $validFrom;
                 } else {
                     $date = $prev->getDateTime($fieldName);
                 }
             }
             break;
         case parent::APPOINTMENT_TABLE:
         case parent::RESPONDENT_TRACK_TABLE:
             $date = $respTrack->getDate($fieldName);
             break;
     }
     return $date;
 }