MT#9237 Fix editing advanced CF map with n>1 recs

changes/94/294/1
Andreas Granig 11 years ago
parent 6d74b4e7ed
commit f2a00bad78

@ -1150,13 +1150,6 @@ sub preferences_callforward_advanced :Chained('base') :PathPart('preferences/cal
my $ringtimeout_preference = NGCP::Panel::Utils::Preferences::get_usr_preference_rs(
c => $c, prov_subscriber => $prov_subscriber, attribute => 'ringtimeout');
# TODO: we can have more than one active, no?
if($cf_mapping->count) {
$c->stash->{cf_active_destination_set} = $cf_mapping->first->destination_set
if($cf_mapping->first->destination_set);
$c->stash->{cf_active_time_set} = $cf_mapping->first->time_set
if($cf_mapping->first->time_set);
}
$c->stash->{cf_destination_sets} = $prov_subscriber->voip_cf_destination_sets;
$c->stash->{cf_time_sets} = $prov_subscriber->voip_cf_time_sets;
@ -1182,8 +1175,9 @@ sub preferences_callforward_advanced :Chained('base') :PathPart('preferences/cal
};
$cf_form->process(
params => $posted ? $c->request->params : $params,
posted => $posted,
params => $c->request->params,
item => $params,
);

@ -6,27 +6,19 @@ sub build_options {
my ($self) = @_;
my $form = $self->form;
return [] unless $form->ctx;
my $active_destination_set = $form->ctx->stash->{cf_active_destination_set};
my $destination_sets = $form->ctx->stash->{cf_destination_sets};
my @all;
return \@all unless($destination_sets);
push @all, { label => '', value => undef}
unless($active_destination_set);
foreach my $set($destination_sets->all) {
my $entry = {};
$entry->{label} = $set->name;
$entry->{value} = $set->id;
if($active_destination_set &&
$set->id == $active_destination_set->id) {
$entry->{selected} = 1;
}
push @all, $entry;
}
return \@all;
}

@ -8,24 +8,17 @@ sub build_options {
my $form = $self->form;
return [] unless $form->ctx;
my $active_time_set = $form->ctx->stash->{cf_active_time_set};
my $time_sets = $form->ctx->stash->{cf_time_sets};
my @all;
return \@all unless($time_sets);
push @all, { label => '<always>', value => undef};
foreach my $set($time_sets->all) {
my $entry = {};
$entry->{label} = $set->name;
$entry->{value} = $set->id;
if($active_time_set &&
$set->id == $active_time_set->id) {
$entry->{selected} = 1;
}
push @all, $entry;
}
return \@all;
}

Loading…
Cancel
Save