diff options
-rw-r--r-- | FS/FS/rate.pm | 15 | ||||
-rw-r--r-- | httemplate/edit/rate.cgi | 4 |
2 files changed, 14 insertions, 5 deletions
diff --git a/FS/FS/rate.pm b/FS/FS/rate.pm index 347bb2743..793846a7f 100644 --- a/FS/FS/rate.pm +++ b/FS/FS/rate.pm @@ -364,6 +364,7 @@ sub process { 'dest_regionnum' => $regionnum, map { $_ => $param->{"$_$regionnum"} } qw( min_included min_charge sec_granularity ) + #qw( min_included conn_charge conn_sec min_charge sec_granularity ) }; } else { @@ -371,6 +372,9 @@ sub process { new FS::rate_detail { 'dest_regionnum' => $regionnum, 'min_included' => 0, + 'conn_charge' => 0, + 'conn_sec' => 0, + 'conn_charge' => 0, 'min_charge' => 0, 'sec_granularity' => '60' }; @@ -387,10 +391,13 @@ sub process { my $error = ''; if ( $param->{'ratenum'} ) { warn "$rate replacing $old (". $param->{'ratenum'}. ")\n" if $DEBUG; - $error = $rate->replace( $old, - 'rate_detail' => \@rate_detail, - 'job' => $job, - ); + + my @param = ( 'job'=>$job ); + push @param, 'rate_detail'=>\@rate_detail + unless $param->{'preserve_rate_detail'}; + + $error = $rate->replace( $old, @param ); + } else { warn "inserting $rate\n" if $DEBUG; $error = $rate->insert( 'rate_detail' => \@rate_detail, diff --git a/httemplate/edit/rate.cgi b/httemplate/edit/rate.cgi index 4c0abfe01..75c714322 100644 --- a/httemplate/edit/rate.cgi +++ b/httemplate/edit/rate.cgi @@ -5,7 +5,7 @@ <% include('/elements/progress-init.html', 'OneTrueForm', - [ 'rate', 'min_', 'sec_' ], + [ 'rate', 'preserve_rate_detail' ], # 'rate', 'min_', 'sec_' ], 'process/rate.cgi', $p.'browse/rate.cgi', ) @@ -17,6 +17,8 @@ Rate plan <INPUT TYPE="text" NAME="ratename" SIZE=32 VALUE="<% $rate->ratename %>"> <BR><BR> +<INPUT TYPE="hidden" NAME="preserve_rate_detail" VALUE="1"> + <INPUT NAME="submit" TYPE="button" VALUE="<% $rate->ratenum ? "Apply changes" : "Add rate plan" %>" onClick="document.OneTrueForm.submit.disabled=true; process();"> |