public function validateRowValues(array $row, $key)
    {
        $row = parent::validateRowValues($row, $key);

        $token = $this->loader->getTracker()->getToken($row['token'] ? $row['token'] : 'emptytoken');

        if ($token->exists) {
            // If token is not completed we can use it, otherwise it depends on the settings
            if ($token->isCompleted()) {
                switch ($this->getTokenCompleted()) {
                    case self::TOKEN_SKIP:
                        return false;

                    case self::TOKEN_ERROR:
                        $this->_addErrors(sprintf(
                                $this->_('Token %s is completed.'),
                                $token->getTokenId()
                                ), $key);
                        break;

                    // Intentional fall-through,
                    // other case are handled in SaveAnswerTask
                }
            }
        } else {
            switch ($this->getNoToken()) {
                case self::TOKEN_SKIP:
                    return false;

                case self::TOKEN_ERROR:
                    $this->_addErrors($this->getNoTokenError($row, $key), $key);
                    break;

                default:
                    $respTrack = $this->findRespondentTrackFor($row);

                    if ($respTrack) {
                        $row['resp_track_id'] == $respTrack;
                    } else {
                        $this->_addErrors(sprintf(
                                $this->_('No track for inserting found for %s.'),
                                implode(" / ", $row)
                                ), $key);
                    }
            }
        }

        return $row;
    }
public function validateRowValues(array $row, $key)
    {
        $row = parent::validateRowValues($row, $key);

        $token = $this->loader->getTracker()->getToken($row['token'] ? $row['token'] : 'emptytoken');

        if ($token->exists) {
            // If token is not completed we can use it, otherwise it depends on the settings
            if ($token->isCompleted()) {
                switch ($this->getTokenCompleted()) {
                    case self::TOKEN_SKIP:
                        return false;

                    case self::TOKEN_ERROR:
                        $this->_addErrors(sprintf(
                                $this->_('Token %s is completed.'),
                                $token->getTokenId()
                                ), $key);
                        break;

                    // Intentional fall-through,
                    // other case are handled in SaveAnswerTask
                }
            }
        } else {
            switch ($this->getNoToken()) {
                case self::TOKEN_SKIP:
                    return false;

                case self::TOKEN_ERROR:
                    $this->_addErrors($this->getNoTokenError($row, $key), $key);
                    break;

                default:
                    $respTrack = $this->findRespondentTrackFor($row);

                    if ($respTrack) {
                        $row['resp_track_id'] == $respTrack;
                    } else {
                        $this->_addErrors(sprintf(
                                $this->_('No track for inserting found for %s.'),
                                implode(" / ", $row)
                                ), $key);
                    }
            }
        }

        return $row;
    }
public function validateRowValues ( array $ row , $ key ) { $ row = parent :: validateRowValues ( $ row , $ key ) ; $ token = $ this -> loader -> getTracker ( ) -> getToken ( $ row [ 'token' ] ? $ row [ 'token' ] : 'emptytoken' ) ; if ( $ token -> exists ) { // If token is not completed we can use it, otherwise it depends on the settings if ( $ token -> isCompleted ( ) ) { switch ( $ this -> getTokenCompleted ( ) ) { case self :: TOKEN_SKIP : return false ; case self :: TOKEN_ERROR : $ this -> _addErrors ( sprintf ( $ this -> _ ( 'Token %s is completed.' ) , $ token -> getTokenId ( ) ) , $ key ) ; break ; // Intentional fall-through, // other case are handled in SaveAnswerTask } } } else { switch ( $ this -> getNoToken ( ) ) { case self :: TOKEN_SKIP : return false ; case self :: TOKEN_ERROR : $ this -> _addErrors ( $ this -> getNoTokenError ( $ row , $ key ) , $ key ) ; break ; default : $ respTrack = $ this -> findRespondentTrackFor ( $ row ) ; if ( $ respTrack ) { $ row [ 'resp_track_id' ] == $ respTrack ; } else { $ this -> _addErrors ( sprintf ( $ this -> _ ( 'No track for inserting found for %s.' ) , implode ( " / " , $ row ) ) , $ key ) ; } } } return $ row ; }
Validate the data against the target form

@param array $row
@param scalar $key
@return mixed Row array or false when errors occurred
Validate the data against the target form