diff options
author | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
commit | c82d349f864e6bd9f96fd1156903bc1f7193a203 (patch) | |
tree | e117a87533656110b6acd56fc0ca64289892a9f5 /httemplate/misc/process/timeworked.html | |
parent | 74e058c8a010ef6feb539248a550d0bb169c1e94 (diff) |
This commit was manufactured by cvs2svn to create tag 'TORRUS_1_0_9'.TORRUS_1_0_9
Diffstat (limited to 'httemplate/misc/process/timeworked.html')
-rw-r--r-- | httemplate/misc/process/timeworked.html | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/httemplate/misc/process/timeworked.html b/httemplate/misc/process/timeworked.html deleted file mode 100644 index 200a7511d..000000000 --- a/httemplate/misc/process/timeworked.html +++ /dev/null @@ -1,59 +0,0 @@ -% if ($error) { -<% $cgi->redirect(popurl(2). "timeworked.html?". $cgi->query_string) %> -% } else { -<% $cgi->redirect(popurl(3). "search/timeworked.html?begin=$begin;end=$end") %> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Time queue'); - -my($begin, $end) = FS::UI::Web::parse_beginning_ending($cgi); - -my @acct_rt_transaction; -foreach my $transaction ( - map { /^transactionid(\d+)$/; $1; } grep /^transactionid\d+$/, $cgi->param -) { - my $s = "multiplier${transaction}_"; - my %multipliers = map { /^$s(\d+)$/; $1 => $cgi->param("$s$1"); } - grep /^$s\d+$/, $cgi->param; - my $msum = 0; - foreach(values %multipliers) {$msum += $_}; - - my $seconds = $cgi->param("seconds$transaction"); - my %seconds = - map { $_ => sprintf("%.0f", $seconds * $multipliers{$_} / $msum) } - (keys %multipliers); - my $sum = 0; - my $count = 0; - foreach (values %seconds) { - $sum += $_; - $count++; - } - - #fudge in some time if we're close - if (abs($seconds-$sum) <= $count) { - my $adjustment = $seconds-$sum; - foreach (keys %seconds) { # explicitly choose one? - $seconds{$_} += $adjustment; - last; - } - } else { - die "unexpectedly cannot apportion time"; - } - - foreach my $customer ( grep {$seconds{$_}} keys %seconds ) { - push @acct_rt_transaction, new FS::acct_rt_transaction { - 'custnum' => $customer, - 'transaction_id' => $transaction, - 'seconds' => $seconds{$customer}, - 'support' => int( $seconds{$customer} * $msum ), - }; - } - -} - -my $error = FS::acct_rt_transaction->batch_insert(@acct_rt_transaction); -$cgi->param('error', $error) if $error; - -</%init> |