diff options
author | Mark Wells <mark@freeside.biz> | 2015-10-23 12:03:24 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-10-23 12:03:44 -0700 |
commit | 275239995f6b9888e470e4128287fba4d56df790 (patch) | |
tree | e6a3829999913b97d9e7d9cc992429c6d242ca0d /httemplate | |
parent | 05959a9336936ec1d6e0ad8641a47d2f8dd515cf (diff) |
allow a default rate detail for each CDR type, #38633
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/browse/part_pkg.cgi | 8 | ||||
-rw-r--r-- | httemplate/edit/elements/rate_detail.html | 8 | ||||
-rw-r--r-- | httemplate/edit/process/rate_detail.html | 16 | ||||
-rw-r--r-- | httemplate/edit/rate.cgi | 10 |
4 files changed, 23 insertions, 19 deletions
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 11eca6702..376799582 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -88,6 +88,14 @@ if ( $cgi->param('missing_recur_fee') ) { )"; } +if ( $cgi->param('ratenum') =~ /^(\d+)$/ ) { + push @where, "EXISTS( SELECT 1 FROM part_pkg_option + WHERE optionname LIKE '%ratenum' + AND optionvalue = '$1' + AND part_pkg_option.pkgpart = part_pkg.pkgpart + )"; +} + if ( $cgi->param('family') =~ /^(\d+)$/ ) { $family_pkgpart = $1; push @where, "family_pkgpart = $1"; diff --git a/httemplate/edit/elements/rate_detail.html b/httemplate/edit/elements/rate_detail.html index 7b5ec314a..32dd502ce 100644 --- a/httemplate/edit/elements/rate_detail.html +++ b/httemplate/edit/elements/rate_detail.html @@ -61,18 +61,18 @@ with row headers showing the region name and prefixes. % $row++; % }# foreach @rate_region % if ( !$opt{regionnum} ) { -%# global default +% # global default for this cdrtypenum <TR> <TD COLSPAN=2 STYLE="padding-top: 10px"> <B>Global default</B> (for calls not matching any prefix) </TD> <TD STYLE="padding-top: 10px"> -% # default rate: set a null region +% # default rate: set a null region for this cdr type <B> <& .detail_box, - detail => $rate->default_detail, + detail => $rate->default_detail($cdrtypenum), ratetimenum => '', - cdrtypenum => '', + cdrtypenum => $cdrtypenum, regionnum => '', ratenum => $rate->ratenum &> diff --git a/httemplate/edit/process/rate_detail.html b/httemplate/edit/process/rate_detail.html index f8a744418..4020ce9e2 100644 --- a/httemplate/edit/process/rate_detail.html +++ b/httemplate/edit/process/rate_detail.html @@ -2,7 +2,7 @@ 'table' => 'rate_detail', 'popup_reload' => 'Rate changed', #a popup "parent reload" for now #someday change the individual element and go away instead - 'noerror_callback' => $set_default_detail + #'noerror_callback' => $set_default_detail &> <%init> @@ -12,19 +12,11 @@ die "access denied" my $set_default_detail = sub { my ($cgi, $rate_detail) = @_; - if (!$rate_detail->dest_regionnum) { + if (!$rate_detail->dest_regionnum and !$rate_detail->cdrtypenum) { # then this is a global default rate + # default_detailnum is no longer used, but maintain it anyway (and point + # it at the one with null cdrtypenum) my $rate = $rate_detail->rate; - if ($rate->default_detailnum) { - if ($rate->default_detailnum == $rate_detail->ratedetailnum) { - return; - } else { - # there's somehow an existing default rate. remove it. - my $old_default = $rate->default_detail; - my $error = $old_default->delete; - die "$error (removing old default rate)\n" if $error; - } - } $rate->set('default_detailnum' => $rate_detail->ratedetailnum); my $error = $rate->replace; die "$error (setting default rate)\n" if $error; diff --git a/httemplate/edit/rate.cgi b/httemplate/edit/rate.cgi index 1b052d62d..5bfc108c1 100644 --- a/httemplate/edit/rate.cgi +++ b/httemplate/edit/rate.cgi @@ -1,7 +1,11 @@ -<% include("/elements/header.html","$action Rate plan", menubar( +<& /elements/header.html, + "$action Rate plan", + menubar( 'View all rate plans' => "${p}browse/rate.cgi", - )) -%> + 'View packages that use this plan' => "${p}browse/part_pkg.cgi?ratenum=" + . $rate->ratenum, + ) +&> <% include('/elements/progress-init.html', 'OneTrueForm', |