X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Ftimeworked.html;h=24a0f5d40fe9f48f42820ec24c80b8c903c32ec8;hb=bb7e827141c9ed68f30765c9ca2ddcd1d760ad2d;hp=2b288f2337a90c51def8d8290c7f87ad2db05e26;hpb=1293d137b061f097190eda53e4e78214e18832e6;p=freeside.git diff --git a/httemplate/misc/timeworked.html b/httemplate/misc/timeworked.html index 2b288f233..24a0f5d40 100755 --- a/httemplate/misc/timeworked.html +++ b/httemplate/misc/timeworked.html @@ -1,48 +1,104 @@ <% include('/elements/header.html', $title, '' ) %> -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } +<% include('/elements/error.html') %>
-

-<% include("elements/customer-table.html", header => [ 'Multiplier' ], - fields => [ 'multiplier' ], - param => { %param }, - ) %> + -
- -
-
+ + + + + + + + + + + +% foreach my $tr_id ( keys %ticketmap ) { +% my (@customers) = @{$customers{$ticketmap{$tr_id}}}; +% next unless @customers; +% my $default_multiplier = sprintf("%.2f", 1/@customers); +% my ($custnum, $name) = split(':', pop @customers, 2); +% my $link = $p. 'rt/Ticket/Display.html?id='. $ticketmap{$tr_id}. +% '#txn-'. $tr_id; +% my $clink = $p. 'view/cust_main.cgi?'. $custnum; + + + + + +% my $seconds = 0; +% if ( $cgi->param("seconds$tr_id") =~ /^(\d+)$/ ) { +% $seconds = $1; +% } + + + + + + + +% foreach ( @customers ) { +% ($custnum, $name) = split(':', $_, 2); +% $clink = $p. 'view/cust_main.cgi?'. $custnum; -for transactions/tickets: -
TicketHoursCustomerMultiplier
<% $ticketmap{$tr_id} %><% $ticket{$ticketmap{$tr_id}} |h %><% sprintf("%0.2f", $seconds/3600) %><% $custnum %><% $name %> + + + +% my $multiplier = $default_multiplier; +% my $mult_paramname = "multiplier${tr_id}_$custnum"; +% if ( $cgi->param($mult_paramname) =~ /^\s*([\d\.]+)\s*$/ ) { +% $multiplier = $1; +% } + + +
+ + + + - - " > + -% } + + + + +% } +% } + +
<% $custnum %><% $name %> -% foreach ( sort { $a <=> $b } keys %ticket ) { +% $multiplier = $default_multiplier; +% $mult_paramname = "multiplier${tr_id}_$custnum"; +% if ( $cgi->param($mult_paramname) =~ /^\s*([\d\.]+)\s*$/ ) { +% $multiplier = $1; +% } -
<% $_ %><% $ticket{$_} %>
+ +
+ + + + + +
- - + +<% include('/elements/footer.html') %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Time queue'); -my($svcnum, %ticket, %customers, %param); +my(%ticketmap, %ticket, %customers); my $title = 'Assign Time Worked'; - -RT::Init(); +tie %ticketmap, 'Tie::IxHash'; my $CurrentUser = RT::CurrentUser->new(); $CurrentUser->LoadByName($FS::CurrentUser::CurrentUser->username); @@ -51,27 +107,24 @@ foreach my $id ( map { /^transactionid(\d+)$/; $1; } grep /^transactionid\d+$/, $cgi->param) { my $transaction = new RT::Transaction($CurrentUser); $transaction->Load($id); - my $ticket = new RT::Ticket($CurrentUser); - $ticket->Load($transaction->ObjectId); - $ticket{$id} = $ticket->Subject; - foreach my $customerURI ( - grep { $_->Resolver->{'fstable'} eq 'cust_main' } - grep { $_->Scheme eq 'freeside' } - map { $_->TargetURI } - @{ $ticket->_Links('Base')->ItemsArrayRef } - ) { - $customers{$customerURI->Resolver->AsString} = 1; + $ticketmap{$id} = $transaction->ObjectId; + unless(exists($ticket{$ticketmap{$id}})) { + my $ticket = new RT::Ticket($CurrentUser); + $ticket->Load($ticketmap{$id}); + $ticket{$ticketmap{$id}} = $ticket->Subject; + $customers{$ticketmap{$id}} = + [ map { $_->Resolver->AsString } + grep { $_->Resolver->{'fstable'} eq 'cust_main' } + grep { $_->Scheme eq 'freeside' } + map { $_->TargetURI } + grep { $_->BaseURI->Scheme eq 'fsck.com-rt' + && $_->BaseURI->Resolver->ObjectType eq 'ticket' + } + @{ $ticket->_Links('Base')->ItemsArrayRef } + ]; + } } -my $row = 0; -foreach ( keys %customers ) { - my ($number, $name) = split(':', $_, 2); - $param{"custnum$row"} = $number; - $param{"customer$row"} = $name; - $param{"multiplier$row"} = sprintf("%.2f", 1/scalar(keys(%customers))); - $row++; -} -