MT#56208 additional inherited cfs improvements for subscribers

* API: GET collection returns only distinct cf sets
* UI: inherited cf sets are now shown in the advanced view
  and having suffix '(inherited)' to distinguish them from the
  own ones as they are not available in the "Manage Sets" edit
  dialog.

Change-Id: Ifd8c1a46fcb4c2c66f8f63268a1e91b80792c216
mr11.2
Kirill Solomko 2 years ago
parent 36974efa03
commit dee6b60c6e

@ -1189,11 +1189,18 @@ 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');
$c->stash->{cf_destination_sets} = $prov_subscriber->voip_cf_destination_sets
->search_rs(undef,{order_by => 'name'});
$c->stash->{cf_time_sets} = $prov_subscriber->voip_cf_time_sets;
$c->stash->{cf_source_sets} = $prov_subscriber->voip_cf_source_sets;
$c->stash->{cf_bnumber_sets} = $prov_subscriber->voip_cf_bnumber_sets;
foreach my $cf_type (qw(destination source time bnumber)) {
$c->stash->{'cf_' . $cf_type . '_sets'} = $c->model('DB')->resultset('voip_cf_' . $cf_type . '_sets')->search_rs({
'-or' => [
'me.subscriber_id' => $c->user->id,
'voip_cf_mappings.subscriber_id' => $c->user->id,
]
},{
distinct => 1,
join => 'voip_cf_mappings',
order_by => 'me.name',
});
}
my $posted = ($c->request->method eq 'POST');

@ -10,13 +10,15 @@ sub build_options {
return [] unless $form->ctx;
my $sets = $form->ctx->stash->{cf_bnumber_sets};
my $subscriber_id = $form->ctx->stash->{subscriber}->provisioning_voip_subscriber->id;
my @all;
return \@all unless($sets);
push @all, { label => '<any number>', value => undef};
foreach my $set($sets->all) {
my $entry = {};
$entry->{label} = $set->name;
$entry->{label} = $set->name . ($subscriber_id != $set->subscriber_id ? ' (inherited)' : '');
$entry->{value} = $set->id;
push @all, $entry;
}

@ -11,12 +11,13 @@ sub build_options {
return [] unless $form->ctx;
my $destination_sets = $form->ctx->stash->{cf_destination_sets};
my $subscriber_id = $form->ctx->stash->{subscriber}->provisioning_voip_subscriber->id;
my @all;
return \@all unless($destination_sets);
foreach my $set($destination_sets->all) {
my $entry = {};
$entry->{label} = $set->name;
$entry->{label} = $set->name . ($subscriber_id != $set->subscriber_id ? ' (inherited)' : '');
$entry->{value} = $set->id;
push @all, $entry;
}

@ -10,13 +10,15 @@ sub build_options {
return [] unless $form->ctx;
my $source_sets = $form->ctx->stash->{cf_source_sets};
my $subscriber_id = $form->ctx->stash->{subscriber}->provisioning_voip_subscriber->id;
my @all;
return \@all unless($source_sets);
push @all, { label => '<all sources>', value => undef};
foreach my $set($source_sets->all) {
my $entry = {};
$entry->{label} = $set->name;
$entry->{label} = $set->name . ($subscriber_id != $set->subscriber_id ? ' (inherited)' : '');
$entry->{value} = $set->id;
push @all, $entry;
}

@ -10,13 +10,15 @@ sub build_options {
return [] unless $form->ctx;
my $time_sets = $form->ctx->stash->{cf_time_sets};
my $subscriber_id = $form->ctx->stash->{subscriber}->provisioning_voip_subscriber->id;
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->{label} = $set->name . ($subscriber_id != $set->subscriber_id ? ' (inherited)' : '');
$entry->{value} = $set->id;
push @all, $entry;
}

@ -63,6 +63,7 @@ sub _item_rs {
'voip_cf_mappings.subscriber_id' => $c->user->id,
]
},{
distinct => 1,
join => 'voip_cf_mappings',
});
}

@ -106,6 +106,7 @@ sub _item_rs {
'voip_cf_mappings.subscriber_id' => $c->user->id,
]
},{
distinct => 1,
join => 'voip_cf_mappings',
});
}

@ -97,6 +97,7 @@ sub _item_rs {
'voip_cf_mappings.subscriber_id' => $c->user->id,
]
},{
distinct => 1,
join => 'voip_cf_mappings',
});
}

@ -374,6 +374,7 @@ sub _item_rs {
'voip_cf_mappings.subscriber_id' => $c->user->id,
]
},{
distinct => 1,
join => 'voip_cf_mappings',
});
}

Loading…
Cancel
Save