[freeside-commits] branch FREESIDE_3_BRANCH updated. 092526ed67705660e1fb0ac12ed93753310171e3

Mark Wells mark at 420.am
Mon Jun 13 14:12:10 PDT 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  092526ed67705660e1fb0ac12ed93753310171e3 (commit)
       via  93e64d8dec78c90f4a65249f5294c736b6129a9c (commit)
       via  9ff504a21d361a27997e94e74908ab663a57f207 (commit)
       via  a6f303fd9f14570f6d1654a175dbeadf00f4bd18 (commit)
       via  ab9d36b614da17d0f3b8ec4f63dfa849d193ff70 (commit)
      from  3421281a654c222339ac9439763e73387f762ad2 (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 092526ed67705660e1fb0ac12ed93753310171e3
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Jun 13 13:54:04 2016 -0700

    backporting fix

diff --git a/rt/share/html/Elements/QueueSummaryByLifecycle b/rt/share/html/Elements/QueueSummaryByLifecycle
index 6c45cfd..cf67a4f 100644
--- a/rt/share/html/Elements/QueueSummaryByLifecycle
+++ b/rt/share/html/Elements/QueueSummaryByLifecycle
@@ -72,7 +72,6 @@ for my $queue (@queues) {
 </%PERL>
 <tr class="<% $classes %>">
 
-<td></td>
 <td>
     <a href="<% $link_all->($queue, \@cur_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
 </td>
@@ -141,9 +140,6 @@ my $Search = RT::Search::UnrepliedTickets->new( TicketsObj => $Tickets );
 $Search->Prepare;
 
 for my $queue (@queues) {
-    my $cycle = RT::Lifecycle->Load( Name => $queue->{'Lifecycle'} );
-    $lifecycle{ lc $cycle->Name } = $cycle;
-
     # show whether there are unreplied tickets
     # somewhat inefficient but we only use the count query
     my $tix = $Tickets->Clone;

commit 93e64d8dec78c90f4a65249f5294c736b6129a9c
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Jun 11 23:19:11 2016 -0700

    show unreplied ticket marker in queue summary, #41670

diff --git a/rt/lib/RT/Search/UnrepliedTickets.pm b/rt/lib/RT/Search/UnrepliedTickets.pm
index a4fdacd..1be6686 100644
--- a/rt/lib/RT/Search/UnrepliedTickets.pm
+++ b/rt/lib/RT/Search/UnrepliedTickets.pm
@@ -31,16 +31,21 @@ sub Prepare  {
 
   my $TicketsObj = $self->TicketsObj;
   # bypass the pre-RT-4.2 TicketRestrictions stuff and just use SearchBuilder
-  $TicketsObj->RT::SearchBuilder::Limit(
-    FIELD => 'Owner',
-    VALUE => $TicketsObj->CurrentUser->id
-  );
+
+  # if SystemUser does this search (as in QueueSummaryByLifecycle), they
+  # should get all tickets regardless of ownership
+  if ($TicketsObj->CurrentUser->id != RT->SystemUser->id) {
+    $TicketsObj->RT::SearchBuilder::Limit(
+      FIELD => 'Owner',
+      VALUE => $TicketsObj->CurrentUser->id
+    );
+  }
   $TicketsObj->RT::SearchBuilder::Limit(
     FIELD => 'Status',
     OPERATOR => '!=',
     VALUE => 'resolved'
   );
-  $TicketsObj->Limit(
+  $TicketsObj->RT::SearchBuilder::Limit(
     FIELD => 'Status',
     OPERATOR => '!=',
     VALUE => 'rejected',
diff --git a/rt/share/html/Elements/QueueSummaryByLifecycle b/rt/share/html/Elements/QueueSummaryByLifecycle
index da31ebb..6c45cfd 100644
--- a/rt/share/html/Elements/QueueSummaryByLifecycle
+++ b/rt/share/html/Elements/QueueSummaryByLifecycle
@@ -66,9 +66,13 @@ for my $queue (@queues) {
     next if lc($queue->{Lifecycle} || '') ne lc $lifecycle->Name;
 
     $i++;
+
+    my $classes = $i%2 ? 'oddline' : 'evenline';
+    $classes .= ' unreplied-ticket' if $queue->{Unreplied} > 0;
 </%PERL>
-<tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
+<tr class="<% $classes %>">
 
+<td></td>
 <td>
     <a href="<% $link_all->($queue, \@cur_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
 </td>
@@ -131,6 +135,24 @@ for my $queue (@queues) {
     $lifecycle{ lc $cycle->Name } = $cycle;
 }
 
+use RT::Search::UnrepliedTickets;
+my $Tickets = RT::Tickets->new( RT->SystemUser );
+my $Search = RT::Search::UnrepliedTickets->new( TicketsObj => $Tickets );
+$Search->Prepare;
+
+for my $queue (@queues) {
+    my $cycle = RT::Lifecycle->Load( Name => $queue->{'Lifecycle'} );
+    $lifecycle{ lc $cycle->Name } = $cycle;
+
+    # show whether there are unreplied tickets
+    # somewhat inefficient but we only use the count query
+    my $tix = $Tickets->Clone;
+    $tix->Limit(FIELD => 'Queue',
+                OPERATOR => '=',
+                VALUE => $queue->{id});
+    $queue->{Unreplied} = $tix->Count;
+}
+
 unless (@statuses) {
     my %seen;
     foreach my $set ( 'initial', 'active' ) {
diff --git a/rt/share/html/NoAuth/css/freeside3/ticket-lists.css b/rt/share/html/NoAuth/css/freeside3/ticket-lists.css
index 257cf3b..efcc2c8 100644
--- a/rt/share/html/NoAuth/css/freeside3/ticket-lists.css
+++ b/rt/share/html/NoAuth/css/freeside3/ticket-lists.css
@@ -108,7 +108,7 @@ tr.unreplied-ticket > :first-child::before {
     width: 1ex;
     float: left;
     content: '';
-    margin-top: 1ex;
+    margin-right: 1ex;
     background-color: green;
 }
 

commit 9ff504a21d361a27997e94e74908ab663a57f207
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Jun 11 12:24:59 2016 -0700

    show unreplied ticket marker in customer ticket lists, #41670

diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm
index b70ac53..f8105e6 100644
--- a/FS/FS/TicketSystem/RT_Internal.pm
+++ b/FS/FS/TicketSystem/RT_Internal.pm
@@ -240,7 +240,8 @@ sub service_tickets  {
 sub _ticket_info {
   # Takes an RT::Ticket; returns a hashref of the ticket's fields, including 
   # custom fields.  Also returns custom and selfservice priority values as 
-  # _custom_priority and _selfservice_priority.
+  # _custom_priority and _selfservice_priority, and the IsUnreplied property
+  # as is_unreplied.
   my $t = shift;
 
   my $custom_priority = 
@@ -265,6 +266,7 @@ sub _ticket_info {
   if ( $ss_priority ) {
     $ticket_info{'_selfservice_priority'} = $ticket_info{"CF.{$ss_priority}"};
   }
+  $ticket_info{'is_unreplied'} = $t->IsUnreplied;
   my $svcnums = [ 
     map { $_->Target =~ /cust_svc\/(\d+)/; $1 } 
         @{ $t->Services->ItemsArrayRef }
diff --git a/httemplate/elements/freeside-menu.css b/httemplate/elements/freeside-menu.css
index 9533f19..a72a28b 100644
--- a/httemplate/elements/freeside-menu.css
+++ b/httemplate/elements/freeside-menu.css
@@ -146,3 +146,13 @@ a:visited:hover.fsdarkbutton {
          overflow:visible;
 }
 
+
+/* elements/notify-tickets.html is in the menu area */
+.dot {
+  border-radius: 50%;
+  border: 1px solid black;
+  width: 1ex;
+  height: 1ex;
+  display: inline-block;
+  margin-top: 0.3ex;
+}
diff --git a/httemplate/elements/freeside.css b/httemplate/elements/freeside.css
index f6d73c2d..8ad724a 100644
--- a/httemplate/elements/freeside.css
+++ b/httemplate/elements/freeside.css
@@ -313,4 +313,3 @@ td.label {
   color: #ff0000;
 }
 
-
diff --git a/httemplate/elements/notify-tickets.html b/httemplate/elements/notify-tickets.html
index faf998e..e661737 100644
--- a/httemplate/elements/notify-tickets.html
+++ b/httemplate/elements/notify-tickets.html
@@ -1,13 +1,4 @@
 % if ($enabled) {
-<style>
-.dot {
-  border-radius: 50%;
-  border: 1px solid black;
-  width: 1ex;
-  height: 1ex;
-  display: inline-block;
-}
-</style>
 <div style="font-weight: bold; vertical-align: bottom; text-align: left">
 %   if ( $UnrepliedTickets->Count > 0 ) {
   <a href="<% $fsurl %>rt/Search/UnrepliedTickets.html">
diff --git a/httemplate/elements/table-tickets.html b/httemplate/elements/table-tickets.html
index f89f984..bc02c7c 100644
--- a/httemplate/elements/table-tickets.html
+++ b/httemplate/elements/table-tickets.html
@@ -11,6 +11,7 @@ View
 %   my $bgcolor = '';
 
 <TR>
+  <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('#') |h %></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Subject') |h %></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
@@ -38,6 +39,16 @@ View
   <TR>
   
     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+%     if ( $ticket->{is_unreplied} ) {
+        <A CLASS="dot" STYLE="background-color: green" HREF=<%$href%>>
+%     } else {
+%       # placeholder
+        <A CLASS="dot" STYLE="visibility: hidden" HREF=<%$href%>>
+%     }
+      </A>
+    </TD>
+
+    <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
       <A HREF=<%$href%>><% $ticket->{id} %></A>
     </TD>
   

commit a6f303fd9f14570f6d1654a175dbeadf00f4bd18
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Jun 11 12:24:29 2016 -0700

    show unreplied marker in RT searches, #41670

diff --git a/rt/lib/RT/Ticket_Vendor.pm b/rt/lib/RT/Ticket_Vendor.pm
index a55bb7b..4a78838 100644
--- a/rt/lib/RT/Ticket_Vendor.pm
+++ b/rt/lib/RT/Ticket_Vendor.pm
@@ -92,5 +92,28 @@ sub WillResolveAsString {
   return $self->WillResolveObj->AsString();
 }
 
+=head2 IsUnreplied
+
+Returns true if there's a Correspond or Create transaction more recent than
+the Told date of this ticket (or the ticket has no Told date) and the ticket
+is not rejected or resolved.
+
+=cut
+
+sub IsUnreplied {
+  my $self = shift;
+  return 0 if $self->Status eq 'resolved'
+           or $self->Status eq 'rejected';
+
+  my $Told = $self->Told || '1970-01-01';
+  my $Txns = $self->Transactions;
+  $Txns->Limit(FIELD => 'Type',
+               OPERATOR => 'IN',
+               VALUE => [ 'Correspond', 'Create' ]);
+  $Txns->Limit(FIELD => 'Created',
+               OPERATOR => '>',
+               VALUE => $Told);
+  $Txns->Count ? 1 : 0;
+}
 
 1;
diff --git a/rt/share/html/Elements/CollectionAsTable/Row b/rt/share/html/Elements/CollectionAsTable/Row
index b83943a..13f43dd 100644
--- a/rt/share/html/Elements/CollectionAsTable/Row
+++ b/rt/share/html/Elements/CollectionAsTable/Row
@@ -57,6 +57,11 @@ $Class     => 'RT__Ticket'
 $Classes => ''
 </%ARGS>
 <%init>
+# it's a hack, but it has to be applied in every ticket search regardless
+# of format, so...
+if ( $record and $record->isa('RT::Ticket') and $record->IsUnreplied ) {
+  $Classes .= ' unreplied-ticket';
+}
 $m->out(  '<tr class="' . $Classes . ' '
         . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >'
         . "\n" );
diff --git a/rt/share/html/NoAuth/css/freeside3/ticket-lists.css b/rt/share/html/NoAuth/css/freeside3/ticket-lists.css
index 84c9a92..257cf3b 100644
--- a/rt/share/html/NoAuth/css/freeside3/ticket-lists.css
+++ b/rt/share/html/NoAuth/css/freeside3/ticket-lists.css
@@ -99,8 +99,18 @@ tr.collection-as-table+tr.collection-as-table th {
 
 }
 
-
-
+tr.unreplied-ticket > :first-child::before {
+  /* green dot */
+    border: 1px solid black;
+    border-radius: 50%;
+    display: inline-block;
+    height: 1ex;
+    width: 1ex;
+    float: left;
+    content: '';
+    margin-top: 1ex;
+    background-color: green;
+}
 
 table.queue-summary td {
   background: #efefef;

commit ab9d36b614da17d0f3b8ec4f63dfa849d193ff70
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Jun 11 12:23:54 2016 -0700

    hide unreplied status for Rejected tickets, #41670

diff --git a/rt/lib/RT/Search/UnrepliedTickets.pm b/rt/lib/RT/Search/UnrepliedTickets.pm
index 611675a..a4fdacd 100644
--- a/rt/lib/RT/Search/UnrepliedTickets.pm
+++ b/rt/lib/RT/Search/UnrepliedTickets.pm
@@ -6,9 +6,9 @@
 
 =head1 DESCRIPTION
 
-Find all unresolved tickets owned by the current user where the last correspondence
-from a requestor (or ticket creation) is more recent than the last
-correspondence from a non-requestor (if there is any).
+Find all unresolved tickets owned by the current user where the last
+correspondence from a requestor (or ticket creation) is more recent than the
+last correspondence from a non-requestor (if there is any).
 
 =head1 METHODS
 
@@ -40,6 +40,11 @@ sub Prepare  {
     OPERATOR => '!=',
     VALUE => 'resolved'
   );
+  $TicketsObj->Limit(
+    FIELD => 'Status',
+    OPERATOR => '!=',
+    VALUE => 'rejected',
+  );
   my $txn_alias = $TicketsObj->JoinTransactions;
   $TicketsObj->RT::SearchBuilder::Limit(
     ALIAS => $txn_alias,

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

Summary of changes:
 FS/FS/TicketSystem/RT_Internal.pm                  |    4 +++-
 httemplate/elements/freeside-menu.css              |   10 +++++++++
 httemplate/elements/freeside.css                   |    1 -
 httemplate/elements/notify-tickets.html            |    9 --------
 httemplate/elements/table-tickets.html             |   11 ++++++++++
 rt/lib/RT/Search/UnrepliedTickets.pm               |   22 ++++++++++++++-----
 rt/lib/RT/Ticket_Vendor.pm                         |   23 ++++++++++++++++++++
 rt/share/html/Elements/CollectionAsTable/Row       |    5 +++++
 rt/share/html/Elements/QueueSummaryByLifecycle     |   20 ++++++++++++++++-
 .../html/NoAuth/css/freeside3/ticket-lists.css     |   14 ++++++++++--
 10 files changed, 99 insertions(+), 20 deletions(-)




More information about the freeside-commits mailing list