diff --git a/lib/NGCP/Panel/Controller/Customer.pm b/lib/NGCP/Panel/Controller/Customer.pm index d9b7a76aea..138862c933 100644 --- a/lib/NGCP/Panel/Controller/Customer.pm +++ b/lib/NGCP/Panel/Controller/Customer.pm @@ -712,7 +712,6 @@ sub subscriber_create :Chained('base') :PathPart('subscriber/create') :Args(0) { 'provisioning_voip_subscriber.is_pbx_pilot' => 1, })->first; - my $params = {}; if($c->config->{features}->{cloudpbx} && $pbx) { @@ -745,6 +744,10 @@ sub subscriber_create :Chained('base') :PathPart('subscriber/create') :Args(0) { } $params = merge($params, $c->session->{created_objects}); + if($c->stash->{pilot} && !$params->{domain}{id}) { + $params->{domain}{id} = $c->stash->{pilot}->domain_id; + } + $form->process( posted => $posted, params => $c->request->params, @@ -775,7 +778,7 @@ sub subscriber_create :Chained('base') :PathPart('subscriber/create') :Args(0) { my $pbx_group_ids = []; if($pbx && !$pbxadmin) { my $pilot = $c->stash->{pilot}; - $form->params->{domain}{id} = $pilot->domain_id; + $form->params->{domain}{id} ||= $pilot->domain_id; if ($form->params->{group_select}) { $pbx_group_ids = decode_json($form->params->{group_select}); } diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index 97abdfb328..3151c8dadd 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -2214,7 +2214,7 @@ sub edit_master :Chained('master') :PathPart('edit') :Args(0) :Does(ACL) :ACLDet $form = NGCP::Panel::Form::Customer::PbxExtensionSubscriberEditSubadmin->new(ctx => $c); } else { $is_admin = 1; - $form = NGCP::Panel::Form::Customer::PbxExtensionSubscriber->new(ctx => $c); + $form = NGCP::Panel::Form::Customer::PbxExtensionSubscriber->new(ctx => $c, inactive => ['domain']); } $pbx_ext = 1; } diff --git a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriber.pm b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriber.pm index 4a8c3b1e9a..9f0588b77d 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriber.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriber.pm @@ -4,6 +4,12 @@ use HTML::FormHandler::Moose; use NGCP::Panel::Field::PosInteger; extends 'NGCP::Panel::Form::Customer::PbxSubscriber'; +has_field 'domain' => ( + type => '+NGCP::Panel::Field::Domain', + label => 'SIP Domain', + validate_when_empty => 0, +); + has_field 'pbx_extension' => ( type => '+NGCP::Panel::Field::PosInteger', element_attr => { @@ -17,7 +23,7 @@ has_field 'pbx_extension' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/group_select alias_select pbx_extension display_name email webusername webpassword username password administrative status external_id profile_set profile/ ], + render_list => [qw/domain group_select alias_select pbx_extension display_name email webusername webpassword username password administrative status external_id profile_set profile/ ], ); override 'field_list' => sub {