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 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Type') |h %></TH>
21 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
22 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
23 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH>
26 % foreach my $ticket ( @tickets ) {
27 % my $href = FS::TicketSystem->href_ticket($ticket->{id});
28 % if ( $bgcolor eq $bgcolor1 ) {
29 % $bgcolor = $bgcolor2;
31 % $bgcolor = $bgcolor1;
34 % use Date::Parse qw( str2time );
35 % my $starts = str2time( $ticket->{starts} ); #default format here sucks
36 % my $starts_pretty = '';
37 % $starts_pretty = time2str('%a %h %o %Y %l:%M%P', $starts)
42 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
43 <A HREF=<%$href%>><% 'custom field magic type' %></A>
46 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
47 <A HREF=<%$href%>><% $starts_pretty %></A>
50 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
51 <% $ticket->{status} %>
54 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
55 <% $ticket->{owner} %>
66 my $cust_main = shift;
67 my $object = $cust_main;
69 #total false laziness & just copied from elements/table-tickets.html
72 my $conf = new FS::Conf;
74 return '' unless $conf->config('ticket_system');
76 #my $object = $opt{'object'};
77 #$object = $object->cust_svc if $object->isa('FS::svc_Common');
78 my( @tickets ) = $object->tickets; #XXX but actually appointments... filter by presense of the necessary CF? RT::Appointment instead of RT::Ticket ?
80 my ($openlabel, $open_link, $res_link, $thing);
81 $openlabel = join('/', FS::TicketSystem->statuses );
83 # not the nicest way to do this--FS::has_tickets_Common?
84 #if ( $object->isa('FS::cust_main') ) {
86 $open_link = FS::TicketSystem->href_customer_tickets($object->custnum);
88 $res_link = FS::TicketSystem->href_customer_tickets(
90 { 'statuses' => [ 'resolved' ] }
92 #} elsif ( $object->isa('FS::cust_svc') ) {
94 # return '' unless $object->pkgnum;
97 # $open_link = FS::TicketSystem->href_service_tickets($object->svcnum);
99 # $res_link = FS::TicketSystem->href_service_tickets(
101 # { 'statuses' => [ 'resolved' ] }
105 #not actually used, appointments are all about what day this week and the time,
106 # so formatting them with that in mind
107 #my $format = $conf->config('date_format') || '%Y-%m-%d';
109 #my $date_formatter = sub {
110 # my $time = parse_datetime($_[0], 'GMT');
111 # # exclude times within 24 hours of zero
112 # ($time > 86400) ? time2str($format, $time) : '';