MT#7555 Properly terminate subs on customer edit.

Recursively terminate subscribers and everything else if a customer
is terminated via the customer edit form.
gjungwirth/voicemail_number
Andreas Granig 12 years ago
parent dd0f61f081
commit eaa4fea245

@ -394,9 +394,18 @@ sub edit :Chained('base') :PathPart('edit') :Args(0) {
my $old_bprof_id = $billing_mapping->billing_profile_id;
my $old_prepaid = $billing_mapping->billing_profile->prepaid;
my $old_ext_id = $contract->external_id // '';
my $old_status = $contract->status;
$contract->update($form->params);
my $new_ext_id = $contract->external_id // '';
# if status changed, populate it down the chain
if($contract->status ne $old_status) {
NGCP::Panel::Utils::Contract::recursively_lock_contract(
c => $c,
contract => $contract,
);
}
if($old_ext_id ne $new_ext_id) { # undef is '' so we don't bail out here
foreach my $sub($contract->voip_subscribers->all) {
my $prov_sub = $sub->provisioning_voip_subscriber;

@ -227,6 +227,14 @@ sub base :Chained('sub_list') :PathPart('') :CaptureArgs(1) {
my $contract = $contract_rs->find({
'me.id' => $c->stash->{contract}->id,
});
unless(defined $contract) {
NGCP::Panel::Utils::Message->error(
c => $c,
error => "subscriber id '$subscriber_id' points to non-existing contract id",
desc => $c->loc('Contract does not exist for subscriber'),
);
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/subscriber'));
}
my $billing_mapping = $contract->billing_mappings->find($contract->get_column('bmid'));
$c->stash->{billing_mapping} = $billing_mapping;

Loading…
Cancel
Save