Skip to content

Commit

Permalink
Fixed issue #13598: Missing filter when selecting parent survey group
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikvitt committed May 25, 2018
1 parent 0abd142 commit fa23659
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions application/models/SurveysGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,13 @@ public function getNextOrderPosition()
return count($oSurveysGroups) + 1;
}

public function getParentGroupOptions()
public function getParentGroupOptions($gsid = null)
{
$oSurveysGroups = SurveysGroups::model()->findAll();
if (!empty($gsid)){
$oSurveysGroups = SurveysGroups::model()->findAll('gsid != :gsid', array(':gsid' => $gsid));
} else {
$oSurveysGroups = SurveysGroups::model()->findAll();
}
$options = [
'' => gT('No parent menu')
];
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/surveysgroups/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<!-- should be a selector based on group name -->
<div class="row">
<?php echo $form->labelEx($model,'parent_id'); ?>
<?php echo $form->dropDownList($model,'parent_id',$model->getParentGroupOptions()); ?>
<?php echo $form->dropDownList($model,'parent_id',$model->getParentGroupOptions($model->gsid)); ?>
<?php echo $form->error($model,'parent_id'); ?>
</div>

Expand Down

0 comments on commit fa23659

Please sign in to comment.