X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Ftimeworked.html;h=1d877e6ef219039862d5d5b9074f1f1d114bad68;hb=219919032ef906702828dba09ce8e3880089cd26;hp=b3b31b4f3cc82a3ed8557eba6f9bf1a644d53664;hpb=fdbdabb698b904cfb8cdc8befb87a76aa71642e9;p=freeside.git
diff --git a/httemplate/search/timeworked.html b/httemplate/search/timeworked.html
index b3b31b4f3..1d877e6ef 100644
--- a/httemplate/search/timeworked.html
+++ b/httemplate/search/timeworked.html
@@ -32,19 +32,7 @@
'',
'',
],
- 'html_foot' => sub {
- '
'.
- ''.
- '
'.
- '';
- },
+ 'html_foot' => $html_foot,
)
%>
@@ -56,61 +44,87 @@ die "access denied"
my @groupby = ();
my $transactiontime = "
- CASE transactions.type when 'Set'
- THEN (to_number(newvalue,'999999')-to_number(oldvalue, '999999')) * 60
- ELSE timetaken*60
+ CASE Transactions.Type WHEN 'Set'
+ THEN (TO_NUMBER(NewValue,'999999')-TO_NUMBER(OldValue, '999999')) * 60
+ ELSE TimeTaken*60
END
";
push @groupby, qw( transactions.type newvalue oldvalue timetaken );
-my $appliedtimeclause = "coalesce (sum(acct_rt_transaction.seconds), 0)";
+my $appliedtimeclause = "COALESCE (SUM(acct_rt_transaction.seconds), 0)";
my $appliedtimeselect = "
- coalesce(
- ( SELECT sum(seconds) FROM acct_rt_transaction
- WHERE transaction_id = transactions.id
+ COALESCE(
+ ( SELECT SUM(seconds) FROM acct_rt_transaction
+ WHERE transaction_id = Transactions.id
),
0
)
";
-push @groupby, "transactions.id";
+push @groupby, "Transactions.id";
my $wheretimeleft = "$transactiontime != $appliedtimeselect";
-push @groupby, "tickets.id";
-push @groupby, "tickets.subject";
-push @groupby, "transactions.created";
+push @groupby, "Tickets.id";
+push @groupby, "Tickets.Subject";
+push @groupby, "Transactions.Created";
my $groupby = join(',', @groupby);
my $where = "
- WHERE objecttype='RT::Ticket'
- AND ( ( transactions.type='Set' AND field='TimeWorked' )
- OR transactions.type='Comment'
- OR transactions.type='Correspond'
+ WHERE ObjectType='RT::Ticket'
+ AND ( ( Transactions.Type='Set' AND Field='TimeWorked' )
+ OR Transactions.Type='Create'
+ OR Transactions.Type='Comment'
+ OR Transactions.Type='Correspond'
)
AND $wheretimeleft
";
#AND $wheretimeleft
+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 ";
+
my $query = "
- SELECT tickets.id, tickets.subject,
- to_char(transactions.created, 'Dy Mon DD HH24:MI:SS YYYY'),
+ 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
+ Transactions.id
+ FROM Transactions
+ JOIN Tickets ON Transactions.ObjectId = Tickets.id
LEFT JOIN acct_rt_transaction
- ON transactions.id = acct_rt_transaction.transaction_id
+ ON Transactions.id = acct_rt_transaction.transaction_id
$where
GROUP BY $groupby
- ORDER BY transactions.created
+ ORDER BY Transactions.Created
";
-my $count_query = "SELECT COUNT(*) FROM transactions $where";
+my $count_query = "SELECT COUNT(*) FROM Transactions $where";
my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->[0]; } ];
+my $html_foot = qq'
+
+
+
+
+
+
+
+
+';
+
%init>