diff options
author | ivan <ivan> | 2010-03-21 23:13:24 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-03-21 23:13:24 +0000 |
commit | bf4223e554e0eb72f45f82392442780e8af4e0f9 (patch) | |
tree | 5896ceb5a364afe44441a18b786387d9683a907c /httemplate | |
parent | 366d237dfb842d9bcbdf43477cb5eabef8fe6686 (diff) |
connection fee for initial N seconds support, RT#7018
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/rate_detail.html | 20 | ||||
-rwxr-xr-x | httemplate/edit/process/rate_region.cgi | 2 | ||||
-rw-r--r-- | httemplate/edit/rate_detail.html | 11 | ||||
-rw-r--r-- | httemplate/edit/rate_region.cgi | 28 | ||||
-rw-r--r-- | httemplate/misc/process/copy-rate_detail.html | 2 | ||||
-rw-r--r-- | httemplate/misc/rate_edit_excel.html | 9 |
6 files changed, 62 insertions, 10 deletions
diff --git a/httemplate/browse/rate_detail.html b/httemplate/browse/rate_detail.html index 23bc23ff8..3371926b4 100644 --- a/httemplate/browse/rate_detail.html +++ b/httemplate/browse/rate_detail.html @@ -15,6 +15,7 @@ 'Region', 'Prefix(es)', 'Included<BR>minutes', + 'Connection<BR>charge', 'Charge per<BR>minute', 'Granularity', 'Usage class', @@ -22,12 +23,9 @@ 'fields' => [ 'regionname', sub { shift->dest_region->prefixes_short }, - sub { shift->min_included. - ' <FONT SIZE="-1">(edit)</FONT>'; - }, - sub { $money_char. shift->min_charge. - ' <FONT SIZE="-1">(edit)</FONT>'; - }, + sub { shift->min_included. $edit_hint }, + $conn_charge_sub, + sub { $money_char. shift->min_charge. $edit_hint }, sub { $granularity{ shift->sec_granularity } }, 'classname', ], @@ -39,6 +37,7 @@ <%once> tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; @@ -59,6 +58,15 @@ my $edit_onclick = sub { #default# 'color' => '#333399', ); }; +my $edit_hint = ' <FONT SIZE="-1">(edit)</FONT>'; + +my $conn_charge_sub = sub { + my $rate_detail = shift; + #return '' unless $rate_detail->conn_charge > 0 || $rate_detail->conn_sec; + $money_char. $rate_detail->conn_charge. + ($rate_detail->conn_sec ? ' for '.$conn_secs{$rate_detail->conn_sec} : ''). + $edit_hint; +}; </%once> <%init> diff --git a/httemplate/edit/process/rate_region.cgi b/httemplate/edit/process/rate_region.cgi index 882991e9d..8036f7388 100755 --- a/httemplate/edit/process/rate_region.cgi +++ b/httemplate/edit/process/rate_region.cgi @@ -39,7 +39,7 @@ my @dest_detail = map { new FS::rate_detail { 'ratenum' => $ratenum, map { $_ => $cgi->param("$_$ratenum") } - qw( min_included min_charge sec_granularity classnum ) + qw( min_included conn_charge conn_sec min_charge sec_granularity classnum ) }; } qsearch('rate', {} ); diff --git a/httemplate/edit/rate_detail.html b/httemplate/edit/rate_detail.html index dd8c3f6b3..869ace8d4 100644 --- a/httemplate/edit/rate_detail.html +++ b/httemplate/edit/rate_detail.html @@ -6,6 +6,8 @@ 'dest_regionname' => 'Region', 'dest_prefixes_short' => 'Prefix(es)', 'min_included' => 'Included minutes/calls', + 'conn_charge' => 'Connection charge', + 'conn_sec' => 'For', 'min_charge' => 'Charge per minute/call', 'sec_granularity' => 'Granularity', 'classnum' => 'Usage class', @@ -17,6 +19,13 @@ { field=>'dest_regionname', type=>'fixed', }, { field=>'dest_prefixes_short', type=>'fixed', }, { field=>'min_included', type=>'text', size=>5 }, + { field=>'conn_charge', type=>'money', size=>4 }, + { field =>'conn_sec', + type =>'select', + options => [ keys %conn_secs ], + labels => \%conn_secs, + disable_empty => 1, + }, { field=>'min_charge', type=>'money', size=>4 }, { field =>'sec_granularity', type =>'select', @@ -38,9 +47,9 @@ <%once> tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); </%once> - <%init> my $conf = new FS::Conf; diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index 9ca3a3569..f77c0dbe7 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -52,6 +52,12 @@ <FONT SIZE=-1>Included<BR>minutes/calls</FONT> </TH> <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Connection<BR>charge</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Connection<BR>charge for</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> <FONT SIZE=-1>Charge per<BR>minute/call</FONT> </TH> <TH CLASS="grid" BGCOLOR="#cccccc"> @@ -88,7 +94,20 @@ </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - $<INPUT TYPE="text" SIZE=6 NAME="min_charge<%$n%>" VALUE="<% $cgi->param("min_charge$n") || $rate_detail->min_charge |h %>"> + <%$money_char%><INPUT TYPE="text" SIZE=9 NAME="conn_charge<%$n%>" VALUE="<% $cgi->param("conn_charge$n") || $rate_detail->conn_charge |h %>"> + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <SELECT NAME="conn_sec<%$n%>"> +% foreach my $conn_sec ( keys %conn_secs ) { +% my $curr_value = $cgi->param("conn_sec$n") || $rate_detail->conn_sec; +% my $selected = ($conn_sec==$curr_value) ? ' SELECTED' : ''; + <OPTION VALUE="<% $conn_sec %>" <%$selected%>><% $conn_secs{$conn_sec} %></OPTION> +% } + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <%$money_char%><INPUT TYPE="text" SIZE=6 NAME="min_charge<%$n%>" VALUE="<% $cgi->param("min_charge$n") || $rate_detail->min_charge |h %>"> </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> @@ -125,12 +144,19 @@ </FORM> <% include('/elements/footer.html') %> +<%once> + +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); +</%once> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + my $rate_region; if ( $cgi->param('error') ) { $rate_region = new FS::rate_region ( { diff --git a/httemplate/misc/process/copy-rate_detail.html b/httemplate/misc/process/copy-rate_detail.html index 87a674566..60b2aebee 100644 --- a/httemplate/misc/process/copy-rate_detail.html +++ b/httemplate/misc/process/copy-rate_detail.html @@ -47,7 +47,7 @@ foreach my $countrycode ( @countrycodes ) { || new FS::rate_detail \%hash; $dst_rate_detail->$_( $src_rate_detail->get($_) ) - foreach qw( min_included min_charge sec_granularity classnum ); + foreach qw( min_included conn_charge conn_sec min_charge sec_granularity classnum ); my $method = $dst_rate_detail->ratedetailnum ? 'replace' : 'insert'; diff --git a/httemplate/misc/rate_edit_excel.html b/httemplate/misc/rate_edit_excel.html index e73133c05..442d83aca 100644 --- a/httemplate/misc/rate_edit_excel.html +++ b/httemplate/misc/rate_edit_excel.html @@ -1,5 +1,9 @@ <% include('/elements/header.html', 'Edit rates with Excel' ) %> +% if ( $have_conn ) { + <FONT COLOR="#FF0000">WARNING: This functionality does not yet preserve connection charges.</FONT><BR><BR> +% } + <% include( '/elements/form-file_upload.html', 'name' => 'RateImportForm', 'action' => 'process/rate_edit_excel.html', @@ -58,4 +62,9 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $sth = dbh->prepare('SELECT COUNT(*) FROM rate_detail WHERE conn_charge > 0 OR conn_sec > 0 LIMIT 1') + or die dbh->errstr; +$sth->execute or die $sth->errstr; +my $have_conn = $sth->fetchrow_arrayref->[0]; + </%init> |