Skip to content
Snippets Groups Projects
Commit 25f31278 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

pass questions_data as JSON string and fix invalid values, fixes #3526, #3691, #3460

Closes #3526, #3691, and #3460

Merge request studip/studip!2771
parent 53e7b2b1
No related branches found
No related tags found
No related merge requests found
......@@ -148,7 +148,7 @@ class QuestionnaireController extends AuthenticatedController
: null;
$this->questionnaire['user_id'] = User::findCurrent()->id;
$questions_data = Request::getArray('questions_data');
$questions_data = json_decode(Request::get('questions_data'), true);
$questions = [];
foreach ($questions_data as $index => $question_data) {
$class = $question_data['questiontype'];
......
<?php
class FixQuestionnaireQuestiondata extends Migration
{
public function description()
{
return 'fix invalid boolean values in questionnaire_questions';
}
public function up()
{
DBManager::get()->exec("
UPDATE questionnaire_questions
SET questiondata = REPLACE(questiondata, ':\"false\"', ':false')
WHERE questiondata LIKE '%:\"false\"%'
");
}
}
......@@ -86,7 +86,7 @@ const Questionnaire = {
}
$.post(STUDIP.URLHelper.getURL('dispatch.php/questionnaire/store/' + (this.data.id || '')), {
questionnaire: data,
questions_data: questions,
questions_data: JSON.stringify(questions),
range_type: this.range_type,
range_id: this.range_id
}).done(() => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment