TT#75751 - Add enable/disable feature for Call Forwards

* Implement possibility to enable and disable
	   call forward rules in both UI and API

Change-Id: I8237a0695c5039b2edb4734003bb2a859bb8ee37
changes/75/37775/2
Flaviu Mates 6 years ago
parent ac540ddbd4
commit 8a7b6f7314

@ -691,6 +691,7 @@ sub preferences :Chained('base') :PathPart('preferences') :Args(0) {
bset_name => $bset_name,
bset_mode => $bset_mode,
bnumbers => \@bnumbers,
enabled => $map->enabled,
};
}
}
@ -1045,8 +1046,12 @@ sub preferences_callforward :Chained('base') :PathPart('preferences/callforward'
type => $cf_type,
destination_set_id => $dest_set->id,
time_set_id => undef, #$time_set_id,
enabled => $cf_form->field('enabled')->value
});
}
else {
$map->update({enabled => $cf_form->field('enabled')->value});
}
foreach my $pref($cf_preference->all) {
$pref->delete;
}
@ -1171,6 +1176,7 @@ sub preferences_callforward_advanced :Chained('base') :PathPart('preferences/cal
time_set => $map->time_set ? $map->time_set->id : undef,
source_set => $map->source_set ? $map->source_set->id : undef,
bnumber_set => $map->bnumber_set ? $map->bnumber_set->id : undef,
enabled => $map->enabled || undef,
};
}
my $params = {
@ -1246,6 +1252,7 @@ sub preferences_callforward_advanced :Chained('base') :PathPart('preferences/cal
time_set_id => $map->field('time_set')->value,
source_set_id => $map->field('source_set')->value,
bnumber_set_id => $map->field('bnumber_set')->value,
enabled => $map->field('enabled')->value,
});
$cf_preference->create({ value => $m->id });
$autoattendant_count -= NGCP::Panel::Utils::Subscriber::check_dset_autoattendant_status($m->destination_set);

@ -154,6 +154,11 @@ has_field 'cfb.destinationset_id' => (
do_label => 0,
);
has_field 'cfu.enabled' => (
type => 'Boolean',
do_label => 0,
);
has_field 'cfb.timeset' => (
type => 'Text',
do_wrapper => 1,
@ -187,6 +192,11 @@ has_field 'cfb.bnumberset_id' => (
do_label => 0,
);
has_field 'cfb.enabled' => (
type => 'Boolean',
do_label => 0,
);
has_field 'cft.destinationset' => (
type => 'Text',
do_wrapper => 1,
@ -231,6 +241,11 @@ has_field 'cft.bnumberset_id' => (
do_label => 0,
);
has_field 'cft.enabled' => (
type => 'Boolean',
do_label => 0,
);
has_field 'cfna.destinationset' => (
type => 'Text',
do_wrapper => 1,
@ -275,6 +290,11 @@ has_field 'cfna.bnumberset_id' => (
do_label => 0,
);
has_field 'cfna.enabled' => (
type => 'Boolean',
do_label => 0,
);
has_field 'cfs.destinationset' => (
type => 'Text',
do_wrapper => 1,
@ -319,6 +339,11 @@ has_field 'cfs.bnumberset_id' => (
do_label => 0,
);
has_field 'cfs.enabled' => (
type => 'Boolean',
do_label => 0,
);
has_field 'cft_ringtimeout' => (
type => 'PosInteger',
do_wrapper => 1,
@ -369,6 +394,11 @@ has_field 'cfr.bnumberset_id' => (
do_label => 0,
);
has_field 'cfr.enabled' => (
type => 'Boolean',
do_label => 0,
);
has_field 'cfo.destinationset' => (
type => 'Text',
do_wrapper => 1,
@ -413,6 +443,11 @@ has_field 'cfo.bnumberset_id' => (
do_label => 0,
);
has_field 'cfo.enabled' => (
type => 'Boolean',
do_label => 0,
);
1;
# vim: set tabstop=4 expandtab:

@ -54,6 +54,15 @@ has_field 'active_callforward.rm' => (
# },
);
has_field 'active_callforward.enabled' => (
type => 'Boolean',
default => 1,
wrapper_class => [qw/hfh-rep-field/],
element_attr => {
rel => ['tooltip'],
title => ['Enables or disables the Call Forward rule from beign used.'],
},
);
has_field 'callforward_controls_add' => (
type => 'AddElement',

@ -32,6 +32,15 @@ has_field 'destination.destination' => (
default => 'uri',
);
has_field 'enabled' => (
type => 'Boolean',
default => 1,
element_attr => {
rel => ['tooltip'],
title => ['Enables or disables the Call Forward rule from beign used.'],
},
);
sub build_destinations {
my ($self) = @_;
@ -118,7 +127,7 @@ has_field 'cf_actions.advanced' => (
has_block 'fields' => (
tag => 'div',
class => [qw(modal-body)],
render_list => [qw(destination)],
render_list => [qw(destination enabled)],
);
has_block 'actions' => (tag => 'div', class => [qw(modal-footer)], render_list => [qw(cf_actions)],);
sub validate_destination{

@ -18,7 +18,7 @@ has_field 'ringtimeout' => (
has_block 'fields' => (
tag => 'div',
class => [qw(modal-body)],
render_list => [qw(destination ringtimeout)],
render_list => [qw(destination ringtimeout enabled)],
);
sub validate_ringtimeout {

@ -62,6 +62,7 @@ sub hal_from_item {
bnumberset => undef,
bnumberset_id => undef,
),
( enabled => $mapping->enabled ),
};
}
@ -247,6 +248,7 @@ sub update_item {
source_set_id => $sset ? $sset->id : undef,
bnumber_set_id => $bset ? $bset->id : undef,
type => $type,
enabled => $mapping->{enabled},
});
}
}

@ -110,6 +110,7 @@ $( document ).ready(function() {
<th>[% c.loc('Sources') %]</th>
<th>[% c.loc('To (B-Numbers)') %]</th>
<th>[% c.loc('New Destinations') %]</th>
<th>[% c.loc('Enabled') %]</th>
[% # one for actions -%]
<th class="ngcp-actions-column"></th>
@ -232,6 +233,12 @@ $( document ).ready(function() {
<br/>
[% END -%]
</td>
<td>
[% FOR maps IN cf_destinations.${cf.type} -%]
[% maps.enabled %]
<br/>
[% END -%]
</td>
<td class="ngcp-actions-column">
<div class="sw_actions">
[% UNLESS (c.user.roles == "admin" || c.user.roles == "reseller" ||

Loading…
Cancel
Save