Skip to content

Commit

Permalink
Merge branch 'bug/15341-color-switches-yesno-wrong'
Browse files Browse the repository at this point in the history
  • Loading branch information
Trischi80 committed Feb 4, 2020
2 parents 1891591 + 6e8f23d commit e62a6ff
Show file tree
Hide file tree
Showing 37 changed files with 2,762 additions and 2,842 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
35 changes: 18 additions & 17 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 @@ -288,14 +288,15 @@ protected function getEncryptionSwitch()
'classes' => [],
'options' => [
'option' => [
[
'text' => gT("On"),
'value' => 'Y'
],
[
'text' => gT("Off"),
'value' => 'N'
],
[
'text' => gT("On"),
'value' => 'Y'
],

]
],
],
Expand All @@ -312,19 +313,19 @@ protected function getSaveAsDefaultSwitch()
'formElementName' => false,
'formElementHelp' => gT('All attribute values for this question type will be saved as default'),
'inputtype' => 'switch',
'formElementValue' => '',
'formElementValue' => ($this->oQuestion->same_default == 1) ? 'Y' : 'N',
'formElementOptions' => [
'classes' => [],
'options' => [
'option' => [
[
'text' => gT("On"),
'value' => 'Y'
],
[
'text' => gT("Off"),
'value' => 'N'
],
[
'text' => gT("On"),
'value' => 'Y'
],
]
],
],
Expand All @@ -345,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
1 change: 1 addition & 0 deletions application/models/QuestionCreate.php
Expand Up @@ -22,6 +22,7 @@ public static function getInstance($iSurveyId, $type)
'type' => $questionType,
'other' => 'N',
'mandatory' => 'N',
'same_default' => 1,
'relevance' => 1,
'group_name' => '',
'modulename' => '',
Expand Down
Expand Up @@ -66,8 +66,12 @@
),
'onLabel'=>gT('Yes'),
'offLabel'=>gT('No'),
/*
'onColor'=> 'warning',
'offColor'=> 'primary'
*/
'onColor'=> 'primary',
'offColor'=> 'warning'
)
);
?>
Expand Down
Expand Up @@ -282,14 +282,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -350,14 +350,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -350,14 +350,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -417,14 +417,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -298,14 +298,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -427,14 +427,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -381,14 +381,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -524,14 +524,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -441,14 +441,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -381,14 +381,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
Expand Up @@ -166,14 +166,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
8 changes: 4 additions & 4 deletions application/views/survey/questions/answer/date/config.xml
Expand Up @@ -310,14 +310,14 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>
</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down
9 changes: 5 additions & 4 deletions application/views/survey/questions/answer/gender/config.xml
Expand Up @@ -258,14 +258,15 @@
<inputtype>switch</inputtype>
<sortorder>101</sortorder>
<options>
<option>
<value>1</value>
<text>Yes</text>
</option>
<option>
<value>0</value>
<text>No</text>
</option>
<option>
<value>1</value>
<text>Yes</text>
</option>

</options>
<help>Display a chart in the statistics?</help>
<caption>Display chart</caption>
Expand Down

0 comments on commit e62a6ff

Please sign in to comment.