protected function _updateGemsSurveyExists(array $surveyorSids, $userId)
    {
        $sqlWhere = 'gsu_id_source = ' . $this->_gemsDb->quote($this->getId()) . '
                AND (gsu_status IS NULL OR gsu_active = 1 OR gsu_surveyor_active = 1)
                AND gsu_surveyor_id NOT IN (' . implode(', ', $surveyorSids) . ')';

        // Fixed values
        $data['gsu_active']          = 0;
        $data['gsu_surveyor_active'] = 0;
        $data['gsu_status']          = 'Survey was removed from source.';
        $data['gsu_changed']         = new \MUtil_Db_Expr_CurrentTimestamp();
        $data['gsu_changed_by']      = $userId;

        $this->_gemsDb->update('gems__surveys', $data, $sqlWhere);

        return $this->_gemsDb->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE ' . $sqlWhere);
    }
protected function _updateGemsSurveyExists(array $surveyorSids, $userId)
    {
        $sqlWhere = 'gsu_id_source = ' . $this->_gemsDb->quote($this->getId()) . '
                AND (gsu_status IS NULL OR gsu_active = 1 OR gsu_surveyor_active = 1)
                AND gsu_surveyor_id NOT IN (' . implode(', ', $surveyorSids) . ')';

        // Fixed values
        $data['gsu_active']          = 0;
        $data['gsu_surveyor_active'] = 0;
        $data['gsu_status']          = 'Survey was removed from source.';
        $data['gsu_changed']         = new \MUtil_Db_Expr_CurrentTimestamp();
        $data['gsu_changed_by']      = $userId;

        $this->_gemsDb->update('gems__surveys', $data, $sqlWhere);

        return $this->_gemsDb->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE ' . $sqlWhere);
    }
protected function _updateGemsSurveyExists ( array $ surveyorSids , $ userId ) { $ sqlWhere = 'gsu_id_source = ' . $ this -> _gemsDb -> quote ( $ this -> getId ( ) ) . '
                AND (gsu_status IS NULL OR gsu_active = 1 OR gsu_surveyor_active = 1)
                AND gsu_surveyor_id NOT IN (' . implode ( ', ' , $ surveyorSids ) . ')' ; // Fixed values $ data [ 'gsu_active' ] = 0 ; $ data [ 'gsu_surveyor_active' ] = 0 ; $ data [ 'gsu_status' ] = 'Survey was removed from source.' ; $ data [ 'gsu_changed' ] = new \ MUtil_Db_Expr_CurrentTimestamp ( ) ; $ data [ 'gsu_changed_by' ] = $ userId ; $ this -> _gemsDb -> update ( 'gems__surveys' , $ data , $ sqlWhere ) ; return $ this -> _gemsDb -> fetchPairs ( 'SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE ' . $ sqlWhere ) ; }
This helper function updates the surveys in the gems_surveys table that
no longer exist in in the source and returns a list of their names.

@param array $surveyorSids The gsu_surveyor_id's that ARE in the source
@param int $userId   Id of the user who takes the action (for logging)
@return array The names of the surveys that no longer exist
This helper function updates the surveys in the gems_surveys table that no longer exist in in the source and returns a list of their names .