diff --git a/lib/NGCP/Panel/Controller/Contract.pm b/lib/NGCP/Panel/Controller/Contract.pm index 55b7cc2eff..204402a669 100644 --- a/lib/NGCP/Panel/Controller/Contract.pm +++ b/lib/NGCP/Panel/Controller/Contract.pm @@ -460,6 +460,9 @@ sub customer_create :Chained('customer_list') :PathPart('create') :Args(0) { unless($product_id) { $product_id = $c->model('DB')->resultset('products')->find({ class => 'sipaccount' })->id; } + unless($form->params->{max_subscribers} && length($form->params->{max_subscribers})) { + delete $form->params->{max_subscribers}; + } my $contract = $schema->resultset('contracts')->create($form->params); my $billing_profile = $schema->resultset('billing_profiles')->find($bprof_id); $contract->billing_mappings->create({ diff --git a/lib/NGCP/Panel/Form/Contract/ProductSelect.pm b/lib/NGCP/Panel/Form/Contract/ProductSelect.pm index f30a566bee..a08fbfe96b 100644 --- a/lib/NGCP/Panel/Form/Contract/ProductSelect.pm +++ b/lib/NGCP/Panel/Form/Contract/ProductSelect.pm @@ -9,10 +9,21 @@ has_field 'product' => ( not_nullable => 1, ); +has_field 'max_subscribers' => ( + type => 'PosInteger', + label => 'Max Subscribers', + required => 0, + element_attr => { + rel => ['tooltip'], + title => ['Optionally set the maximum number of subscribers for this contract. Leave empty for unlimited.'] + }, +); + + has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/product contact billing_profile status external_id/], + render_list => [qw/contact billing_profile product max_subscribers status external_id/], ); 1;