& /elements/form-create_ticket.html, object => $object &>
|
View
<% mt($openlabel) |h %> |
<% mt('resolved') |h %>
% if ( @tickets ) {
<& /elements/table-grid.html &>
% my $bgcolor1 = '#eeeeee';
% my $bgcolor2 = '#ffffff';
% my $bgcolor = '';
<% 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 %> |
% }
% if ( $object->isa('FS::cust_main') ) {
<% mt('Service') |h %> |
% }
% 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}"} %>
|
% }
% if ( $object->isa('FS::cust_main') ) {
% foreach (@{ $ticket->{svcnums} }) {
% my $cust_svc = FS::cust_svc->by_key($_) or next;
<% FS::UI::Web::svc_label_link($m, $cust_svc->part_svc, $cust_svc) %>
% }
|
% }
% }
%}
<%init>
my %opt = @_;
my $conf = new FS::Conf;
return '' unless $conf->config('ticket_system');
my $object = $opt{'object'};
$object = $object->cust_svc if $object->isa('FS::svc_Common');
my( @tickets ) = $object->tickets;
my ($openlabel, $open_link, $res_link, $thing);
$openlabel = join('/', FS::TicketSystem->statuses );
# not the nicest way to do this--FS::has_tickets_Common?
if ( $object->isa('FS::cust_main') ) {
$thing = 'customer';
$open_link = FS::TicketSystem->href_customer_tickets($object->custnum);
$res_link = FS::TicketSystem->href_customer_tickets(
$object->custnum,
{ 'statuses' => [ 'resolved' ] }
);
} elsif ( $object->isa('FS::cust_svc') ) {
return '' unless $object->pkgnum;
$thing = 'service';
$open_link = FS::TicketSystem->href_service_tickets($object->svcnum);
$res_link = FS::TicketSystem->href_service_tickets(
$object->svcnum,
{ 'statuses' => [ 'resolved' ] }
);
}
my $ss_priority = FS::TicketSystem->selfservice_priority;
if ( $ss_priority ) {
my $dir = $conf->exists('ticket_system-priority_reverse') ? -1 : 1;
use sort 'stable';
# sort in the following way:
@tickets = sort {
# within a severity level...
( $a->{'content'} eq $b->{'content'} ) ? (
# no-priority tickets sort last
(
($a->{'_selfservice_priority'} eq '') <=>
($b->{'_selfservice_priority'} eq '')
) ||
# otherwise obey ticket_system-priority_reverse
( $dir *
($b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'})
)
) : 0; # but don't rearrange between severity levels
} @tickets;
}
my $format = $conf->config('date_format') || '%Y-%m-%d';
my $date_formatter = sub {
my $time = parse_datetime($_[0], 'GMT');
# exclude times within 24 hours of zero
($time > 86400) ? time2str($format, $time) : '';
};
%init>