1 <% include('/elements/header.html', $title, '' ) %>
3 <% include('/elements/error.html') %>
5 <FORM NAME="timeworked_form" ACTION="<% popurl(1) %>process/timeworked.html" METHOD=POST>
7 <TABLE CELLSPACING="2" CELLPADDING="2" RULES="groups" FRAME="hsides">
11 <TH COLSPAN="2">Ticket</TH>
13 <TH COLSPAN="2">Customer</TH>
20 % foreach my $tr_id ( keys %ticketmap ) {
21 % my (@customers) = @{$customers{$ticketmap{$tr_id}}};
22 % next unless @customers;
23 % my $default_multiplier = sprintf("%.2f", 1/@customers);
24 % my ($custnum, $name) = split(':', pop @customers, 2);
25 % my $link = $p. 'rt/Ticket/Display.html?id='. $ticketmap{$tr_id}.
27 % my $clink = $p. 'view/cust_main.cgi?'. $custnum;
30 <TD><a href="<% $link %>"><% $ticketmap{$tr_id} %></a></TD>
31 <TD><a href="<% $link %>"><% $ticket{$ticketmap{$tr_id}} |h %></a></TD>
34 % if ( $cgi->param("seconds$tr_id") =~ /^(\d+)$/ ) {
38 <TD><% sprintf("%0.2f", $seconds/3600) %></TD>
39 <TD ALIGN="right"><a href="<% $clink %>"><% $custnum %></a></TD>
40 <TD ALIGN="right"><a href="<% $clink %>"><% $name %></a></TD>
42 <INPUT TYPE="hidden" NAME="transactionid<%$tr_id%>" VALUE="1" >
43 <INPUT TYPE="hidden" NAME="seconds<%$tr_id%>" VALUE="<% $seconds %>" >
45 % my $multiplier = $default_multiplier;
46 % my $mult_paramname = "multiplier${tr_id}_$custnum";
47 % if ( $cgi->param($mult_paramname) =~ /^\s*([\d\.]+)\s*$/ ) {
51 <INPUT TYPE="text" NAME="<% $mult_paramname %>" SIZE="5" VALUE="<% $multiplier %>" >
55 % foreach ( @customers ) {
56 % ($custnum, $name) = split(':', $_, 2);
57 % $clink = $p. 'view/cust_main.cgi?'. $custnum;
60 <TD ALIGN="right" COLSPAN="4" ><a href="<% $clink %>"><% $custnum %></a></TD>
61 <TD ALIGN="right"><a href="<% $clink %>"><% $name %></a></TD>
64 % $multiplier = $default_multiplier;
65 % $mult_paramname = "multiplier${tr_id}_$custnum";
66 % if ( $cgi->param($mult_paramname) =~ /^\s*([\d\.]+)\s*$/ ) {
70 <INPUT TYPE="text" NAME="<% $mult_paramname %>" SIZE="5" VALUE="<% $multiplier %>" >
85 <INPUT TYPE="hidden" NAME="begin" VALUE="<% $cgi->param('begin') |h %>">
86 <INPUT TYPE="hidden" NAME="end" VALUE="<% $cgi->param('end') |h %>">
88 <INPUT TYPE="submit" NAME="submit" VALUE="<% $title %>">
91 <% include('/elements/footer.html') %>
96 unless $FS::CurrentUser::CurrentUser->access_right('Time queue');
98 my(%ticketmap, %ticket, %customers);
99 my $title = 'Assign Time Worked';
100 tie %ticketmap, 'Tie::IxHash';
102 my $CurrentUser = RT::CurrentUser->new();
103 $CurrentUser->LoadByName($FS::CurrentUser::CurrentUser->username);
105 foreach my $id ( map { /^transactionid(\d+)$/; $1; }
106 grep /^transactionid\d+$/, $cgi->param) {
107 my $transaction = new RT::Transaction($CurrentUser);
108 $transaction->Load($id);
109 $ticketmap{$id} = $transaction->ObjectId;
110 unless(exists($ticket{$ticketmap{$id}})) {
111 my $ticket = new RT::Ticket($CurrentUser);
112 $ticket->Load($ticketmap{$id});
113 $ticket{$ticketmap{$id}} = $ticket->Subject;
114 $customers{$ticketmap{$id}} =
115 [ map { $_->Resolver->AsString }
116 grep { $_->Resolver->{'fstable'} eq 'cust_main' }
117 grep { $_->Scheme eq 'freeside' }
118 map { $_->TargetURI }
119 @{ $ticket->_Links('Base')->ItemsArrayRef }