event refactor, landing on HEAD!
[freeside.git] / httemplate / edit / process / svc_acct.cgi
index 65ac5c1..d9aac9f 100755 (executable)
@@ -25,7 +25,7 @@
 %
 %#unmunge bytecounts
 %foreach (map { $_,$_."_threshold" } qw( upbytes downbytes totalbytes )) {
-%  $cgi->param($_, FS::UI::Web::parse_bytecount($cgi->param($_)) );
+%  $cgi->param($_, FS::UI::bytecount::parse_bytecount($cgi->param($_)) );
 %}
 %
 %my %hash = $svcnum ? $old->hash : ();
 %
 %my $error;
 %if ( $svcnum ) {
-%  $error = $new->replace($old);
+%  foreach (grep { $old->$_ != $new->$_ } qw( seconds upbytes downbytes totalbytes )) {
+%    my %hash = map { $_ => $new->$_ } 
+%               grep { $new->$_ }
+%               qw( seconds upbytes downbytes totalbytes );
+%
+%    $error = $new->set_usage(\%hash);  #unoverlimit and trigger radius changes
+%    last;                              #once is enough
+%  }
+%  $error ||= $new->replace($old);
 %} else {
 %  $error = $new->insert;
 %  $svcnum = $new->svcnum;