X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Frt_transaction.html;h=8dda4baeab63441344ac8cadc797dcd154d8d827;hb=50de3921a10ae2ecc890c8661aa772dce72f0c53;hp=31ad10d1af002a66be1c7f343641d1b4664889d2;hpb=948b8acdd4b9b3864342062d0c397a11f57c5700;p=freeside.git diff --git a/httemplate/search/rt_transaction.html b/httemplate/search/rt_transaction.html index 31ad10d1a..8dda4baea 100644 --- a/httemplate/search/rt_transaction.html +++ b/httemplate/search/rt_transaction.html @@ -3,11 +3,12 @@ 'name_singular' => 'transaction', 'query' => $query, 'count_query' => $count_query, - 'count_addl' => [ $format_seconds_sub, ], + 'count_addl' => [ $format_seconds_sub, $format_seconds_sub, ], 'header' => [ 'Ticket #', 'Ticket', 'Date', 'Time', + 'Applied', ], 'fields' => [ 'ticketid', sub { encode_entities(shift->get('subject')) }, @@ -15,12 +16,16 @@ sub { my $seconds = shift->get('transaction_time'); &{ $format_seconds_sub }( $seconds ); }, + sub { my $seconds = shift->get('support'); + &{ $format_seconds_sub }( $seconds ); + }, ], 'links' => [ $link, $link, '', '', + '', ], ) %> @@ -28,7 +33,9 @@ my $format_seconds_sub = sub { my $seconds = shift; - (($seconds < 0) ? '-' : '') . concise(duration($seconds)); + #(($seconds < 0) ? '-' : '') . concise(duration($seconds)); + (($seconds < 0) ? '-' : '' ). int(abs($seconds)/3600)."h".sprintf("%02d",(abs( +$seconds)%3600)/60)."m"; }; @@ -47,14 +54,15 @@ my $transactiontime = " "; my $join = 'JOIN Tickets ON Transactions.ObjectId = Tickets.Id '. - 'JOIN Users ON Transactions.Creator = Users.Id '; - + 'JOIN Users ON Transactions.Creator = Users.Id '. + 'LEFT JOIN acct_rt_transaction '. + ' ON Transactions.Id = acct_rt_transaction.transaction_id'; my $where = " WHERE objecttype='RT::Ticket' AND ( ( Transactions.Type = 'Set' AND Transactions.Field = 'TimeWorked' AND Transactions.NewValue != Transactions.OldValue ) - OR ( ( Transactions.Type='Comment' OR Transactions.Type='Correspond' ) + OR ( ( Transactions.Type='Create' OR Transactions.Type='Comment' OR Transactions.Type='Correspond' ) AND Transactions.TimeTaken > 0 ) ) @@ -77,20 +85,26 @@ if ( $cgi->param('otaker') && $cgi->param('otaker') =~ /^([\w\.\-]+)$/ ) { $where .= " AND Users.name = '$1' "; } +if ( $cgi->param('ticketid') =~ /^\s*(\d+)\s*$/ ) { + $where .= " AND Tickets.ID = $1"; +} + +if ( $cgi->param('svcnum') =~ /^\s*(\d+)\s*$/ ) { + $where .= " AND acct_rt_transaction.svcnum = $1"; +} + my $query = { - 'select' => "Transactions.*, Tickets.Id AS ticketid, Tickets.Subject, Users.name as otaker, $transactiontime AS transaction_time", + 'select' => "Transactions.*, Tickets.Id AS ticketid, Tickets.Subject, Users.name as otaker, $transactiontime AS transaction_time, acct_rt_transaction.support", #'table' => 'Transactions', 'table' => 'transactions', - 'addl_from' => $join. - 'LEFT JOIN acct_rt_transaction '. - ' ON Transactions.Id = acct_rt_transaction.transaction_id', + 'addl_from' => $join, 'extra_sql' => $where, 'order by' => 'ORDER BY Created', }; my $count_query = - "SELECT COUNT(*), SUM($transactiontime) FROM Transactions $join $where"; + "SELECT COUNT(*), SUM($transactiontime), SUM(acct_rt_transaction.support) FROM Transactions $join $where"; -my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->get('id'); } ]; +my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->get('ticketid'); } ];