X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Frt_transaction.html;h=8dda4baeab63441344ac8cadc797dcd154d8d827;hb=50de3921a10ae2ecc890c8661aa772dce72f0c53;hp=67048cf356d38fd657706e455447df1d3cb027c1;hpb=e70912ba74b44d3462d345edaef933bff1f3ad86;p=freeside.git diff --git a/httemplate/search/rt_transaction.html b/httemplate/search/rt_transaction.html index 67048cf35..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,8 +54,9 @@ 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' @@ -77,19 +85,25 @@ 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('ticketid'); } ];