Fix Choice parameter overload in manager (#1962)

This commit is contained in:
Maxime Besson 2019-10-01 14:10:22 +02:00
parent a239091553
commit 914a760e25
3 changed files with 16 additions and 8 deletions

View File

@ -541,10 +541,15 @@ sub authChoiceModules {
my @res; my @res;
foreach my $k ( sort keys %$value ) { foreach my $k ( sort keys %$value ) {
my $data = [ split /;/, $value->{$k} ]; my $data = [ split /;/, $value->{$k} ];
eval { $data->[5] = from_json( $data->[5] ) if $data->[5] }; if ( $data->[5] ) {
if ($@) { my $over;
$self->logger->error( eval { $over = from_json( $data->[5] ) };
"Bad value in choice over parameters, deleted ($@)"); if ($@) {
$self->logger->error(
"Bad value in choice over parameters, deleted ($@)");
} else {
$data->[5] = [ map { [ $_, $over->{$_} ] } keys %{$over} ];
}
} }
push @res, push @res,
{ {

View File

@ -846,9 +846,11 @@ sub _scanNodes {
# authChoiceModules # authChoiceModules
if ( $name eq 'authChoiceModules' ) { if ( $name eq 'authChoiceModules' ) {
hdebug(' combModules'); hdebug(' authChoiceModules');
$n->{data}->[5] ||= {}; $n->{data}->[5] ||= {};
$n->{data}->[5] = to_json( $n->{data}->[5] ); $n->{data}->[5] =
to_json( { map { @$_ } @{ $n->{data}->[5] } } )
if ref( $n->{data}->[5] ) eq 'ARRAY';
} }
$n->{data} = join ';', @{ $n->{data} }; $n->{data} = join ';', @{ $n->{data} };

View File

@ -42,8 +42,9 @@
<input class="form-control" ng-model="t[1]" /> <input class="form-control" ng-model="t[1]" />
</td> </td>
<td> <td>
<span class="link text-danger glyphicon glyphicon-minus-sign" ng-click="del(currentNode.data.over,$index)"/> <span class="link text-danger glyphicon glyphicon-minus-sign" ng-click="del(currentNode.data[5],$index)"/>
<span ng-if="$last" class="link text-success glyphicon glyphicon-plus-sign" ng-click="menuClick({title:'newCmbOver'})"/> <span ng-if="$last" class="link text-success glyphicon glyphicon-plus-sign"
ng-click="menuClick({title:'newCmbOver', action:'newChoiceOver'})" />
</td> </td>
</tr> </tr>
</table> </table>