MT#8071 fix api subscriber termination

response was handled wrong on patch/put
primary number was not freed in case of pbx
gjungwirth/voicemail_number
Gerhard Jungwirth 11 years ago
parent d67179af94
commit 7b3080f45b

@ -469,11 +469,12 @@ sub update_item {
} elsif($resource->{status} eq 'terminated') {
try {
NGCP::Panel::Utils::Subscriber::terminate(c => $c, subscriber => $subscriber);
return $subscriber;
} catch($e) {
$c->log->error("failed to terminate subscriber id ".$subscriber->id);
$self->error($c, HTTP_INTERNAL_SERVER_ERROR, "Failed to terminate subscriber");
return;
}
return;
}
}
if(defined $resource->{lock}) {

@ -709,6 +709,13 @@ sub terminate {
alias_selected => [], #none, thus moving them back to our subadmin
sadmin => $pilot_rs->first,
);
my $subscriber_primary_nr = $subscriber->primary_number;
if ($subscriber_primary_nr) {
$subscriber_primary_nr->update({
subscriber_id => undef,
reseller_id => undef,
});
}
} else {
$subscriber->voip_numbers->update_all({
subscriber_id => undef,

Loading…
Cancel
Save