%#unmunge usergroup
%$cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] );
%
+%#unmunge bytecounts
+%foreach (map { $_,$_."_threshold" } qw( upbytes downbytes totalbytes )) {
+% $cgi->param($_, FS::UI::bytecount::parse_bytecount($cgi->param($_)) );
+%}
+%
%my %hash = $svcnum ? $old->hash : ();
%map {
% $hash{$_} = scalar($cgi->param($_));
%
%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;