X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Ftickets.html;h=863c66be454f544a11be30e6dcb99419bd6f2094;hb=8737dc99be5a9874c40f36d1420447253ee12c31;hp=93cb51f25734458bebe2a9af52bf6714ab4e56e7;hpb=8e3dfb380406e145494a5fffa7a0e4aab7b38253;p=freeside.git
diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html
index 93cb51f25..863c66be4 100644
--- a/httemplate/view/cust_main/tickets.html
+++ b/httemplate/view/cust_main/tickets.html
@@ -1,76 +1,152 @@
-<%
- my( $cust_main ) = @_;
-
- my $conf = new FS::Conf;
- my $num = $conf->config('cust_main-max_tickets') || 10;
-
- my @tickets = ();
- unless ( $conf->config('ticket_system-custom_priority_field') ) {
-
- @tickets =
- @{ FS::TicketSystem->customer_tickets($cust_main->custnum, $num) };
-
- } else {
-
- foreach my $priority (
- $conf->config('ticket_system-custom_priority_field-values'), ''
- ) {
- last if scalar(@tickets) >= $num;
- push @tickets,
- @{ FS::TicketSystem->customer_tickets( $cust_main->custnum,
- $num - scalar(@tickets),
- $priority,
- )
- };
- }
-
- }
-
-%>
-
-Highest priority tickets
-(View all tickets for this customer)
-(New ticket for this customer)
-
-<%= include("/elements/table-grid.html") %>
-
-<% my $bgcolor1 = '#eeeeee';
- my $bgcolor2 = '#ffffff';
- my $bgcolor = '';
-%>
+
+
+
+(<% mt("View $openlabel tickets for this customer") |h %>)
+(<% mt('View resolved tickets for this customer') |h %>)
+
+
+<& /elements/table-grid.html &>
+% my $bgcolor1 = '#eeeeee';
+% my $bgcolor2 = '#ffffff';
+% my $bgcolor = '';
- # |
- Subject |
- Priority |
- Queue |
- Status |
+ <% mt('#') |h %> |
+ <% mt('Subject') |h %> |
+ <% mt('Status') |h %> |
+ <% mt('Queue') |h %> |
+ <% mt('Owner') |h %> |
+ <% mt('Due') |h %> |
+ <% mt('Estimated Time') |h %> |
+ <% mt('Priority') |h %> |
+% if ( $ss_priority ) {
+ <% mt('Customer Priority') |h %> |
+% }
-<% foreach my $ticket ( @tickets ) {
- my $href = FS::TicketSystem->href_ticket($ticket->{id});
- if ( $bgcolor eq $bgcolor1 ) {
- $bgcolor = $bgcolor2;
- } else {
- $bgcolor = $bgcolor1;
- }
-%>
+% foreach my $ticket ( @tickets ) {
+% my $href = FS::TicketSystem->href_ticket($ticket->{id});
+% if ( $bgcolor eq $bgcolor1 ) {
+% $bgcolor = $bgcolor2;
+% } else {
+% $bgcolor = $bgcolor1;
+% }
+
+
+
+
+ ><% $ticket->{id} %>
+ |
+
+
+ ><% $ticket->{subject} %>
+ |
+
+
+ <% $ticket->{status} %>
+ |
+
+
+ <% $ticket->{queue} %>
+ |
+
+
+ <% $ticket->{owner} %>
+ |
+
+
+ <% $date_formatter->($ticket->{due}) %>
+ |
+
+
+ <% $ticket->{timeestimated} %>
+ |
+
+
+ <% $ticket->{content}
+ ? $ticket->{content}.' ('.$ticket->{priority}.')'
+ : $ticket->{priority}
+ %>
+ |
+
+% if ( $ss_priority ) {
+
+ <% $ticket->{"CF.{$ss_priority}"} %>
+ |
+% }
+
+
+
+% }
-
+
- ><%= $ticket->{id} %> |
+<%init>
+use Date::Format 'time2str';
+use Date::Parse 'str2time';
- ><%= $ticket->{subject} %> |
+my( $conf ) = new FS::Conf;
+my( $cust_main ) = @_;
+my( @tickets ) = $cust_main->tickets;
- <%= $ticket->{content} || $ticket->{priority} %> |
+my $open_link = FS::TicketSystem->href_customer_tickets($cust_main->custnum);
+my $openlabel = join('/', FS::TicketSystem->statuses );
- <%= $ticket->{name} %> |
+my $res_link = FS::TicketSystem->href_customer_tickets(
+ $cust_main->custnum,
+ { 'statuses' => [ 'resolved' ] }
+ );
- <%= $ticket->{status} %> |
+my( $new_base, %new_param ) =
+ FS::TicketSystem->href_params_new_ticket( $cust_main );
-
+my $new_link = FS::TicketSystem->href_new_ticket( $cust_main );
-<% } %>
+my $ss_priority = FS::TicketSystem->selfservice_priority;
+if ( $ss_priority ) {
+ use sort 'stable';
+ no warnings 'uninitialized';
+ @tickets = sort {
+ ($b->{'content'} eq $a->{'content'}) &&
+ $b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'}
+ } @tickets;
+}
-
+my $format = $conf->config('date_format') || '%Y-%m-%d';
+
+my $date_formatter = sub {
+ my $time = str2time($_[0], 'GMT');
+ # exclude times within 24 hours of zero
+ ($time > 86400) ? time2str($format, $time) : '';
+};
+%init>