From c371f6e225cfffa667815a51571203b034e4f75c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 10 Jan 2008 21:53:49 +0000 Subject: [PATCH] new rate editor --- FS/FS/rate_detail.pm | 37 ++++++ httemplate/browse/rate.cgi | 76 +++++++++---- httemplate/edit/elements/edit.html | 4 + httemplate/edit/process/rate_region.cgi | 95 ++++++++-------- httemplate/edit/rate.cgi | 112 +++---------------- httemplate/edit/rate_region.cgi | 192 +++++++++++++++++++------------- 6 files changed, 274 insertions(+), 242 deletions(-) diff --git a/FS/FS/rate_detail.pm b/FS/FS/rate_detail.pm index 6f023f575..7f8c89eba 100644 --- a/FS/FS/rate_detail.pm +++ b/FS/FS/rate_detail.pm @@ -126,6 +126,18 @@ sub check { $self->SUPER::check; } +=item rate + +Returns the parent call plan (see L) associated with this call plan +rate. + +=cut + +sub rate { + my $self = shift; + qsearchs('rate', { 'ratenum' => $self->ratenum } ); +} + =item orig_region Returns the origination region (see L) associated with this @@ -150,6 +162,31 @@ sub dest_region { qsearchs('rate_region', { 'regionnum' => $self->dest_regionnum } ); } +=item dest_regionname + +Returns the name of the destination region (see L) associated +with this call plan rate. + +=cut + +sub dest_regionname { + my $self = shift; + $self->dest_region->regionname; +} + +=item dest_regionname + +Returns a short list of the prefixes for the destination region +(see L) associated with this call plan rate. + +=cut + +sub dest_prefixes_short { + my $self = shift; + $self->dest_region->prefixes_short; +} + + =back =head1 BUGS diff --git a/httemplate/browse/rate.cgi b/httemplate/browse/rate.cgi index 584891aea..b20c45c0c 100644 --- a/httemplate/browse/rate.cgi +++ b/httemplate/browse/rate.cgi @@ -1,34 +1,64 @@ <% include( 'elements/browse.html', - 'title' => 'Rate plans', - 'menubar' => [ 'Main menu' => $p, ], - 'html_init' => $html_init, - 'name' => 'rate plans', - 'query' => { 'table' => 'rate', - 'hashref' => {}, - 'extra_sql' => 'ORDER BY ratenum', - }, - 'count_query' => $count_query, - 'header' => [ '#', 'Rate plan', ], - 'fields' => [ 'ratenum', 'ratename' ], - 'links' => [ $link, $link ], - ) + 'title' => 'Rate plans', + 'menubar' => [ 'Regions and Prefixes' => + $p.'browse/rate_region.html', + ], + 'html_init' => $html_init, + 'name' => 'rate plans', + 'query' => { 'table' => 'rate', + 'hashref' => {}, + 'extra_sql' => 'ORDER BY ratenum', + }, + 'count_query' => $count_query, + 'header' => [ '#', 'Rate plan', 'Rates' ], + 'fields' => [ 'ratenum', 'ratename', $rates_sub ], + 'links' => [ $link, $link, '' ], + ) %> +<%once> + +my $sth = dbh->prepare("SELECT DISTINCT(countrycode) FROM rate_prefix") + or die dbh->errstr; +$sth->execute or die $sth->errstr; +my @all_countrycodes = map $_->[0], @{ $sth->fetchall_arrayref }; +my $all_countrycodes = join("\n", map qq(