X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Felements%2Frate_detail.html;h=32dd502cec50ef54b4cb14afc8814254bfface3e;hb=ecf1c9cc0a20be6e489657e005ea771977b9f69c;hp=72a86aee78aa0129c299b8ceb086fce4318dfc62;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git
diff --git a/httemplate/edit/elements/rate_detail.html b/httemplate/edit/elements/rate_detail.html
index 72a86aee7..32dd502ce 100644
--- a/httemplate/edit/elements/rate_detail.html
+++ b/httemplate/edit/elements/rate_detail.html
@@ -47,31 +47,85 @@ with row headers showing the region name and prefixes.
% }
% foreach my $rate_time (@rate_time, '') {
-% my $detail = $details[$row][$col];
-% if($detail) {
+ <& .detail_box,
+ detail => $details[$row][$col],
+ ratetimenum => ($rate_time ? $rate_time->ratetimenum : ''),
+ cdrtypenum => $cdrtypenum,
+ regionnum => $region->regionnum,
+ ratenum => $rate->ratenum
+ &>
+% $col++;
+ |
+% } # foreach @rate_time
+
+% $row++;
+% }# foreach @rate_region
+% if ( !$opt{regionnum} ) {
+% # global default for this cdrtypenum
+
+
+ Global default (for calls not matching any prefix)
+ |
+
+% # default rate: set a null region for this cdr type
+
+ <& .detail_box,
+ detail => $rate->default_detail($cdrtypenum),
+ ratetimenum => '',
+ cdrtypenum => $cdrtypenum,
+ regionnum => '',
+ ratenum => $rate->ratenum
+ &>
+
+ |
+% }
+
+<%def .detail_box>
+<%args>
+$detail => undef,
+$ratetimenum
+$cdrtypenum
+$regionnum
+$ratenum
+%args>
+% if ($detail) {
- <% edit_link($detail) %><% $money_char.$detail->min_charge %>
+ |
<% edit_link($detail) %>
+% if ( $detail->min_charge > 0 or $detail->conn_charge > 0) {
+ <% $money_char.$detail->min_charge %>
<% $detail->sec_granularity ? ' / minute':' / call' %>
+% if ( $detail->min_cost ) {
+ (<% $money_char.$detail->min_cost %> cost)
+% }
+% if ( $detail->upstream_mult_charge > 0
+% or $detail->upstream_mult_cost > 0) {
+ +
+% }
+% }
+% if ( $detail->upstream_mult_charge > 0
+% or $detail->upstream_mult_cost > 0) {
+ <% $detail->upstream_mult_charge %> × upstream price
+% if ( $detail->upstream_mult_cost > 0 ) {
+ (<% $detail->upstream_mult_cost %> cost)
+% }
+% }
+% if ( $detail->upstream_mult_charge == 0
+% and $detail->min_charge == 0
+% and $detail->conn_charge == 0 ) {
+ Free
+% }
<% $edit_hint %>
|
<% granularity_detail($detail) %>
<% min_included_detail($detail) %>
<% conn_charge_detail($detail) %>
- <% ( $rate_time || $cdrtypenum ) ? delete_link($detail) : '' %>
+ |
<% ( $ratetimenum || $cdrtypenum ) ? delete_link($detail) : '' %>
|
-% }
-% else { #!$detail
- <% add_link($rate, $region, $rate_time, $cdrtypenum) %>
-% }
-% $col++;
-
-% } # foreach @rate_time
-
-% $row++;
-% }# foreach @rate_region
-
-
+% } else {
+ <% add_link($ratenum, $regionnum, $ratetimenum, $cdrtypenum) %>
+% }
+%def>
<%once>
tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
@@ -92,25 +146,27 @@ sub edit_link {
include( '/elements/popup_link_onclick.html',
'action' => "${p}edit/rate_detail.html?$ratedetailnum",
'actionlabel' => 'Edit rate',
- 'height' => 420,
+ 'height' => 550,
+ 'width' => 580,
#default# 'width' => 540,
#default# 'color' => '#333399',
) . '">'
}
sub add_link {
- my ($rate, $region, $rate_time, $cdrtypenum) = @_;
+ my ($ratenum, $regionnum, $ratetimenum, $cdrtypenum) = @_;
'ratenum.
+ $ratenum.
';dest_regionnum='.
- $region->regionnum.
+ $regionnum.
';ratetimenum='.
- ($rate_time ? $rate_time->ratetimenum : '').
+ ($ratetimenum || '').
";cdrtypenum=$cdrtypenum",
'actionlabel' => 'Add rate',
- 'height' => 420,
+ 'width' => 580,
+ 'height' => 550,
).'">'.small('(add)').''
}
@@ -130,7 +186,10 @@ sub delete_link {
sub granularity_detail {
my $rate_detail = shift;
- if($rate_detail->sec_granularity != 60 && $rate_detail->sec_granularity > 0) {
+ if(
+ $rate_detail->sec_granularity != 60
+ && $rate_detail->sec_granularity > 0
+ && $rate_detail->min_charge > 0) {
''.
small('in '.$granularity{$rate_detail->sec_granularity}.' increments').
' |
';
@@ -157,7 +216,11 @@ sub conn_charge_detail {
#return '' unless $rate_detail->conn_charge > 0 || $rate_detail->conn_sec;
''.
small( $money_char. $rate_detail->conn_charge.
- ' for '.$conn_secs{$rate_detail->conn_sec}
+ ( $rate_detail->conn_cost
+ ? ' ('. $money_char.$rate_detail->conn_cost. ' cost)'
+ : ''
+ ).
+ ' for '. $conn_secs{$rate_detail->conn_sec}
).
' |
'
}
@@ -204,10 +267,10 @@ if ( $ratenum ) {
)";
}
@rows = qsearch({ table => 'rate_region',
- hashref => { },
+ hashref => {},
extra_sql => $where,
});
- die "no region found" if !@rows;
+ #die "no region found" if !@rows;
unshift @header, 'Region', 'Prefix(es)';
unshift @hlinks, '', '';