summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-10-23 12:03:24 -0700
committerMark Wells <mark@freeside.biz>2015-10-23 12:03:24 -0700
commit0806f9fdbf2086671c151b3bcb078dc008e96f6c (patch)
treee080f82837c48e909a6b69df31cbbf795deb2b24 /httemplate/edit/process
parentd9085d3f37cd6e9b1bad068cfdce945053cf669f (diff)
allow a default rate detail for each CDR type, #38633
Diffstat (limited to 'httemplate/edit/process')
-rw-r--r--httemplate/edit/process/rate_detail.html16
1 files changed, 4 insertions, 12 deletions
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;