[freeside-commits] branch master updated. 4a473190250bb7fe9108d64693fc4d6e451f707b

Ivan ivan at 420.am
Wed Feb 20 20:10:41 PST 2013


The branch, master has been updated
       via  4a473190250bb7fe9108d64693fc4d6e451f707b (commit)
       via  efb0128d8e8737a78224831535b44342d0660a23 (commit)
      from  f00c16b7e3e6306723ea8b3029e061cff100b901 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4a473190250bb7fe9108d64693fc4d6e451f707b
Merge: efb0128 f00c16b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Feb 20 20:10:34 2013 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit efb0128d8e8737a78224831535b44342d0660a23
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Feb 20 20:10:11 2013 -0800

    should fix applied time column weirdness?

diff --git a/httemplate/search/rt_ticket.html b/httemplate/search/rt_ticket.html
index 8603ef2..f5ac023 100644
--- a/httemplate/search/rt_ticket.html
+++ b/httemplate/search/rt_ticket.html
@@ -4,18 +4,18 @@
              'query'         => $query,
              'count_query'   => $count_query,
              'count_addl'    => [ $format_seconds_sub,
-                                  $applied_time ? $format_seconds_sub : () ],
+                                  $applied ? $format_seconds_sub : () ],
              'header'        => [ 'Ticket #',
                                   'Ticket',
                                   'Time',
-                                  $applied_time ? 'Applied' : (),
+                                  $applied ? 'Applied' : (),
                                 ],
              'fields'        => [ 'ticketid',
                                   sub { encode_entities(shift->get('subject')) },
                                   sub { my $seconds = shift->get('ticket_time');
                                         &{ $format_seconds_sub }( $seconds );
                                       },
-                                  ($applied_time ?
+                                  ($applied ?
                                     sub { my $seconds = shift->get('applied_time');
                                         &{ $format_seconds_sub }( $seconds );
                                       } : () ),
@@ -23,7 +23,7 @@
              'sort_fields'   => [ 'ticketid',
                                   'subject',
                                   'transaction_time',
-                                  $applied_time ? 'applied_time' : (),
+                                  $applied ? 'applied_time' : (),
                                 ],
              'links'         => [
                                   $link,
@@ -59,7 +59,6 @@ my @select = (
 );
 my @select_total = ( 'COUNT(*)' );
 
-my ($transaction_time, $applied_time);
 my $join = 'JOIN Users   ON Transactions.Creator = Users.Id '; #.
 
 my $twhere = "
@@ -67,6 +66,8 @@ my $twhere = "
     AND Transactions.ObjectId = Tickets.Id
 ";
 
+my $transaction_time;
+my $applied = '';
 my $cfname = '';
 if ( $cgi->param('cfname') =~ /^\w(\w|\s)*$/ ) {
 
@@ -103,15 +104,14 @@ if ( $cgi->param('cfname') =~ /^\w(\w|\s)*$/ ) {
   $twhere .= " AND CustomFields.Name = '$cfname'
     AND (ocfv_new.Id IS NOT NULL OR ocfv_old.Id IS NOT NULL OR ocfv_main.Id IS NOT NULL)";
 
-}
-else {
+} else {
+
   $transaction_time = "
   CASE transactions.type when 'Set'
     THEN (to_number(newvalue,'999999')-to_number(oldvalue, '999999')) * 60
     ELSE timetaken*60
   END";
  
-  my $applied = '';
   if ( $cgi->param('svcnum') =~ /^\s*(\d+)\s*$/ ) {
     $twhere .= " AND EXISTS( SELECT 1 FROM acct_rt_transaction WHERE acct_rt_transaction.transaction_id = Transactions.id AND svcnum = $1 )";
     $applied = "AND svcnum = $1";
@@ -121,13 +121,11 @@ else {
     AND (    ( Transactions.Type = 'Set'
                AND Transactions.Field = 'TimeWorked'
                AND Transactions.NewValue != Transactions.OldValue )
-          OR ( ( Transactions.Type='Create' OR Transactions.Type='Comment' OR Transactions.Type='Correspond' OR Transactions.Type='Touch' )
+          OR ( Transactions.Type IN ( 'Create', 'Comment', 'Correspond', 'Touch' )
                AND Transactions.TimeTaken > 0
              )
         )";
 
-  $applied_time = "( SELECT SUM(support) FROM acct_rt_transaction LEFT JOIN Transactions ON ( transaction_id = Id ) $twhere $applied )";
-
 }
 
 
@@ -154,9 +152,13 @@ my $ticket_time = "( SELECT SUM($transaction_time) $transactions )";
 push @select, "$ticket_time AS ticket_time";
 push @select_total, "SUM($ticket_time)";
 
-if ( $applied_time) {
+if ( $applied ) {
+
+  my $applied_time = "( SELECT SUM(support) FROM acct_rt_transaction LEFT JOIN Transactions ON ( transaction_id = Id ) $twhere $applied )";
+
   push @select, "$applied_time AS applied_time";
   push @select_total, "SUM($applied_time)";
+
 }
 
 my $query = {

-----------------------------------------------------------------------

Summary of changes:
 httemplate/search/rt_ticket.html |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)




More information about the freeside-commits mailing list