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

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

Loading…
Cancel
Save