<& 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; } };