protected function fixTokenAttributeDescriptions($sourceSurveyId)
    {
        $lsDb = $this->getSourceDatabase();

        $fieldData = array();
        foreach($this->_attributeMap as $fieldName)
        {
            // Only add the attribute fields
            if (substr($fieldName, 0, 10) == 'attribute_') {
                $fieldData[$fieldName] = array(
                    'description' => $fieldName,
                    'mandatory'   => 'N',
                    'show_register'=> 'N',
                    'cpdbmap' => ''
                );
            }
        }

        // We always have fields, so no need to check for empty. Just json_encode the data
        $fields = array(
            $this->_attributeDescriptionsField => json_encode($fieldData)
                );

        return (boolean) $lsDb->update($this->_getSurveysTableName(), $fields, $lsDb->quoteInto('sid = ?', $sourceSurveyId));
    }
protected function fixTokenAttributeDescriptions($sourceSurveyId)
    {
        $lsDb = $this->getSourceDatabase();

        $fieldData = array();
        foreach($this->_attributeMap as $fieldName)
        {
            // Only add the attribute fields
            if (substr($fieldName, 0, 10) == 'attribute_') {
                $fieldData[$fieldName] = array(
                    'description' => $fieldName,
                    'mandatory'   => 'N',
                    'show_register'=> 'N',
                    'cpdbmap' => ''
                );
            }
        }

        // We always have fields, so no need to check for empty. Just json_encode the data
        $fields = array(
            $this->_attributeDescriptionsField => json_encode($fieldData)
                );

        return (boolean) $lsDb->update($this->_getSurveysTableName(), $fields, $lsDb->quoteInto('sid = ?', $sourceSurveyId));
    }
protected function fixTokenAttributeDescriptions ( $ sourceSurveyId ) { $ lsDb = $ this -> getSourceDatabase ( ) ; $ fieldData = array ( ) ; foreach ( $ this -> _attributeMap as $ fieldName ) { // Only add the attribute fields if ( substr ( $ fieldName , 0 , 10 ) == 'attribute_' ) { $ fieldData [ $ fieldName ] = array ( 'description' => $ fieldName , 'mandatory' => 'N' , 'show_register' => 'N' , 'cpdbmap' => '' ) ; } } // We always have fields, so no need to check for empty. Just json_encode the data $ fields = array ( $ this -> _attributeDescriptionsField => json_encode ( $ fieldData ) ) ; return ( boolean ) $ lsDb -> update ( $ this -> _getSurveysTableName ( ) , $ fields , $ lsDb -> quoteInto ( 'sid = ?' , $ sourceSurveyId ) ) ; }
Fix the tokenattribute descriptions

When new token attributes are added, make sure the attributedescriptions field
in the surveys table is updated to prevent problems when using these fields
in LimeSurvey. For example by referencing them on screen.

@param int $sourceSurveyId
@return boolean
Fix the tokenattribute descriptions