diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-05-15 14:59:34 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-05-15 14:59:34 -0700 |
commit | 1bea3acc9951c272bd9f5f872d3262c9380e067f (patch) | |
tree | 99e6a28e7d89b577cacc39884f523a18296ac68a /FS | |
parent | 747fee2b23da71a4c124d610850bc55f71fcaa3c (diff) |
agent-virtualize VoIP rates, RT#29183
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/AccessRight.pm | 3 | ||||
-rw-r--r-- | FS/FS/Schema.pm | 5 | ||||
-rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 14 | ||||
-rw-r--r-- | FS/FS/part_pkg/voip_sqlradacct.pm | 5 | ||||
-rw-r--r-- | FS/FS/rate.pm | 15 |
5 files changed, 22 insertions, 20 deletions
diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index 9903541c4..a5eef2f2f 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -357,6 +357,9 @@ tie my %rights, 'Tie::IxHash', 'Bulk edit package definitions', + 'Edit CDR rates', + #{ rightname=>'Edit global CDR rates', global=>1, }, + 'Edit fee definitions', { rightname=>'Edit global fee definitions', global=>1 }, diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 86acbbf55..9f30f804a 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -3309,8 +3309,9 @@ sub tables_hashref { 'rate' => { 'columns' => [ - 'ratenum', 'serial', '', '', '', '', - 'ratename', 'varchar', '', $char_d, '', '', + 'ratenum', 'serial', '', '', '', '', + 'ratename', 'varchar', '', $char_d, '', '', + 'agentnum', 'int', 'NULL', '', '', '', ], 'primary_key' => 'ratenum', 'unique' => [], diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index ba5e711bc..d7bf16d96 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -12,7 +12,7 @@ use FS::cdr; use FS::detail_format; #use FS::rate; #use FS::rate_prefix; -#use FS::rate_detail; +#use FS::rate_detail; #for ::granularities $DEBUG = 0; @@ -108,19 +108,13 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash', }, 'ratenum' => { 'name' => 'Rate plan', - 'type' => 'select', - 'select_table' => 'rate', - 'select_key' => 'ratenum', - 'select_label' => 'ratename', + 'type' => 'select-rate', }, 'intrastate_ratenum' => { 'name' => 'Optional alternate intrastate rate plan', - 'type' => 'select', - 'select_table' => 'rate', - 'select_key' => 'ratenum', - 'select_label' => 'ratename', + 'type' => 'select-rate', 'disable_empty' => 0, - 'empty_label' => '', + 'empty_label' => ' ', }, 'calls_included' => { 'name' => 'Number of calls included at no usage charge', }, diff --git a/FS/FS/part_pkg/voip_sqlradacct.pm b/FS/FS/part_pkg/voip_sqlradacct.pm index b856b5cda..00ed3f69d 100644 --- a/FS/FS/part_pkg/voip_sqlradacct.pm +++ b/FS/FS/part_pkg/voip_sqlradacct.pm @@ -19,10 +19,7 @@ $DEBUG = 1; 'inherit_fields' => [ 'global_Mixin' ], 'fields' => { 'ratenum' => { 'name' => 'Rate plan', - 'type' => 'select', - 'select_table' => 'rate', - 'select_key' => 'ratenum', - 'select_label' => 'ratename', + 'type' => 'select-rate', }, }, 'fieldorder' => [qw( ratenum ignore_unrateable )], diff --git a/FS/FS/rate.pm b/FS/FS/rate.pm index 49ac938fd..88e93b6f1 100644 --- a/FS/FS/rate.pm +++ b/FS/FS/rate.pm @@ -3,6 +3,7 @@ package FS::rate; use strict; use vars qw( @ISA $DEBUG ); use FS::Record qw( qsearch qsearchs dbh fields ); +#use FS::agent; #causes a weird dep loop in freeside-cdrrated, only needed for v3-style manual FK-checking, so, probably not bother use FS::rate_detail; @ISA = qw(FS::Record); @@ -35,10 +36,18 @@ FS::Record. The following fields are currently supported: =over 4 -=item ratenum - primary key +=item ratenum + +primary key =item ratename +Rate name + +=item agentnum + +Optional agent (see L<FS::agent>) for agent-virtualized rates. + =back =head1 METHODS @@ -254,15 +263,13 @@ and replace methods. =cut -# the check method should currently be supplied - FS::Record contains some -# data checking routines - sub check { my $self = shift; my $error = $self->ut_numbern('ratenum') || $self->ut_text('ratename') + #|| $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum') ; return $error if $error; |