From 8c867420e835bd4c6fb3d4755b73a41180e8db88 Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Mon, 14 Apr 2014 21:22:41 +0200 Subject: [PATCH] MT#6693 Rename profile categories to profile sets. --- lib/NGCP/Panel/Controller/Subscriber.pm | 57 ++++--- .../Panel/Controller/SubscriberProfile.pm | 160 +++++++++--------- lib/NGCP/Panel/Field/SubscriberProfile.pm | 26 --- ...fileCatalog.pm => SubscriberProfileSet.pm} | 8 +- .../Panel/Form/Customer/PbxAdminSubscriber.pm | 2 +- .../Form/Customer/PbxExtensionSubscriber.pm | 2 +- .../Customer/PbxExtensionSubscriberEdit.pm | 2 +- .../PbxExtensionSubscriberEditAdmin.pm | 2 +- .../PbxExtensionSubscriberEditSubadmin.pm | 2 +- ...xExtensionSubscriberEditSubadminNoGroup.pm | 2 +- lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm | 8 +- lib/NGCP/Panel/Form/Customer/Subscriber.pm | 8 +- lib/NGCP/Panel/Form/Subscriber.pm | 8 +- lib/NGCP/Panel/Form/SubscriberEdit.pm | 10 +- .../Form/SubscriberProfile/ApiProfile.pm | 8 +- .../Panel/Form/SubscriberProfile/Profile.pm | 6 +- .../{CatalogAdmin.pm => SetAdmin.pm} | 6 +- .../{CatalogClone.pm => SetClone.pm} | 2 +- .../{CatalogReseller.pm => SetReseller.pm} | 4 +- lib/NGCP/Panel/Utils/Subscriber.pm | 19 ++- share/templates/subprofile/profile_list.tt | 12 +- .../subprofile/{cat_list.tt => set_list.tt} | 14 +- share/templates/subscriber/master.tt | 6 + 23 files changed, 188 insertions(+), 186 deletions(-) delete mode 100644 lib/NGCP/Panel/Field/SubscriberProfile.pm rename lib/NGCP/Panel/Field/{SubscriberProfileCatalog.pm => SubscriberProfileSet.pm} (80%) rename lib/NGCP/Panel/Form/SubscriberProfile/{CatalogAdmin.pm => SetAdmin.pm} (65%) rename lib/NGCP/Panel/Form/SubscriberProfile/{CatalogClone.pm => SetClone.pm} (94%) rename lib/NGCP/Panel/Form/SubscriberProfile/{CatalogReseller.pm => SetReseller.pm} (89%) rename share/templates/subprofile/{cat_list.tt => set_list.tt} (66%) diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index 4b99e72523..a17c313398 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -143,7 +143,6 @@ sub create_list :Chained('sub_list') :PathPart('create') :Args(0) :Does(ACL) :AC 'domain.create' => $c->uri_for('/domain/create'), 'reseller.create' => $c->uri_for('/reseller/create'), 'contract.create' => $c->uri_for('/customer/create'), - 'profile.create' => $c->uri_for('/subscriberprofile/create'), }, back_uri => $c->req->uri, ); @@ -163,26 +162,31 @@ sub create_list :Chained('sub_list') :PathPart('create') :Args(0) :Does(ACL) :AC ->find({domain => $billing_domain->domain}); my $reseller = $contract->contact->reseller; - my $profile; - if($form->values->{profile}{id}) { - my $profile_rs = $c->model('DB')->resultset('voip_subscriber_profiles'); + my ($profile_set, $profile); + if($form->values->{profile_set}{id}) { + my $profile_set_rs = $c->model('DB')->resultset('voip_subscriber_profile_sets'); if($c->user->roles eq "admin") { } elsif($c->user->roles eq "reseller") { - $profile_rs = $profile_rs->search({ + $profile_set_rs = $profile_set_rs->search({ reseller_id => $c->user->reseller_id, }); } - $profile = $profile_rs->find($form->values->{profile}{id}); - unless($profile) { + $profile_set = $profile_set_rs->find($form->values->{profile_set}{id}); + unless($profile_set) { NGCP::Panel::Utils::Message->error( c => $c, - error => 'invalid subscriber profile id ' . $form->values->{profile}{id}, - desc => $c->loc('Invalid subscriber profile id'), + error => 'invalid subscriber profile set id ' . $form->values->{profile_set}{id}, + desc => $c->loc('Invalid subscriber profile set id'), ); return; } - delete $form->values->{profile}; + delete $form->values->{profile_set}; + $profile = $profile_set->voip_subscriber_profiles->find({ + set_default => 1, + }); + # TODO should we report an error if no default profile is found? Otherwise + # the subscriber has full feature access. } my $billing_subscriber = $contract->voip_subscribers->create({ @@ -202,6 +206,7 @@ sub create_list :Chained('sub_list') :PathPart('create') :Args(0) :Does(ACL) :AC admin => $c->request->params->{administrative} || 0, account_id => $contract->id, domain_id => $prov_domain->id, + profile_set_id => $profile_set ? $profile_set->id : undef, profile_id => $profile ? $profile->id : undef, create_timestamp => NGCP::Panel::Utils::DateTime::current_local, }); @@ -1832,6 +1837,8 @@ sub edit_master :Chained('master') :PathPart('edit') :Args(0) :Does(ACL) :ACLDet $c->request->params->{status} = $subscriber->status; } unless($posted) { + $params->{profile_set}{id} = $prov_subscriber->voip_subscriber_profile_set ? + $prov_subscriber->voip_subscriber_profile_set->id : undef; $params->{profile}{id} = $prov_subscriber->voip_subscriber_profile ? $prov_subscriber->voip_subscriber_profile->id : undef; $params->{webusername} = $prov_subscriber->webusername; @@ -1892,7 +1899,6 @@ sub edit_master :Chained('master') :PathPart('edit') :Args(0) :Does(ACL) :ACLDet form => $form, fields => { $pbx_ext ? ('group.create' => $c->uri_for_action('/customer/pbx_group_create', [$prov_subscriber->account_id])) : (), - 'profile.create' => $c->uri_for_action('/subscriberprofile/create'), }, back_uri => $c->req->uri, ); @@ -1918,28 +1924,37 @@ sub edit_master :Chained('master') :PathPart('edit') :Args(0) :Does(ACL) :ACLDet if($pbx_ext); my $old_group_id = $prov_subscriber->pbx_group_id; - my $profile; - if($form->values->{profile}{id}) { - my $profile_rs = $c->model('DB')->resultset('voip_subscriber_profiles'); + my ($profile_set, $profile); + if($form->values->{profile_set}{id}) { + my $profile_set_rs = $c->model('DB')->resultset('voip_subscriber_profile_sets'); if($c->user->roles eq "admin") { } elsif($c->user->roles eq "reseller") { - $profile_rs = $profile_rs->search({ + $profile_set_rs = $profile_set_rs->search({ reseller_id => $c->user->reseller_id, }); } - $profile = $profile_rs->find($form->values->{profile}{id}); - unless($profile) { + $profile_set = $profile_set_rs->find($form->values->{profile_set}{id}); + unless($profile_set) { NGCP::Panel::Utils::Message->error( c => $c, - error => 'invalid subscriber profile id ' . $form->values->{profile}{id}, - desc => $c->loc('Invalid subscriber profile id'), + error => 'invalid subscriber profile set id ' . $form->values->{profile_set}{id}, + desc => $c->loc('Invalid subscriber profile set id'), ); return; } - delete $form->values->{profile}; - $prov_params->{profile_id} = $profile->id; + delete $form->values->{profile_set}; + $prov_params->{profile_set_id} = $profile_set->id; + + $profile = $profile_set->voip_subscriber_profiles->find({ + set_default => 1, + }); + $prov_params->{profile_id} = $profile ? $profile->id : undef; + + # TODO should we report an error if no default profile is found? Otherwise + # the subscriber has full feature access. } else { + $prov_params->{profile_set_id} = undef; $prov_params->{profile_id} = undef; } diff --git a/lib/NGCP/Panel/Controller/SubscriberProfile.pm b/lib/NGCP/Panel/Controller/SubscriberProfile.pm index 4e0e757e56..7443db5d52 100644 --- a/lib/NGCP/Panel/Controller/SubscriberProfile.pm +++ b/lib/NGCP/Panel/Controller/SubscriberProfile.pm @@ -3,10 +3,10 @@ use Sipwise::Base; BEGIN { extends 'Catalyst::Controller'; } -use NGCP::Panel::Form::SubscriberProfile::CatalogAdmin; -use NGCP::Panel::Form::SubscriberProfile::CatalogReseller; +use NGCP::Panel::Form::SubscriberProfile::SetAdmin; +use NGCP::Panel::Form::SubscriberProfile::SetReseller; use NGCP::Panel::Form::SubscriberProfile::Profile; -use NGCP::Panel::Form::SubscriberProfile::CatalogClone; +use NGCP::Panel::Form::SubscriberProfile::SetClone; use NGCP::Panel::Form::SubscriberProfile::ProfileClone; use NGCP::Panel::Utils::Message; use NGCP::Panel::Utils::Navigation; @@ -18,67 +18,67 @@ sub auto { return 1; } -sub catalog_list :Chained('/') :PathPart('subscriberprofile') :CaptureArgs(0) :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { +sub set_list :Chained('/') :PathPart('subscriberprofile') :CaptureArgs(0) { my ( $self, $c ) = @_; - $c->stash->{cat_rs} = $c->model('DB')->resultset('voip_subscriber_profile_catalogs'); + $c->stash->{set_rs} = $c->model('DB')->resultset('voip_subscriber_profile_sets'); if($c->user->roles eq "admin") { } elsif($c->user->roles eq "reseller") { - $c->stash->{cat_rs} = $c->stash->{cat_rs}->search({ + $c->stash->{set_rs} = $c->stash->{set_rs}->search({ reseller_id => $c->user->reseller_id }); } else { - $c->stash->{cat_rs} = $c->stash->{cat_rs}->search({ + $c->stash->{set_rs} = $c->stash->{set_rs}->search({ reseller_id => $c->user->voip_subscriber->contract->contact->reseller_id, }); } - $c->stash->{cat_dt_columns} = NGCP::Panel::Utils::Datatables::set_columns($c, [ + $c->stash->{set_dt_columns} = NGCP::Panel::Utils::Datatables::set_columns($c, [ { name => 'id', search => 1, title => $c->loc('#') }, { name => 'reseller.name', search => 1, title => $c->loc('Reseller') }, { name => 'name', search => 1, title => $c->loc('Name') }, { name => 'description', search => 1, title => $c->loc('Description') }, ]); - $c->stash(template => 'subprofile/cat_list.tt'); + $c->stash(template => 'subprofile/set_list.tt'); } -sub catalog_root :Chained('catalog_list') :PathPart('') :Args(0) { +sub set_root :Chained('set_list') :PathPart('') :Args(0) :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { my ($self, $c) = @_; } -sub catalog_ajax :Chained('catalog_list') :PathPart('ajax') :Args(0) { +sub set_ajax :Chained('set_list') :PathPart('ajax') :Args(0) :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { my ($self, $c) = @_; - my $rs = $c->stash->{cat_rs}; - NGCP::Panel::Utils::Datatables::process($c, $rs, $c->stash->{cat_dt_columns}); + my $rs = $c->stash->{set_rs}; + NGCP::Panel::Utils::Datatables::process($c, $rs, $c->stash->{set_dt_columns}); $c->detach( $c->view("JSON") ); } -sub catalog_base :Chained('catalog_list') :PathPart('') :CaptureArgs(1) { - my ($self, $c, $cat_id) = @_; +sub set_base :Chained('set_list') :PathPart('') :CaptureArgs(1) { + my ($self, $c, $set_id) = @_; - unless($cat_id && $cat_id->is_integer) { + unless($set_id && $set_id->is_integer) { NGCP::Panel::Utils::Message->error( c => $c, - log => 'Invalid subscriber profile catalog id detected', - desc => $c->loc('Invalid subscriber profile catalog id detected'), + log => 'Invalid subscriber profile set id detected', + desc => $c->loc('Invalid subscriber profile set id detected'), ); NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/subscriberprofile')); } - my $res = $c->stash->{cat_rs}->find($cat_id); + my $res = $c->stash->{set_rs}->find($set_id); unless(defined($res)) { NGCP::Panel::Utils::Message->error( c => $c, - log => 'Subscriber profile catalog does not exist', - desc => $c->loc('Subscriber profile catalog does not exist'), + log => 'Subscriber profile set does not exist', + desc => $c->loc('Subscriber profile set does not exist'), ); NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/subscriberprofile')); } - $c->stash(cat => $res); + $c->stash(set => $res); } -sub catalog_create :Chained('catalog_list') :PathPart('create') :Args(0) { +sub set_create :Chained('set_list') :PathPart('create') :Args(0) :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { my ($self, $c) = @_; my $posted = ($c->request->method eq 'POST'); @@ -86,9 +86,9 @@ sub catalog_create :Chained('catalog_list') :PathPart('create') :Args(0) { $params = $params->merge($c->session->{created_objects}); my $form; if($c->user->roles eq "admin") { - $form = NGCP::Panel::Form::SubscriberProfile::CatalogAdmin->new; + $form = NGCP::Panel::Form::SubscriberProfile::SetAdmin->new; } else { - $form = NGCP::Panel::Form::SubscriberProfile::CatalogReseller->new; + $form = NGCP::Panel::Form::SubscriberProfile::SetReseller->new; } $form->process( posted => $posted, @@ -114,16 +114,16 @@ sub catalog_create :Chained('catalog_list') :PathPart('create') :Args(0) { $form->values->{reseller_id} = $c->user->reseller_id; } delete $form->values->{reseller}; - $c->stash->{cat_rs}->create($form->values); + $c->stash->{set_rs}->create($form->values); delete $c->session->{created_objects}->{reseller}; }); - $c->flash(messages => [{type => 'success', text => $c->loc('Subscriber profile catalog successfully created')}]); + $c->flash(messages => [{type => 'success', text => $c->loc('Subscriber profile set successfully created')}]); } catch($e) { NGCP::Panel::Utils::Message->error( c => $c, error => $e, - desc => $c->loc('Failed to create subscriber profile catalog.'), + desc => $c->loc('Failed to create subscriber profile set.'), ); } NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/subscriberprofile')); @@ -133,19 +133,19 @@ sub catalog_create :Chained('catalog_list') :PathPart('create') :Args(0) { $c->stash(create_flag => 1); } -sub catalog_edit :Chained('catalog_base') :PathPart('edit') { +sub set_edit :Chained('set_base') :PathPart('edit') :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { my ($self, $c) = @_; - my $cat = $c->stash->{cat}; + my $set = $c->stash->{set}; my $posted = ($c->request->method eq 'POST'); - my $params = { $cat->get_inflated_columns }; + my $params = { $set->get_inflated_columns }; $params->{reseller}{id} = delete $params->{reseller_id}; $params = $params->merge($c->session->{created_objects}); my $form; if($c->user->roles eq "admin") { - $form = NGCP::Panel::Form::SubscriberProfile::CatalogAdmin->new; + $form = NGCP::Panel::Form::SubscriberProfile::SetAdmin->new; } else { - $form = NGCP::Panel::Form::SubscriberProfile::CatalogReseller->new; + $form = NGCP::Panel::Form::SubscriberProfile::SetReseller->new; } $form->process( posted => $posted, @@ -171,16 +171,16 @@ sub catalog_edit :Chained('catalog_base') :PathPart('edit') { $form->values->{reseller_id} = $c->user->reseller_id; } delete $form->values->{reseller}; - $cat->update($form->values); + $set->update($form->values); delete $c->session->{created_objects}->{reseller}; }); - $c->flash(messages => [{type => 'success', text => $c->loc('Subscriber profile catalog successfully updated')}]); + $c->flash(messages => [{type => 'success', text => $c->loc('Subscriber profile set successfully updated')}]); } catch($e) { NGCP::Panel::Utils::Message->error( c => $c, error => $e, - desc => $c->loc('Failed to update subscriber profile catalog.'), + desc => $c->loc('Failed to update subscriber profile set.'), ); } NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/subscriberprofile')); @@ -190,39 +190,39 @@ sub catalog_edit :Chained('catalog_base') :PathPart('edit') { $c->stash(edit_flag => 1); } -sub catalog_delete :Chained('catalog_base') :PathPart('delete') { +sub set_delete :Chained('set_base') :PathPart('delete') :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { my ($self, $c) = @_; try { my $schema = $c->model('DB'); $schema->txn_do(sub{ $schema->resultset('provisioning_voip_subscribers')->search({ - profile_catalog_id => $c->stash->{cat}->id + profile_set_id => $c->stash->{set}->id })->update({ - profile_catalog_id => undef, + profile_set_id => undef, profile_id => undef, }); - $c->stash->{cat}->voip_subscriber_profiles->delete; - $c->stash->{cat}->delete; + $c->stash->{set}->voip_subscriber_profiles->delete; + $c->stash->{set}->delete; }); - $c->flash(messages => [{type => 'success', text => $c->loc('Subscriber profile catalog successfully deleted')}]); + $c->flash(messages => [{type => 'success', text => $c->loc('Subscriber profile set successfully deleted')}]); } catch($e) { NGCP::Panel::Utils::Message->error( c => $c, error => $e, - desc => $c->loc('Failed to delete subscriber profile catalog.'), + desc => $c->loc('Failed to delete subscriber profile set.'), ); } NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/subscriberprofile')); } -sub catalog_clone :Chained('catalog_base') :PathPart('clone') :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { +sub set_clone :Chained('set_base') :PathPart('clone') :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { my ($self, $c) = @_; my $posted = ($c->request->method eq 'POST'); - my $params = { $c->stash->{cat}->get_inflated_columns }; + my $params = { $c->stash->{set}->get_inflated_columns }; $params = $params->merge($c->session->{created_objects}); - my $form = NGCP::Panel::Form::SubscriberProfile::CatalogClone->new; + my $form = NGCP::Panel::Form::SubscriberProfile::SetClone->new; $form->process( posted => $posted, params => $c->request->params, @@ -238,16 +238,16 @@ sub catalog_clone :Chained('catalog_base') :PathPart('clone') :Does(ACL) :ACLDet try { my $schema = $c->model('DB'); $schema->txn_do(sub { - my $new_cat = $schema->resultset('voip_subscriber_profile_catalogs')->create({ + my $new_set = $schema->resultset('voip_subscriber_profile_sets')->create({ %{ $form->values }, - reseller_id => $c->stash->{cat}->reseller_id, + reseller_id => $c->stash->{set}->reseller_id, }); - foreach my $prof($c->stash->{cat}->voip_subscriber_profiles->all) { + foreach my $prof($c->stash->{set}->voip_subscriber_profiles->all) { my $old = { $prof->get_inflated_columns }; - foreach(qw/id catalog_id/) { + foreach(qw/id set_id/) { delete $old->{$_}; } - my $new_prof = $new_cat->voip_subscriber_profiles->create($old); + my $new_prof = $new_set->voip_subscriber_profiles->create($old); my @old_attributes = $prof->profile_attributes->all; foreach my $attr (@old_attributes) { $new_prof->profile_attributes->create({ @@ -274,14 +274,14 @@ sub catalog_clone :Chained('catalog_base') :PathPart('clone') :Does(ACL) :ACLDet } -sub profile_list :Chained('catalog_base') :PathPart('profile') :CaptureArgs(0) { +sub profile_list :Chained('set_base') :PathPart('profile') :CaptureArgs(0) { my ( $self, $c ) = @_; $c->stash->{profile_dt_columns} = NGCP::Panel::Utils::Datatables::set_columns($c, [ { name => 'id', search => 1, title => $c->loc('#') }, { name => 'name', search => 1, title => $c->loc('Name') }, { name => 'description', search => 1, title => $c->loc('Description') }, - { name => 'catalog_default', search => 0, title => $c->loc('Default') }, + { name => 'set_default', search => 0, title => $c->loc('Default') }, ]); $c->stash(template => 'subprofile/profile_list.tt'); @@ -293,7 +293,7 @@ sub profile_root :Chained('profile_list') :PathPart('') :Args(0) :Does(ACL) :ACL sub profile_ajax :Chained('profile_list') :PathPart('ajax') :Args(0) { my ($self, $c) = @_; - my $rs = $c->stash->{cat}->voip_subscriber_profiles; + my $rs = $c->stash->{set}->voip_subscriber_profiles; NGCP::Panel::Utils::Datatables::process($c, $rs, $c->stash->{profile_dt_columns}); $c->detach( $c->view("JSON") ); } @@ -310,18 +310,18 @@ sub profile_base :Chained('profile_list') :PathPart('') :CaptureArgs(1) :Does(AC NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/rewrite')); } - my $res = $c->stash->{cat}->voip_subscriber_profiles->find($profile_id); + my $res = $c->stash->{set}->voip_subscriber_profiles->find($profile_id); unless(defined($res)) { NGCP::Panel::Utils::Message->error( c => $c, log => 'Subscriber profile does not exist', desc => $c->loc('Subscriber profile does not exist'), ); - NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{cat}->id])); + NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{set}->id])); } $c->stash( profile => $res, - close_target => $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{cat}->id]), + close_target => $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{set}->id]), ); } @@ -349,19 +349,19 @@ sub profile_create :Chained('profile_list') :PathPart('create') :Args(0) :Does(A my $schema = $c->model('DB'); $schema->txn_do(sub { my $attributes = delete $form->values->{attribute}; - if($form->values->{catalog_default}) { + if($form->values->{set_default}) { # new profile is default, clear any previous default profiles - $c->stash->{cat}->voip_subscriber_profiles->update({ - catalog_default => 0, + $c->stash->{set}->voip_subscriber_profiles->update({ + set_default => 0, }); - } elsif(!$c->stash->{cat}->voip_subscriber_profiles->search({ - catalog_default => 1, + } elsif(!$c->stash->{set}->voip_subscriber_profiles->search({ + set_default => 1, })->count) { # no previous default profile, make this one default - $form->values->{catalog_default} = 1; + $form->values->{set_default} = 1; } - my $profile = $c->stash->{cat}->voip_subscriber_profiles->create($form->values); + my $profile = $c->stash->{set}->voip_subscriber_profiles->create($form->values); # TODO: should we rather take the name and load the id from db, # instead of trusting the id coming from user input? @@ -381,7 +381,7 @@ sub profile_create :Chained('profile_list') :PathPart('create') :Args(0) :Does(A desc => $c->loc('Failed to create subscriber profile.'), ); } - NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{cat}->id])); + NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{set}->id])); } $c->stash(form => $form); @@ -415,19 +415,19 @@ sub profile_edit :Chained('profile_base') :PathPart('edit') :Does(ACL) :ACLDetac my $schema = $c->model('DB'); $schema->txn_do(sub { my $attributes = delete $form->values->{attribute}; - if($form->values->{catalog_default}) { + if($form->values->{set_default}) { # new profile is default, clear any previous default profiles - $c->stash->{cat}->voip_subscriber_profiles->search({ + $c->stash->{set}->voip_subscriber_profiles->search({ id => { '!=' => $profile->id }, })->update({ - catalog_default => 0, + set_default => 0, }); - } elsif(!$c->stash->{cat}->voip_subscriber_profiles->search({ - catalog_default => 1, + } elsif(!$c->stash->{set}->voip_subscriber_profiles->search({ + set_default => 1, })->count) { # no previous default profile, make this one default - $form->values->{catalog_default} = 1; + $form->values->{set_default} = 1; } $profile->update($form->values); @@ -453,7 +453,7 @@ sub profile_edit :Chained('profile_base') :PathPart('edit') :Does(ACL) :ACLDetac desc => $c->loc('Failed to update subscriber profile.'), ); } - NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{cat}->id])); + NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{set}->id])); } $c->stash(form => $form); @@ -473,11 +473,11 @@ sub profile_delete :Chained('profile_base') :PathPart('delete') :Does(ACL) :ACLD # TODO: set this to another profile, or reject deletion if profile is in use profile_id => undef, }); - if($profile->catalog_default && $c->stash->{cat}->voip_subscriber_profiles->count > 1) { - $c->stash->{cat}->voip_subscriber_profiles->search({ + if($profile->set_default && $c->stash->{set}->voip_subscriber_profiles->count > 1) { + $c->stash->{set}->voip_subscriber_profiles->search({ id => { '!=' => $profile->id }, })->first->update({ - catalog_default => 1, + set_default => 1, }); } $profile->delete; @@ -490,7 +490,7 @@ sub profile_delete :Chained('profile_base') :PathPart('delete') :Does(ACL) :ACLD desc => $c->loc('Failed to delete subscriber profile.'), ); } - NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{cat}->id])); + NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{set}->id])); } sub profile_clone :Chained('profile_base') :PathPart('clone') :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) { @@ -515,9 +515,9 @@ sub profile_clone :Chained('profile_base') :PathPart('clone') :Does(ACL) :ACLDet try { my $schema = $c->model('DB'); $schema->txn_do(sub { - $form->values->{catalog_default} = 0; - $form->values->{catalog_id} = $c->stash->{cat}->id; - my $new_profile = $c->stash->{cat}->voip_subscriber_profiles->create($form->values); + $form->values->{set_default} = 0; + $form->values->{set_id} = $c->stash->{set}->id; + my $new_profile = $c->stash->{set}->voip_subscriber_profiles->create($form->values); my @old_attributes = $c->stash->{profile}->profile_attributes->all; foreach my $attr (@old_attributes) { $new_profile->profile_attributes->create({ @@ -534,7 +534,7 @@ sub profile_clone :Chained('profile_base') :PathPart('clone') :Does(ACL) :ACLDet desc => $c->loc('Failed to clone subscriber profile.'), ); } - NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{cat}->id])); + NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for_action('/subscriberprofile/profile_root', [$c->stash->{set}->id])); } $c->stash(form => $form); diff --git a/lib/NGCP/Panel/Field/SubscriberProfile.pm b/lib/NGCP/Panel/Field/SubscriberProfile.pm deleted file mode 100644 index 0fde707cfd..0000000000 --- a/lib/NGCP/Panel/Field/SubscriberProfile.pm +++ /dev/null @@ -1,26 +0,0 @@ -package NGCP::Panel::Field::SubscriberProfile; -use HTML::FormHandler::Moose; -extends 'HTML::FormHandler::Field::Compound'; - -has_field 'id' => ( - type => '+NGCP::Panel::Field::DataTable', - label => 'Subscriber Profile', - do_label => 0, - do_wrapper => 0, - required => 1, - template => 'helpers/datatables_field.tt', - ajax_src => '/subscriberprofile/ajax', - table_titles => ['#', 'Reseller', 'Name'], - table_fields => ['id', 'reseller_name', 'name'], -); - -has_field 'create' => ( - type => 'Button', - do_label => 0, - value => 'Create Profile', - element_class => [qw/btn btn-tertiary pull-right/], -); - -1; - -# vim: set tabstop=4 expandtab: diff --git a/lib/NGCP/Panel/Field/SubscriberProfileCatalog.pm b/lib/NGCP/Panel/Field/SubscriberProfileSet.pm similarity index 80% rename from lib/NGCP/Panel/Field/SubscriberProfileCatalog.pm rename to lib/NGCP/Panel/Field/SubscriberProfileSet.pm index 62e89ed336..96e801087b 100644 --- a/lib/NGCP/Panel/Field/SubscriberProfileCatalog.pm +++ b/lib/NGCP/Panel/Field/SubscriberProfileSet.pm @@ -1,10 +1,10 @@ -package NGCP::Panel::Field::SubscriberProfileCatalog; +package NGCP::Panel::Field::SubscriberProfileSet; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Field::Compound'; has_field 'id' => ( type => '+NGCP::Panel::Field::DataTable', - label => 'Subscriber Profile Catalog', + label => 'Profile Set', do_label => 0, do_wrapper => 0, required => 1, @@ -14,11 +14,13 @@ has_field 'id' => ( table_fields => ['id', 'reseller_name', 'name', 'description'], ); +=pod has_field 'create' => ( type => 'Button', do_label => 0, - value => 'Create Profile Catalog', + value => 'Create Profile Set', element_class => [qw/btn btn-tertiary pull-right/], ); +=cut 1; diff --git a/lib/NGCP/Panel/Form/Customer/PbxAdminSubscriber.pm b/lib/NGCP/Panel/Form/Customer/PbxAdminSubscriber.pm index c3a80b1426..5d4c9d1565 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxAdminSubscriber.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxAdminSubscriber.pm @@ -22,7 +22,7 @@ has_field 'domain' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/domain e164 display_name webusername webpassword username password status external_id profile/ ], + render_list => [qw/domain e164 display_name webusername webpassword username password status external_id profile_set/ ], ); 1; diff --git a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriber.pm b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriber.pm index d8dbbc7dd3..f1e9ce0808 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriber.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriber.pm @@ -23,7 +23,7 @@ has_field 'extension' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/group extension display_name webusername webpassword username password status external_id profile/ ], + render_list => [qw/group extension display_name webusername webpassword username password status external_id profile_set/ ], ); sub field_list { diff --git a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEdit.pm b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEdit.pm index 84c9874b04..7e52f6fbea 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEdit.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEdit.pm @@ -23,7 +23,7 @@ has_field 'extension' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/group extension display_name webusername webpassword password status external_id profile/ ], + render_list => [qw/group extension display_name webusername webpassword password status external_id profile_set/ ], ); sub update_fields { diff --git a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditAdmin.pm b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditAdmin.pm index 71a879efc8..668f8a72e8 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditAdmin.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditAdmin.pm @@ -27,7 +27,7 @@ has_field 'alias_number_add' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/group extension alias_number alias_number_add display_name webusername webpassword password status external_id profile/ ], + render_list => [qw/group extension alias_number alias_number_add display_name webusername webpassword password status external_id profile_set/ ], ); 1; diff --git a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditSubadmin.pm b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditSubadmin.pm index df325e9e62..c88921483d 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditSubadmin.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditSubadmin.pm @@ -19,7 +19,7 @@ has_field 'alias_select' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/group extension display_name webusername webpassword password external_id alias_select profile/ ], + render_list => [qw/group extension display_name webusername webpassword password external_id alias_select profile_set/ ], ); sub update_fields { diff --git a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditSubadminNoGroup.pm b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditSubadminNoGroup.pm index 933ca6a899..136a2e5025 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditSubadminNoGroup.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxExtensionSubscriberEditSubadminNoGroup.pm @@ -19,7 +19,7 @@ has_field 'alias_select' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/display_name webusername webpassword password external_id alias_select profile/ ], + render_list => [qw/display_name webusername webpassword password external_id alias_select profile_set/ ], ); sub update_fields { diff --git a/lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm b/lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm index 32f52b712b..eb2a42535a 100644 --- a/lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm +++ b/lib/NGCP/Panel/Form/Customer/PbxSubscriber.pm @@ -81,13 +81,13 @@ has_field 'external_id' => ( }, ); -has_field 'profile' => ( - type => '+NGCP::Panel::Field::SubscriberProfile', +has_field 'profile_set' => ( + type => '+NGCP::Panel::Field::SubscriberProfileSet', label => 'Subscriber Profile', validate_when_empty => 0, element_attr => { rel => ['tooltip'], - title => ['The subscriber profile defining the feature set for this subscriber.'] + title => ['The profile set defining the possible feature sets for this subscriber.'] }, ); @@ -102,7 +102,7 @@ has_field 'save' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/display_name webusername webpassword username password status external_id profile/ ], + render_list => [qw/display_name webusername webpassword username password status external_id profile_set/ ], ); has_block 'actions' => ( diff --git a/lib/NGCP/Panel/Form/Customer/Subscriber.pm b/lib/NGCP/Panel/Form/Customer/Subscriber.pm index 6539051695..9625ab81b5 100644 --- a/lib/NGCP/Panel/Form/Customer/Subscriber.pm +++ b/lib/NGCP/Panel/Form/Customer/Subscriber.pm @@ -98,13 +98,13 @@ has_field 'external_id' => ( }, ); -has_field 'profile' => ( - type => '+NGCP::Panel::Field::SubscriberProfile', +has_field 'profile_set' => ( + type => '+NGCP::Panel::Field::SubscriberProfileSet', label => 'Subscriber Profile', validate_when_empty => 0, element_attr => { rel => ['tooltip'], - title => ['The subscriber profile defining the feature set for this subscriber.'] + title => ['The profile set defining the possible feature sets for this subscriber.'] }, ); @@ -120,7 +120,7 @@ has_field 'save' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/domain e164 webusername webpassword username password status external_id administrative profile/ ], + render_list => [qw/domain e164 webusername webpassword username password status external_id administrative profile_set/ ], ); has_block 'actions' => ( diff --git a/lib/NGCP/Panel/Form/Subscriber.pm b/lib/NGCP/Panel/Form/Subscriber.pm index a4d0ce8bb6..dcf57bfeeb 100644 --- a/lib/NGCP/Panel/Form/Subscriber.pm +++ b/lib/NGCP/Panel/Form/Subscriber.pm @@ -122,13 +122,13 @@ has_field 'external_id' => ( }, ); -has_field 'profile' => ( - type => '+NGCP::Panel::Field::SubscriberProfile', +has_field 'profile_set' => ( + type => '+NGCP::Panel::Field::SubscriberProfileSet', label => 'Subscriber Profile', validate_when_empty => 0, element_attr => { rel => ['tooltip'], - title => ['The subscriber profile defining the feature set for this subscriber.'] + title => ['The profile set defining the possible feature sets for this subscriber.'] }, ); @@ -144,7 +144,7 @@ has_field 'save' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/contract domain e164 webusername webpassword username password status external_id administrative profile/ ], + render_list => [qw/contract domain e164 webusername webpassword username password status external_id administrative profile_set/ ], ); has_block 'actions' => ( diff --git a/lib/NGCP/Panel/Form/SubscriberEdit.pm b/lib/NGCP/Panel/Form/SubscriberEdit.pm index e2283e3b34..def0317dbd 100644 --- a/lib/NGCP/Panel/Form/SubscriberEdit.pm +++ b/lib/NGCP/Panel/Form/SubscriberEdit.pm @@ -111,13 +111,13 @@ has_field 'external_id' => ( }, ); -has_field 'profile' => ( - type => '+NGCP::Panel::Field::SubscriberProfile', - label => 'Subscriber Profile', +has_field 'profile_set' => ( + type => '+NGCP::Panel::Field::SubscriberProfileSet', + label => 'Profile Set', validate_when_empty => 0, element_attr => { rel => ['tooltip'], - title => ['The subscriber profile defining the feature set for this subscriber.'] + title => ['The profile set defining the possible feature sets for this subscriber.'] }, ); @@ -132,7 +132,7 @@ has_field 'save' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/e164 alias_number alias_number_add webusername webpassword password lock status external_id administrative profile/ ], + render_list => [qw/e164 alias_number alias_number_add webusername webpassword password lock status external_id administrative profile_set/ ], ); has_block 'actions' => ( diff --git a/lib/NGCP/Panel/Form/SubscriberProfile/ApiProfile.pm b/lib/NGCP/Panel/Form/SubscriberProfile/ApiProfile.pm index 9434691d53..2ac79425c8 100644 --- a/lib/NGCP/Panel/Form/SubscriberProfile/ApiProfile.pm +++ b/lib/NGCP/Panel/Form/SubscriberProfile/ApiProfile.pm @@ -4,19 +4,19 @@ use HTML::FormHandler::Moose; extends 'NGCP::Panel::Form::SubscriberProfile::ProfileReseller'; use Moose::Util::TypeConstraints; -has_field 'catalog' => ( - type => '+NGCP::Panel::Field::SubscriberProfileCatalog', +has_field 'profile_set' => ( + type => '+NGCP::Panel::Field::SubscriberProfileSet', validate_when_empty => 1, element_attr => { rel => ['tooltip'], - title => ['The subscriber profile catalog this profile belongs to.'], + title => ['The profile set defining the possible feature sets for this subscriber.'] }, ); has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/catalog name description catalog_default/], + render_list => [qw/profile_set name description profile_default/], ); 1; diff --git a/lib/NGCP/Panel/Form/SubscriberProfile/Profile.pm b/lib/NGCP/Panel/Form/SubscriberProfile/Profile.pm index af51026dde..49566edbc2 100644 --- a/lib/NGCP/Panel/Form/SubscriberProfile/Profile.pm +++ b/lib/NGCP/Panel/Form/SubscriberProfile/Profile.pm @@ -29,13 +29,13 @@ has_field 'description' => ( }, ); -has_field 'catalog_default' => ( +has_field 'set_default' => ( type => 'Boolean', label => 'Default Profile', required => 0, element_attr => { rel => ['tooltip'], - title => ['Make this profile automatically the default profile for new subscribers having this profile catalog.'], + title => ['Make this profile automatically the default profile for new subscribers having this profile set.'], }, ); @@ -55,7 +55,7 @@ has_field 'save' => ( has_block 'fields' => ( tag => 'div', class => [qw/modal-body/], - render_list => [qw/name description catalog_default attribute/], + render_list => [qw/name description set_default attribute/], ); has_block 'actions' => ( diff --git a/lib/NGCP/Panel/Form/SubscriberProfile/CatalogAdmin.pm b/lib/NGCP/Panel/Form/SubscriberProfile/SetAdmin.pm similarity index 65% rename from lib/NGCP/Panel/Form/SubscriberProfile/CatalogAdmin.pm rename to lib/NGCP/Panel/Form/SubscriberProfile/SetAdmin.pm index d25e9fdb13..531e0ca5cb 100644 --- a/lib/NGCP/Panel/Form/SubscriberProfile/CatalogAdmin.pm +++ b/lib/NGCP/Panel/Form/SubscriberProfile/SetAdmin.pm @@ -1,7 +1,7 @@ -package NGCP::Panel::Form::SubscriberProfile::CatalogAdmin; +package NGCP::Panel::Form::SubscriberProfile::SetAdmin; use HTML::FormHandler::Moose; -extends 'NGCP::Panel::Form::SubscriberProfile::CatalogReseller'; +extends 'NGCP::Panel::Form::SubscriberProfile::SetReseller'; use Moose::Util::TypeConstraints; has_field 'reseller' => ( @@ -9,7 +9,7 @@ has_field 'reseller' => ( validate_when_empty => 1, element_attr => { rel => ['tooltip'], - title => ['The reseller this Subscriber Profile Catalog belongs to.'], + title => ['The reseller this Subscriber Profile Set belongs to.'], }, ); diff --git a/lib/NGCP/Panel/Form/SubscriberProfile/CatalogClone.pm b/lib/NGCP/Panel/Form/SubscriberProfile/SetClone.pm similarity index 94% rename from lib/NGCP/Panel/Form/SubscriberProfile/CatalogClone.pm rename to lib/NGCP/Panel/Form/SubscriberProfile/SetClone.pm index d8069f3967..5bf9fdb3ec 100644 --- a/lib/NGCP/Panel/Form/SubscriberProfile/CatalogClone.pm +++ b/lib/NGCP/Panel/Form/SubscriberProfile/SetClone.pm @@ -1,4 +1,4 @@ -package NGCP::Panel::Form::SubscriberProfile::CatalogClone; +package NGCP::Panel::Form::SubscriberProfile::SetClone; use HTML::FormHandler::Moose; extends 'HTML::FormHandler'; diff --git a/lib/NGCP/Panel/Form/SubscriberProfile/CatalogReseller.pm b/lib/NGCP/Panel/Form/SubscriberProfile/SetReseller.pm similarity index 89% rename from lib/NGCP/Panel/Form/SubscriberProfile/CatalogReseller.pm rename to lib/NGCP/Panel/Form/SubscriberProfile/SetReseller.pm index 676914b45a..cccd6fb235 100644 --- a/lib/NGCP/Panel/Form/SubscriberProfile/CatalogReseller.pm +++ b/lib/NGCP/Panel/Form/SubscriberProfile/SetReseller.pm @@ -1,4 +1,4 @@ -package NGCP::Panel::Form::SubscriberProfile::CatalogReseller; +package NGCP::Panel::Form::SubscriberProfile::SetReseller; use HTML::FormHandler::Moose; extends 'HTML::FormHandler'; @@ -16,7 +16,7 @@ has_field 'name' => ( required => 1, element_attr => { rel => ['tooltip'], - title => ['The name of the Subscriber Profile Catalog.'], + title => ['The name of the Subscriber Profile Set.'], }, ); diff --git a/lib/NGCP/Panel/Utils/Subscriber.pm b/lib/NGCP/Panel/Utils/Subscriber.pm index d588f4ece5..16d5b98f81 100644 --- a/lib/NGCP/Panel/Utils/Subscriber.pm +++ b/lib/NGCP/Panel/Utils/Subscriber.pm @@ -141,20 +141,24 @@ sub create_subscriber { my $prov_domain = $schema->resultset('voip_domains') ->find({domain => $billing_domain->domain}); - my $profile; - if($params->{profile}{id}) { - my $profile_rs = $c->model('DB')->resultset('voip_subscriber_profiles'); + my ($profile_set, $profile); + if($params->{profile_set}{id}) { + my $profile_set_rs = $c->model('DB')->resultset('voip_subscriber_profile_sets'); if($c->user->roles eq "admin") { } elsif($c->user->roles eq "reseller") { - $profile_rs = $profile_rs->search({ + $profile_set_rs = $profile_set_rs->search({ reseller_id => $c->user->reseller_id, }); } - $profile = $profile_rs->find($params->{profile}{id}); - unless($profile) { - $c->log->error("invalid subscriber profile id '".$params->{profile}{id}."' detected"); + $profile_set = $profile_set_rs->find($params->{profile_set}{id}); + unless($profile_set) { + $c->log->error("invalid subscriber profile set id '".$params->{profile_set}{id}."' detected"); return; } + # TODO: use profile from user input if given + $profile = $profile_set->voip_subscriber_profiles->find({ + set_default => 1, + }); } $schema->txn_do(sub { @@ -203,6 +207,7 @@ sub create_subscriber { domain_id => $prov_domain->id, is_pbx_group => $params->{is_pbx_group} // 0, pbx_group_id => $params->{pbx_group_id}, + profile_set_id => $profile_set ? $profile_set->id : undef, profile_id => $profile ? $profile->id : undef, create_timestamp => NGCP::Panel::Utils::DateTime::current_local, }); diff --git a/share/templates/subprofile/profile_list.tt b/share/templates/subprofile/profile_list.tt index 82f090a93d..c3d2ff7deb 100644 --- a/share/templates/subprofile/profile_list.tt +++ b/share/templates/subprofile/profile_list.tt @@ -1,4 +1,4 @@ -[% site_config.title = c.loc('Subscriber Profiles for catalog [_1]', cat.name) -%] +[% site_config.title = c.loc('Subscriber Profiles for Profile Set [_1]', set.name) -%] [% helper.name = c.loc('Subscriber Profile'); helper.identifier = 'subscriber_profile'; @@ -18,17 +18,17 @@ UNLESS c.user.read_only; helper.dt_buttons = [ - { name = c.loc('Edit'), uri = "/subscriberprofile/" _ cat.id _ "/profile/'+full.id+'/edit", class = 'btn-small btn-primary', icon = 'icon-edit' }, - { name = c.loc('Delete'), uri = "/subscriberprofile/" _ cat.id _ "/profile/'+full.id+'/delete", class = 'btn-small btn-secondary', icon = 'icon-trash' }, - { name = c.loc('Clone'), uri = "/subscriberprofile/" _ cat.id _ "/profile/'+full.id+'/clone", class = 'btn-small btn-tertiary', icon = 'icon-retweet' }, + { name = c.loc('Edit'), uri = "/subscriberprofile/" _ set.id _ "/profile/'+full.id+'/edit", class = 'btn-small btn-primary', icon = 'icon-edit' }, + { name = c.loc('Delete'), uri = "/subscriberprofile/" _ set.id _ "/profile/'+full.id+'/delete", class = 'btn-small btn-secondary', icon = 'icon-trash' }, + { name = c.loc('Clone'), uri = "/subscriberprofile/" _ set.id _ "/profile/'+full.id+'/clone", class = 'btn-small btn-tertiary', icon = 'icon-retweet' }, ]; helper.top_buttons = [ - { name = c.loc('Profile Catalogs'), uri = c.uri_for('/subscriberprofile'), icon = 'icon-list' }, + { name = c.loc('Profile Sets'), uri = c.uri_for('/subscriberprofile'), icon = 'icon-list' }, { name = c.loc('Create Subscriber Profile'), uri = c.uri_for_action('/subscriberprofile/profile_create', c.req.captures), icon = 'icon-star' }, ]; ELSE; helper.top_buttons = [ - { name = c.loc('Profile Catalogs'), uri = c.uri_for('/subscriberprofile'), icon = 'icon-list' }, + { name = c.loc('Profile Sets'), uri = c.uri_for('/subscriberprofile'), icon = 'icon-list' }, ]; END; diff --git a/share/templates/subprofile/cat_list.tt b/share/templates/subprofile/set_list.tt similarity index 66% rename from share/templates/subprofile/cat_list.tt rename to share/templates/subprofile/set_list.tt index 1710123b80..534dfa7b5f 100644 --- a/share/templates/subprofile/cat_list.tt +++ b/share/templates/subprofile/set_list.tt @@ -1,19 +1,19 @@ -[% site_config.title = c.loc('Subscriber Profile Catalogs') -%] +[% site_config.title = c.loc('Subscriber Profile Sets') -%] [% - helper.name = c.loc('Subscriber Profile Catalogs'); - helper.identifier = 'subscriber_profile_catalogs'; + helper.name = c.loc('Subscriber Profile Sets'); + helper.identifier = 'subscriber_profile_sets'; helper.messages = messages; - helper.dt_columns = cat_dt_columns; + helper.dt_columns = set_dt_columns; helper.length_change = 1; helper.close_target = close_target; helper.create_flag = create_flag; helper.edit_flag = edit_flag; helper.form_object = form; - helper.ajax_uri = c.uri_for_action( "/subscriberprofile/catalog_ajax" ); + helper.ajax_uri = c.uri_for_action( "/subscriberprofile/set_ajax" ); IF clone_flag; - helper.name = c.loc('cloned Subscriber Profile Catalog'); + helper.name = c.loc('cloned Subscriber Profile Set'); END; UNLESS c.user.read_only; @@ -24,7 +24,7 @@ { name = c.loc('Profiles'), uri = "/subscriberprofile/'+full.id+'/profile", class = 'btn-small btn-primary', icon = 'icon-list' }, ]; helper.top_buttons = [ - { name = c.loc('Create Subscriber Profile Catalog'), uri = c.uri_for_action('/subscriberprofile/catalog_create'), icon = 'icon-star' }, + { name = c.loc('Create Subscriber Profile Set'), uri = c.uri_for_action('/subscriberprofile/set_create'), icon = 'icon-star' }, ]; END; diff --git a/share/templates/subscriber/master.tt b/share/templates/subscriber/master.tt index 958719503b..231d01b012 100644 --- a/share/templates/subscriber/master.tt +++ b/share/templates/subscriber/master.tt @@ -90,6 +90,12 @@ [% END -%] + + [% c.loc('Subscriber Profile Set') %] + + [% subscriber.provisioning_voip_subscriber.voip_subscriber_profile_set.name %] + + [% c.loc('Subscriber Profile') %]