%# <& /elements/form-create_ticket.html, object => $object &>
Appointments
% if ( $FS::CurrentUser::CurrentUser->access_right('Make appointment') ) {
<& /elements/popup_link-make_appointment.html, custnum=>$cust_main->custnum &>
% }
%# |
%# View
%# <% mt($openlabel) |h %> |
%# <% mt('resolved') |h %>
%if ( @tickets ) {
<& /elements/table-grid.html &>
% my $bgcolor1 = '#eeeeee';
% my $bgcolor2 = '#ffffff';
% my $bgcolor = '';
% if ( $custom_field ) {
<% mt('Type') |h %> |
% }
<% mt('Date') |h %> |
<% mt('Status') |h %> |
<% mt('Owner') |h %> |
% foreach my $ticket ( @tickets ) {
% my $href = FS::TicketSystem->href_ticket($ticket->{id});
% if ( $bgcolor eq $bgcolor1 ) {
% $bgcolor = $bgcolor2;
% } else {
% $bgcolor = $bgcolor1;
% }
%
% use Date::Parse qw( str2time );
% my $starts = str2time( $ticket->{starts}, 'UTC' ); #default format here sucks
% my $starts_pretty = '';
% $starts_pretty = time2str('%a %h %o %Y %l:%M%P', $starts)
% if $starts > 86400;
% if ( $custom_field ) {
><% $ticket->{"CF.{$custom_field}"} |h %>
|
% }
><% $starts_pretty %>
|
<% $ticket->{status} %>
|
<% $ticket->{owner} %>
|
% }
%}
<%init>
my $cust_main = shift;
my $object = $cust_main;
#total false laziness & just copied from elements/table-tickets.html
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->appointments;
my $custom_field = $conf->config('ticket_system-appointment-custom_field');
# 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' ] }
# );
#}
#not actually used, appointments are all about what day this week and the time,
# so formatting them with that in mind
#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>