From b7e62dbdc874e3eae595ba3299413d9c5680de1b Mon Sep 17 00:00:00 2001 From: Daniel Tiefnig Date: Fri, 7 Mar 2008 00:25:41 +0000 Subject: [PATCH] added delete function for customers implemented terminate function for customers (not yet available) --- lib/admin/Controller/customer.pm | 52 ++++++++++++++++++++++++++++++++ root/tt/customer_detail.tt | 6 ++-- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/lib/admin/Controller/customer.pm b/lib/admin/Controller/customer.pm index 3534485..4104ea7 100644 --- a/lib/admin/Controller/customer.pm +++ b/lib/admin/Controller/customer.pm @@ -210,6 +210,58 @@ sub update_customer : Local { return; } +=head2 terminate + +Terminates a customer. + +=cut + +sub terminate : Local { + my ( $self, $c ) = @_; + + my %messages; + my $customer_id = $c->request->params->{customer_id}; + + if($c->model('Provisioning')->call_prov( $c, 'billing', 'terminate_customer', + { id => $customer_id }, + undef)) + { + $messages{topmsg} = 'Server.Voip.SubscriberDeleted'; + $c->session->{messages} = \%messages; + $c->response->redirect("/customer"); + return; + } + + $c->response->redirect("/customer/detail?customer_id=$customer_id"); + return; +} + +=head2 delete + +Deletes a customer. + +=cut + +sub delete : Local { + my ( $self, $c ) = @_; + + my %messages; + my $customer_id = $c->request->params->{customer_id}; + + if($c->model('Provisioning')->call_prov( $c, 'billing', 'delete_customer', + { id => $customer_id }, + undef)) + { + $messages{topmsg} = 'Server.Voip.SubscriberDeleted'; + $c->session->{messages} = \%messages; + $c->response->redirect("/customer"); + return; + } + + $c->response->redirect("/customer/detail?customer_id=$customer_id"); + return; +} + =head2 update_contact Update details of a customer's contact. diff --git a/root/tt/customer_detail.tt b/root/tt/customer_detail.tt index 08dbf74..08750c6 100644 --- a/root/tt/customer_detail.tt +++ b/root/tt/customer_detail.tt @@ -3,14 +3,16 @@ #[% customer.id %] - + delete + +
[% IF messages.custmsg %]
[% messages.custmsg %]
[% END %] [% IF messages.custerr %]
[% messages.custerr %]
[% END %]