MT#6693 Move pbx group features to subscriber.

agranig/subprof
Andreas Granig 11 years ago
parent 21f257ebed
commit d5932b5644

@ -155,13 +155,6 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"voip_pbx_groups",
"NGCP::Schema::Result::voip_pbx_groups",
{ "foreign.contract_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"autoprov_field_devices",
"NGCP::Schema::Result::autoprov_field_devices",

@ -39,6 +39,21 @@ __PACKAGE__->add_columns(
{ data_type => "varchar", is_nullable => 1, size => 40 },
"pbx_group_id",
{ data_type => "integer", extra => { unsigned => 1 }, is_nullable => 1 },
"pbx_hunt_policy",
{
data_type => "enum",
default_value => "serial",
extra => { list => ["serial", "parallel"] },
is_nullable => 1,
},
"pbx_hunt_timeout",
{
data_type => "integer",
extra => { unsigned => 1 },
is_nullable => 1,
},
"pbx_extension",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"profile_set_id",
{ data_type => "integer", extra => { unsigned => 1 }, is_nullable => 1 },
"profile_id",
@ -139,6 +154,13 @@ __PACKAGE__->might_have(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->belongs_to(
"voip_pbx_group",
"NGCP::Schema::Result::voip_subscribers",
{ "foreign.id" => "self.pbx_group_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->might_have(
"voip_reminder",
"NGCP::Schema::Result::voip_reminder",
@ -167,13 +189,6 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->belongs_to(
"voip_pbx_group",
"NGCP::Schema::Result::voip_pbx_groups",
{ 'foreign.id' => 'self.pbx_group_id' },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"autoprov_field_device_lines",
"NGCP::Schema::Result::autoprov_field_device_lines",
@ -452,9 +467,3 @@ Related object: L<NGCP::Schema::Result::voip_trusted_sources>
Type: has_many
Related object: L<NGCP::Schema::Result::voip_usr_preferences>
=head2 voip_pbx_group
Type: belongs_to
Related object: L<NGCP::Schema::Result::voip_pbx_groups>

@ -1,176 +0,0 @@
package NGCP::Schema::Result::voip_pbx_groups;
use Scalar::Util qw(blessed);
use parent 'DBIx::Class::Core';
our $VERSION = '2.007';
__PACKAGE__->load_components("Helper::Row::ToJSON");
__PACKAGE__->table("provisioning.voip_pbx_groups");
__PACKAGE__->add_columns(
"id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"contract_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
"subscriber_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
"name",
{ data_type => "varchar", is_nullable => 0, size => 255 },
"extension",
{ data_type => "varchar", is_nullable => 0, size => 255 },
"hunt_policy",
{
data_type => "enum",
default_value => "serial",
extra => { list => ["serial", "parallel"] },
is_nullable => 0,
},
"hunt_policy_timeout",
{
data_type => "integer",
extra => { unsigned => 1 },
is_nullable => 0,
},
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to(
"contract",
"NGCP::Schema::Result::contracts",
{ id => "contract_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->belongs_to(
"provisioning_voip_subscriber",
"NGCP::Schema::Result::provisioning_voip_subscribers",
{ id => "subscriber_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->has_many(
"provisioning_voip_subscribers",
"NGCP::Schema::Result::provisioning_voip_subscribers",
{ "foreign.pbx_group_id" => "self.id" },
#{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
{ cascade_copy => 0, cascade_delete => 0 },
);
sub TO_JSON {
my ($self) = @_;
return {
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
};
}
1;
__END__
=encoding UTF-8
=head1 NAME
NGCP::Schema::Result::voip_pbx_groups
=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::Helper::Row::ToJSON>
=back
=head1 TABLE: C<provisioning.voip_pbx_groups>
=head1 ACCESSORS
=head2 id
data_type: 'integer'
extra: {unsigned => 1}
is_auto_increment: 1
is_nullable: 0
=head2 contract_id
data_type: 'integer'
extra: {unsigned => 1}
is_foreign_key: 1
is_nullable: 0
=head2 subscriber_id
data_type: 'integer'
extra: {unsigned => 1}
is_foreign_key: 1
is_nullable: 0
=head2 name
data_type: 'varchar'
is_nullable: 0
size: 255
=head2 extension
data_type: 'varchar'
is_nullable: 0
size: 255
=head2 hunt_policy
data_type: 'enum'
default_value: 'serial'
extra: {list => ["serial","parallel"]}
is_nullable: 0
=head2 hunt_policy_timeout
data_type: 'integer'
extra: {unsigned => 1}
is_nullable: 0
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=head1 RELATIONS
=head2 contract
Type: belongs_to
Related object: L<NGCP::Schema::Result::contracts>
=head2 provisioning_voip_subscriber
Type: belongs_to
Related object: L<NGCP::Schema::Result::provisioning_voip_subscribers>
=head2 provisioning_voip_subscribers
Type: has_many
Related object: L<NGCP::Schema::Result::provisioning_voip_subscribers>
Loading…
Cancel
Save