1 %# <& /elements/form-create_ticket.html, object => $object &>
2 <A NAME="appointments"><FONT CLASS="fsinnerbox-title">Appointments</FONT></A>
4 % if ( $FS::CurrentUser::CurrentUser->access_right('Make appointment') ) {
5 <& /elements/popup_link-make_appointment.html, custnum=>$cust_main->custnum &>
10 %# <A HREF="<% $open_link %>"><% mt($openlabel) |h %></A> |
11 %# <A HREF="<% $res_link %>"><% mt('resolved') |h %></A>
14 <& /elements/table-grid.html &>
15 % my $bgcolor1 = '#eeeeee';
16 % my $bgcolor2 = '#ffffff';
20 % if ( $custom_field ) {
21 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Type') |h %></TH>
23 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
24 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
25 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH>
28 % foreach my $ticket ( @tickets ) {
29 % my $href = FS::TicketSystem->href_ticket($ticket->{id});
30 % if ( $bgcolor eq $bgcolor1 ) {
31 % $bgcolor = $bgcolor2;
33 % $bgcolor = $bgcolor1;
36 % use Date::Parse qw( str2time );
37 % my $starts = str2time( $ticket->{starts} ); #default format here sucks
38 % my $starts_pretty = '';
39 % $starts_pretty = time2str('%a %h %o %Y %l:%M%P', $starts)
44 % if ( $custom_field ) {
45 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
46 <A HREF=<%$href%>><% $ticket->{"CF.{$custom_field}"} |h %></A>
50 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
51 <A HREF=<%$href%>><% $starts_pretty %></A>
54 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
55 <% $ticket->{status} %>
58 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
59 <% $ticket->{owner} %>
70 my $cust_main = shift;
71 my $object = $cust_main;
73 #total false laziness & just copied from elements/table-tickets.html
76 my $conf = new FS::Conf;
78 return '' unless $conf->config('ticket_system');
80 #my $object = $opt{'object'};
81 #$object = $object->cust_svc if $object->isa('FS::svc_Common');
82 my @tickets = $object->appointments;
84 my $custom_field = $conf->config('ticket_system-appointment-custom_field');
86 # my ($openlabel, $open_link, $res_link, $thing);
87 # $openlabel = join('/', FS::TicketSystem->statuses );
89 # not the nicest way to do this--FS::has_tickets_Common?
90 #if ( $object->isa('FS::cust_main') ) {
91 # $thing = 'customer';
92 # $open_link = FS::TicketSystem->href_customer_tickets($object->custnum);
94 # $res_link = FS::TicketSystem->href_customer_tickets(
96 # { 'statuses' => [ 'resolved' ] }
98 #} elsif ( $object->isa('FS::cust_svc') ) {
100 # return '' unless $object->pkgnum;
102 # $thing = 'service';
103 # $open_link = FS::TicketSystem->href_service_tickets($object->svcnum);
105 # $res_link = FS::TicketSystem->href_service_tickets(
107 # { 'statuses' => [ 'resolved' ] }
111 #not actually used, appointments are all about what day this week and the time,
112 # so formatting them with that in mind
113 #my $format = $conf->config('date_format') || '%Y-%m-%d';
115 #my $date_formatter = sub {
116 # my $time = parse_datetime($_[0], 'GMT');
117 # # exclude times within 24 hours of zero
118 # ($time > 86400) ? time2str($format, $time) : '';