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">
12 <TH COLSPAN="2">Ticket</TH>
14 <TH COLSPAN="2">Customer</TH>
31 % foreach my $tr_id ( keys %ticketmap ) {
32 % my (@customers) = @{$customers{$ticketmap{$tr_id}}};
33 % next unless @customers;
34 % my $default_multiplier = sprintf("%.2f", 1/@customers);
35 % my ($custnum, $name) = split(':', pop @customers, 2);
36 % my $link = $p. 'rt/Ticket/Display.html?id='. $ticketmap{$tr_id}.
40 <TD><a href="<% $link %>"><% $tr_id %></a></TD>
41 <TD><a href="<% $link %>"><% $ticketmap{$tr_id} %></a></TD>
42 <TD><a href="<% $link %>"><% $ticket{$ticketmap{$tr_id}} |h %></a></TD>
45 % if ( $cgi->param("seconds$tr_id") =~ /^(\d+)$/ ) {
49 <TD><% sprintf("%0.2f", $seconds/3600) %></TD>
50 <TD ALIGN="right"><% $custnum %></TD>
51 <TD ALIGN="right"><% $name %></TD>
53 <INPUT TYPE="hidden" NAME="transactionid<%$tr_id%>" VALUE="1" >
54 <INPUT TYPE="hidden" NAME="seconds<%$tr_id%>" VALUE="<% $seconds %>" >
56 % my $multiplier = $default_multiplier;
57 % my $mult_paramname = "multiplier${tr_id}_$custnum";
58 % if ( $cgi->param($mult_paramname) =~ /^\s*([\d\.]+)\s*$/ ) {
62 <INPUT TYPE="text" NAME="<% $mult_paramname %>" SIZE="5" VALUE="<% $multiplier %>" >
66 % foreach ( @customers ) {
67 % ($custnum, $name) = split(':', $_, 2);
70 <TD ALIGN="right" COLSPAN="5" ><% $custnum %></TD>
71 <TD ALIGN="right"><% $name %></TD>
74 % $multiplier = $default_multiplier;
75 % $mult_paramname = "multiplier${tr_id}_$custnum";
76 % if ( $cgi->param($mult_paramname) =~ /^\s*([\d\.]+)\s*$/ ) {
80 <INPUT TYPE="text" NAME="<% $mult_paramname %>" SIZE="5" VALUE="<% $multiplier %>" >
95 <INPUT TYPE="hidden" NAME="begin" VALUE="<% $cgi->param('begin') |h %>">
96 <INPUT TYPE="hidden" NAME="end" VALUE="<% $cgi->param('end') |h %>">
98 <INPUT TYPE="submit" NAME="submit" VALUE="<% $title %>">
101 <% include('/elements/footer.html') %>
106 unless $FS::CurrentUser::CurrentUser->access_right('Time queue');
108 my(%ticketmap, %ticket, %customers);
109 my $title = 'Assign Time Worked';
110 tie %ticketmap, 'Tie::IxHash';
114 my $CurrentUser = RT::CurrentUser->new();
115 $CurrentUser->LoadByName($FS::CurrentUser::CurrentUser->username);
117 foreach my $id ( map { /^transactionid(\d+)$/; $1; }
118 grep /^transactionid\d+$/, $cgi->param) {
119 my $transaction = new RT::Transaction($CurrentUser);
120 $transaction->Load($id);
121 $ticketmap{$id} = $transaction->ObjectId;
122 unless(exists($ticket{$ticketmap{$id}})) {
123 my $ticket = new RT::Ticket($CurrentUser);
124 $ticket->Load($ticketmap{$id});
125 $ticket{$ticketmap{$id}} = $ticket->Subject;
126 $customers{$ticketmap{$id}} =
127 [ map { $_->Resolver->AsString }
128 grep { $_->Resolver->{'fstable'} eq 'cust_main' }
129 grep { $_->Scheme eq 'freeside' }
130 map { $_->TargetURI }
131 @{ $ticket->_Links('Base')->ItemsArrayRef }