MT#56286 fix subscriber profiles form and api update

* subscriber profile form is fixed so that the attributes
  list is now correctly shown in the old UI
* /api/subscriberprofiles update, attribute values are now correctly
  transformed for the validation and processing

Change-Id: I4418250d4a0e702d75524ab5999eb47429be5a04
mr11.2
Kirill Solomko 3 years ago
parent 8288a30f61
commit 45d9fb34b5

@ -84,22 +84,17 @@ sub field_list {
}
],
});
my $fields = [];
foreach my $pref($pref_rs->all) {
my $desc = $pref->description;
push @{ $fields }, 'attribute.'.$pref->attribute => {
name => $pref->attribute,
type => 'Checkbox',
label => $pref->attribute,
checkbox_value => $pref->id,
element_attr => {
# rel => ['tooltip'],
# title => [$pref->description],
# checked => 'checked',
},
disabled => $c->user->roles eq "reseller" && !$c->config->{profile_sets}->{reseller_edit} ? 1 : 0,
};
push @{ $fields }, 'field_'.$pref->attribute => {
name => 'attribute.'.$pref->attribute,
type => 'Checkbox',
label => $pref->attribute,
checkbox_value => $pref->id,
disabled => $c->user->roles eq "reseller" && !$c->config->{profile_sets}->{reseller_edit} ? 1 : 0,
};
}
return $fields;

@ -99,7 +99,7 @@ sub update_item {
return;
}
$resource->{attribute} = delete $resource->{attributes};
%{$resource->{attribute}} = map { $_ => 1 } @{ delete $resource->{attributes} };
$form //= $self->get_form($c);
return unless $self->validate_form(
c => $c,
@ -169,8 +169,8 @@ sub update_item {
},
],
});
foreach my $a(@{ $attributes }) {
my $meta = $meta_rs->find({ attribute => $a });
foreach my $attr (keys %{$attributes}) {
my $meta = $meta_rs->find({ attribute => $attr });
next unless $meta;
# mark as seen, so later we can unprovision the remaining ones,
# which are the ones not set here:

Loading…
Cancel
Save