X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Ftimeworked.html;h=bbfd0334d2e1bc4fc29a99e15ff0d5900b73d19e;hb=170085d3536733f303e242503f0e034c65016b73;hp=29f9b2546b1b572a9de9dcad6acf934c1d4d0f98;hpb=1c478456e58dc554ff08e06a8d419f32c82c6529;p=freeside.git
diff --git a/httemplate/search/timeworked.html b/httemplate/search/timeworked.html
index 29f9b2546..bbfd0334d 100644
--- a/httemplate/search/timeworked.html
+++ b/httemplate/search/timeworked.html
@@ -32,19 +32,7 @@
'',
'',
],
- 'html_foot' => sub {
- '
'.
- ''.
- '
'.
- '';
- },
+ 'html_foot' => $html_foot,
)
%>
@@ -57,12 +45,14 @@ my @groupby = ();
my $transactiontime = "
CASE Transactions.Type WHEN 'Set'
- THEN (TO_NUMBER(NewValue,'999999')-TO_NUMBER(OldValue, '999999')) * 60
+ THEN ( CASE WHEN NewValue = '' THEN 0 ELSE TO_NUMBER(NewValue,'999999') END
+ -TO_NUMBER(OldValue, '999999')
+ ) * 60
ELSE TimeTaken*60
END
";
-push @groupby, qw( transactions.type newvalue oldvalue timetaken );
+push @groupby, qw( Transactions.Type NewValue OldValue TimeTaken );
my $appliedtimeclause = "COALESCE (SUM(acct_rt_transaction.seconds), 0)";
@@ -88,9 +78,7 @@ my $groupby = join(',', @groupby);
my $where = "
WHERE ObjectType='RT::Ticket'
AND ( ( Transactions.Type='Set' AND Field='TimeWorked' )
- OR Transactions.Type='Create'
- OR Transactions.Type='Comment'
- OR Transactions.Type='Correspond'
+ OR Transactions.Type IN ( 'Create', 'Comment', 'Correspond', 'Touch' )
)
AND $wheretimeleft
";
@@ -99,9 +87,9 @@ my $where = "
my $str2time_sql = str2time_sql;
my $closing = str2time_sql_closing;
-my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
-$where .= " AND $str2time_sql Transactions.Created $closing >= $beginning ".
- " AND $str2time_sql Transactions.Created $closing <= $ending";
+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 ";
my $query = "
SELECT Tickets.id, Tickets.Subject,
@@ -121,4 +109,22 @@ my $count_query = "SELECT COUNT(*) FROM Transactions $where";
my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->[0]; } ];
+my $html_foot = qq'
+
+
+
+
+
+
+
+
+';
+
%init>