diff options
author | Mark Wells <mark@freeside.biz> | 2014-09-24 16:29:46 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-09-24 16:29:46 -0700 |
commit | a6def4c68914a9d8a282eaa34dcff5f6fd002568 (patch) | |
tree | 4e43aa495546ac300a1491294bf922207b084053 /httemplate/search/timeworked.html | |
parent | db21275347bb469868e81d4ca2bbed846d95f143 (diff) |
change "support time" to use regular ticket time + a custom field, #30921
Diffstat (limited to 'httemplate/search/timeworked.html')
-rw-r--r-- | httemplate/search/timeworked.html | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/httemplate/search/timeworked.html b/httemplate/search/timeworked.html index fa4b89539..3e3ddcbba 100644 --- a/httemplate/search/timeworked.html +++ b/httemplate/search/timeworked.html @@ -86,25 +86,46 @@ my $where = " my $str2time_sql = str2time_sql; my $closing = str2time_sql_closing; + my($begin, $end) = FS::UI::Web::parse_beginning_ending($cgi); $where .= " AND $str2time_sql Transactions.Created $closing >= $begin ". " AND $str2time_sql Transactions.Created $closing <= $end "; +if ($cgi->param('category') =~ /^(\w+)$/) { + $where .= " AND ocfv_TimeType.Content = '$1'"; +} +warn $where."\n";; + +my $from = " + FROM Transactions + JOIN Tickets ON Transactions.ObjectId = Tickets.id + LEFT JOIN acct_rt_transaction + ON Transactions.id = acct_rt_transaction.transaction_id + LEFT JOIN ( + SELECT DISTINCT ON (ObjectId) + ObjectId, Content + FROM ObjectCustomFieldValues + JOIN CustomFields + ON (ObjectCustomFieldValues.CustomField = CustomFields.Id) + WHERE CustomFields.Name = 'TimeType' + AND ObjectCustomFieldValues.ObjectType = 'RT::Ticket' + AND ObjectCustomFieldValues.Disabled = 0 + ORDER BY ObjectId ASC, ObjectCustomFieldValues.LastUpdated DESC + ) AS ocfv_TimeType ON (Tickets.Id = ocfv_TimeType.ObjectId) +"; + my $query = " SELECT Tickets.id, Tickets.Subject, TO_CHAR(Transactions.Created, 'Dy Mon DD HH24:MI:SS YYYY'), $transactiontime-$appliedtimeclause, Transactions.id - FROM Transactions - JOIN Tickets ON Transactions.ObjectId = Tickets.id - LEFT JOIN acct_rt_transaction - ON Transactions.id = acct_rt_transaction.transaction_id + $from $where GROUP BY $groupby ORDER BY Transactions.Created "; -my $count_query = "SELECT COUNT(*) FROM Transactions $where"; +my $count_query = "SELECT COUNT(*) $from $where"; my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->[0]; } ]; |