TT#5559 end_ivr event for panel UI delete destinationset btn

Change-Id: I2980907ebb1076ac46ebce6836673b02086e3175
changes/63/10063/3
Rene Krenn 9 years ago
parent 47d1ff2d0b
commit 01a98254dc

@ -1605,10 +1605,18 @@ sub preferences_callforward_destinationset_delete :Chained('preferences_callforw
try { try {
my $schema = $c->model('DB'); my $schema = $c->model('DB');
$schema->txn_do(sub { $schema->txn_do(sub {
my $autoattendant = NGCP::Panel::Utils::Subscriber::check_dset_autoattendant_status($set);
foreach my $map($set->voip_cf_mappings->all) { foreach my $map($set->voip_cf_mappings->all) {
my $cf = $cf_preference->find({ value => $map->id }); my $cf = $cf_preference->find({ value => $map->id });
$cf->delete if $cf; $cf->delete if $cf;
$map->delete; $map->delete;
if ($autoattendant) {
NGCP::Panel::Utils::Events::insert(
schema => $schema,
subscriber => $c->stash->{subscriber},
type => 'end_ivr',
);
}
} }
if($cf_type eq "cft" && if($cf_type eq "cft" &&
$prov_subscriber->voip_cf_mappings->search_rs({ type => $cf_type})->count == 0) { $prov_subscriber->voip_cf_mappings->search_rs({ type => $cf_type})->count == 0) {
@ -2194,22 +2202,20 @@ sub preferences_callforward_delete :Chained('base') :PathPart('preferences/callf
foreach my $map($mapping_rs->all) { foreach my $map($mapping_rs->all) {
$autoattendant_count += NGCP::Panel::Utils::Subscriber::check_dset_autoattendant_status($map->destination_set); $autoattendant_count += NGCP::Panel::Utils::Subscriber::check_dset_autoattendant_status($map->destination_set);
} }
$mapping_rs->delete; $mapping_rs->delete_all;
my $cf_pref = NGCP::Panel::Utils::Preferences::get_usr_preference_rs( my $cf_pref = NGCP::Panel::Utils::Preferences::get_usr_preference_rs(
c => $c, c => $c,
attribute => $cf_type, attribute => $cf_type,
prov_subscriber => $prov_subscriber, prov_subscriber => $prov_subscriber,
); );
$cf_pref->delete_all; $cf_pref->delete_all;
if ($autoattendant_count > 0) { while ($autoattendant_count > 0) {
while ($autoattendant_count != 0) { $autoattendant_count--;
$autoattendant_count--; NGCP::Panel::Utils::Events::insert(
NGCP::Panel::Utils::Events::insert( schema => $schema,
schema => $schema, subscriber => $c->stash->{subscriber},
subscriber => $c->stash->{subscriber}, type => 'end_ivr',
type => 'end_ivr', );
);
}
} }
}); });
NGCP::Panel::Utils::Message::info( NGCP::Panel::Utils::Message::info(

Loading…
Cancel
Save