Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Limesurvey 5.6.47 lime_questions does not have column "language"

  • cgrewal94
  • cgrewal94's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 months 3 days ago #253572 by cgrewal94
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.47
Own server or LimeSurvey hosting: Own server
Survey theme/template: Custom
==================
Hi there,

We have a custom plugin that stores the count of answer options in  multi short text. It works fine in limesurvey 3.8 but in limesurvey 5 we encounter the error "Table lime_questions does not have a column name language".

Is there a workaround for this? I have attached an image of the error message.

Thanks!

Please Log in to join the conversation.

  • cgrewal94
  • cgrewal94's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 months 3 days ago #253573 by cgrewal94
I believe I have found the function that has the issue. What things would I have to update in this function?

At a glance I can see that the "question" column does not exist in lime 5 as well.
Code:
private function getSubQuestionsByQuestionId($qid, $language = "en") { $aBasicDestinationFields = \Question::model()->tableSchema->columnNames; array_push($aBasicDestinationFields, 'available_answers'); array_push($aBasicDestinationFields, 'subquestions'); array_push($aBasicDestinationFields, 'attributes'); array_push($aBasicDestinationFields, 'attributes_lang'); array_push($aBasicDestinationFields, 'answeroptions'); array_push($aBasicDestinationFields, 'defaultvalue'); if (!empty($aQuestionSettings)) { $aQuestionSettings = array_intersect($aQuestionSettings, $aBasicDestinationFields); } else { $aQuestionSettings = $aBasicDestinationFields; } if (empty($aQuestionSettings)) { return array('status' => 'No valid Data'); } $aResult = ; foreach ($aQuestionSettings as $sPropertyName) { if ($sPropertyName == 'available_answers' || $sPropertyName == 'subquestions') { $oSubQuestions = \Question::model()->findAllByAttributes(array( 'parent_qid' => $qid, 'language' => $language ), array('order' => 'title')); if (count($oSubQuestions) > 0) { $aData = array(); foreach ($oSubQuestions as $oSubQuestion) { if ($sPropertyName == 'available_answers') { $aData[$oSubQuestion['title']] = $oSubQuestion['question']; } else { $aData[$oSubQuestion['qid']]['title'] = $oSubQuestion['title']; $aData[$oSubQuestion['qid']]['question'] = $oSubQuestion['question']; $aData[$oSubQuestion['qid']]['scale_id'] = $oSubQuestion['scale_id']; } } $aResult[$sPropertyName] = $aData; } else { $aResult[$sPropertyName] = 'No available answers'; } } } return $aResult["subquestions"] ?? ; }

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 months 2 days ago #253663 by DenisChenu
No workaround : you have to rewrite your plugin.
Or check version and do your request without language.

I move it to development section

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose