Skip to content

Commit

Permalink
Fixed issue #13553: Default value not copied when copy question
Browse files Browse the repository at this point in the history
Created "Copy default answers" switch option on Copy question page
  • Loading branch information
dominikvitt committed Jun 6, 2018
1 parent 3283f3e commit fd1bda4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions application/controllers/admin/database.php
Expand Up @@ -1353,6 +1353,18 @@ private function actionInsertCopyQuestion($iSurveyID)
));
}
}
if (returnGlobal('copydefaultanswers') == 1) {
$aDefaultAnswers = DefaultValue::model()->findAll("qid=:qid", array("qid"=>returnGlobal('oldqid')));
foreach ($aDefaultAnswers as $qr1) {
DefaultValue::model()->insertRecords(array(
'qid' => $this->iQuestionID,
'scale_id' => $qr1['scale_id'],
'language' => $qr1['language'],
'specialtype' => $qr1['specialtype'],
'defaultvalue' => $qr1['defaultvalue']
));
}
}

/**
* Copy attribute
Expand Down
12 changes: 12 additions & 0 deletions application/views/admin/survey/Question/editQuestion_view.php
Expand Up @@ -129,6 +129,18 @@
?>
</div>
</div>
<div class="form-group">
<label class=" control-label" for='copydefaultanswers'><?php eT("Copy default answers?"); ?></label>
<div class="">
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'copydefaultanswers',
'id' => 'copydefaultanswers',
'value' => 'Y',
'onLabel' => gT('Yes'),
'offLabel' => gT('No')));
?>
</div>
</div>
<div class="form-group">
<label class=" control-label" for='copyattributes'><?php eT("Copy advanced settings?"); ?></label>
<div class="">
Expand Down

0 comments on commit fd1bda4

Please sign in to comment.