summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/rate_detail.html
blob: 4020ce9e2587fcd6d086af20304e17b01433b88c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<& elements/process.html,
  '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
&>
<%init>

my $conf = new FS::Conf;
die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $set_default_detail = sub {
  my ($cgi, $rate_detail) = @_;
  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;
    $rate->set('default_detailnum' => $rate_detail->ratedetailnum);
    my $error = $rate->replace;
    die "$error (setting default rate)\n" if $error;
  }
};

</%init>