From: ivan Date: Fri, 14 May 2010 02:16:30 +0000 (+0000) Subject: fix losing rates when renaming a rate plan, RT#8173 X-Git-Tag: root_of_svc_elec_features~275 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=b4f0a47a6893de5f6b11f32307a0195f43a359fb fix losing rates when renaming a rate plan, RT#8173 --- 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

+ + " onClick="document.OneTrueForm.submit.disabled=true; process();">