Skip to content

Commit

Permalink
Fixed issue #15341: color switches yes/no on/off are wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
Trischi80 committed Feb 4, 2020
1 parent f371c4f commit 6e8f23d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
18 changes: 18 additions & 0 deletions application/controllers/admin/questionedit.php
Expand Up @@ -788,6 +788,14 @@ private function storeNewQuestionData($aQuestionData = null, $subquestion = fals
App()->getConfig('preselectquestiontype')
);

if(isset($aQuestionData['same_default'])){
if($aQuestionData['same_default'] == 1){
$aQuestionData['same_default'] =0;
}else{
$aQuestionData['same_default'] =1;
}
}

$aQuestionData = array_merge([
'sid' => $iSurveyId,
'gid' => App()->request->getParam('gid'),
Expand Down Expand Up @@ -857,6 +865,16 @@ private function storeNewQuestionData($aQuestionData = null, $subquestion = fals
*/
private function updateQuestionData(&$oQuestion, $aQuestionData)
{
//todo something wrong in frontend ...

if(isset($aQuestionData['same_default'])){
if($aQuestionData['same_default'] == 1){
$aQuestionData['same_default'] =0;
}else{
$aQuestionData['same_default'] =1;
}
}

$oQuestion->setAttributes($aQuestionData, false);
if ($oQuestion == null) {
throw new LSJsonException(
Expand Down
16 changes: 8 additions & 8 deletions application/models/QuestionBaseDataSet.php
Expand Up @@ -229,14 +229,14 @@ protected function getOtherSwitch()
'classes' => [],
'options' => [
'option' => [
[
'text' => gT("On"),
'value' => 'Y'
],
[
'text' => gT("Off"),
'value' => 'N'
],
[
'text' => gT("On"),
'value' => 'Y'
],
]
],
],
Expand Down Expand Up @@ -346,14 +346,14 @@ protected function getClearDefaultSwitch()
'classes' => [],
'options' => [
'option' => [
[
'text' => gT("On"),
'value' => 'Y'
],
[
'text' => gT("Off"),
'value' => 'N'
],
[
'text' => gT("On"),
'value' => 'Y'
],
]
],
],
Expand Down

0 comments on commit 6e8f23d

Please sign in to comment.