From be8cad19bba6eb34e633eacca9e5183a0f9eda14 Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Fri, 3 Oct 2014 10:10:12 +0200 Subject: [PATCH] MT#8035 Trigger stop_profile on subscriber term ... if subscriber had a profile assigned. --- lib/NGCP/Panel/Utils/Subscriber.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/NGCP/Panel/Utils/Subscriber.pm b/lib/NGCP/Panel/Utils/Subscriber.pm index 3a2915bb09..10000d1d0c 100644 --- a/lib/NGCP/Panel/Utils/Subscriber.pm +++ b/lib/NGCP/Panel/Utils/Subscriber.pm @@ -769,6 +769,13 @@ sub terminate { my $schema = $c->model('DB'); $schema->txn_do(sub { my $prov_subscriber = $subscriber->provisioning_voip_subscriber; + if($prov_subscriber && $prov_subscriber->profile_id) { + NGCP::Panel::Utils::Events::insert( + c => $c, schema => $schema, + subscriber => $subscriber, type => 'stop_profile', + old => $prov_subscriber->profile_id, new => undef, + ); + } if($prov_subscriber && $prov_subscriber->is_pbx_group) { $schema->resultset('voip_pbx_groups')->search({ group_id => $subscriber->provisioning_voip_subscriber->id, @@ -776,7 +783,7 @@ sub terminate { NGCP::Panel::Utils::Events::insert( c => $c, schema => $schema, type => 'end_huntgroup', subscriber => $subscriber, - old_status => $prov_subscriber->profile_id, new_status => undef, + old => $prov_subscriber->profile_id, new => undef, ); } if($prov_subscriber && !$prov_subscriber->is_pbx_pilot) {