diff --git a/lib/NGCP/Panel/Controller/Contract.pm b/lib/NGCP/Panel/Controller/Contract.pm index a9e14e78a5..d79d26d393 100644 --- a/lib/NGCP/Panel/Controller/Contract.pm +++ b/lib/NGCP/Panel/Controller/Contract.pm @@ -175,16 +175,13 @@ sub edit :Chained('base') :PathPart('edit') :Args(0) { my $contract = $c->stash->{contract_result}; my $billing_mapping = $contract->billing_mappings->find($contract->get_column('bmid')); my $params = {}; - $params = $params->merge($c->session->{created_objects}); unless($posted) { $params->{billing_profile}{id} = $billing_mapping->billing_profile->id; $params->{contact}{id} = $contract->contact_id; $params->{external_id} = $contract->external_id; $params->{status} = $contract->status; } - - # TODO: handle created contact/bilprof - + $params = $params->merge($c->session->{created_objects}); my $form = NGCP::Panel::Form::Contract->new; $form->process( posted => $posted, @@ -193,7 +190,7 @@ sub edit :Chained('base') :PathPart('edit') :Args(0) { ); NGCP::Panel::Utils::Navigation::check_form_buttons( c => $c, form => $form, - fields => {'contract.contact.create' => $c->uri_for('/contact/create'), + fields => {'contact.create' => $c->uri_for('/contact/create'), 'billing_profile.create' => $c->uri_for('/billing/create')}, back_uri => $c->req->uri, ); diff --git a/lib/NGCP/Panel/Controller/Customer.pm b/lib/NGCP/Panel/Controller/Customer.pm index 4e71e78623..92f8b8283c 100644 --- a/lib/NGCP/Panel/Controller/Customer.pm +++ b/lib/NGCP/Panel/Controller/Customer.pm @@ -60,7 +60,7 @@ sub base :Chained('list_customer') :PathPart('') :CaptureArgs(1) { } my $contract = $c->model('DB')->resultset('contracts') - ->search_rs(id => $contract_id); + ->search('me.id' => $contract_id); unless($c->user->is_superuser) { $contract = $contract->search({ 'contact.reseller_id' => $c->user->reseller_id, diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index c9447caa1e..13eceb0daf 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -1609,9 +1609,13 @@ sub edit_master :Chained('master') :PathPart('edit') :Args(0) { } if($lock->first) { - $lock->first->update({ value => $form->field('lock')->value }); - } else { - $lock->create({ value => $form->field('lock')->value }); + if ($form->values->{lock} == 0) { + $lock->delete; + } else { + $lock->first->update({ value => $form->values->{lock} }); + } + } elsif($form->values->{lock} > 0) { + $lock->create({ value => $form->values->{lock} }); } }); $c->flash(messages => [{type => 'success', text => 'Successfully updated subscriber'}]); diff --git a/share/templates/customer/details.tt b/share/templates/customer/details.tt index ff8670855c..679ae24d8f 100644 --- a/share/templates/customer/details.tt +++ b/share/templates/customer/details.tt @@ -14,20 +14,55 @@ Back + [% UNLESS c.user.read_only -%] + + Edit + + [% END -%] +[% back_created = 1 -%] -[% IF messages -%]
[% FOREACH m IN messages -%]
[% m.text %]
[% END -%] + [% IF contract.status != "active" -%] +
Customer is [% contract.status %]
+ [% END -%]
-[% END -%]
+ [% IF c.user.is_superuser -%] +
+
+ Reseller +
+
+
+ + + + + + + + + + + + + + + +
NameValue
#[% contract.contact.reseller.id %]
Name[% contract.contact.reseller.name %]
+
+
+
+ [% END -%] +
Contact Details @@ -89,12 +124,11 @@ [% FOR mapping IN contract.billing_mappings.all -%] - [% bprof = mapping.billing_profile -%] - [% bprof.start_date ? bprof.start_date : 'NULL' %] - [% bprof.end_date ? bprof.end_date : 'NULL' %] + [% mapping.start_date ? mapping.start_date : 'NULL' %] - [% mapping.end_date.defined ? mapping.end_date : 'NULL' %] - [% bprof.name %] + [% mapping.billing_profile.name %] [% END -%] diff --git a/share/templates/reseller/details.tt b/share/templates/reseller/details.tt index 30b0ad1e03..2360e7b2c8 100644 --- a/share/templates/reseller/details.tt +++ b/share/templates/reseller/details.tt @@ -9,10 +9,15 @@
-[% FOREACH m IN messages -%] -
[% m.text %]
-[% END -%] +
+ [% FOREACH m IN messages -%] +
[% m.text %]
+ [% END -%] + [% IF reseller.first.status != "active" -%] +
Reseller is [% reseller.first.status %]
+ [% END -%] [% messages = [] -%] +
diff --git a/share/templates/subscriber/master.tt b/share/templates/subscriber/master.tt index 60f6151500..c90c6a8e75 100644 --- a/share/templates/subscriber/master.tt +++ b/share/templates/subscriber/master.tt @@ -9,13 +9,14 @@
[% back_created = 1 -%] -[% IF messages -%]
[% FOREACH m IN messages -%]
[% m.text %]
[% END -%] + [% IF subscriber.status != "active" -%] +
Subscriber is [% subscriber.status %]
+ [% END -%]
-[% END -%]
@@ -44,6 +45,7 @@ [% elements = [ + { value = subscriber.status, desc = 'Status'}, { value = subscriber.provisioning_voip_subscriber.webusername, desc = 'CSC Username'}, { value = subscriber.provisioning_voip_subscriber.webpassword, desc = 'CSC Password'}, { value = subscriber.username _ '@' _ subscriber.domain.domain, desc = 'SIP URI'},