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>
15 <& /elements/table-grid.html &>
16 % my $bgcolor1 = '#eeeeee';
17 % my $bgcolor2 = '#ffffff';
22 <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>
29 % foreach my $ticket ( @tickets ) {
30 % my $href = FS::TicketSystem->href_ticket($ticket->{id});
31 % if ( $bgcolor eq $bgcolor1 ) {
32 % $bgcolor = $bgcolor2;
34 % $bgcolor = $bgcolor1;
37 % use Date::Parse qw( str2time );
38 % my $starts = str2time( $ticket->{starts} ); #default format here sucks
39 % my $starts_pretty = '';
40 % $starts_pretty = time2str('%a %h %o %Y %l:%M%P', $starts)
45 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
46 <A HREF=<%$href%>><% 'custom field magic type' %></A>
49 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
50 <A HREF=<%$href%>><% $starts_pretty %></A>
53 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
54 <% $ticket->{status} %>
57 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
58 <% $ticket->{owner} %>
69 my $cust_main = shift;
70 my $object = $cust_main;
72 #total false laziness & just copied from elements/table-tickets.html
75 my $conf = new FS::Conf;
77 return '' unless $conf->config('ticket_system');
79 #my $object = $opt{'object'};
80 #$object = $object->cust_svc if $object->isa('FS::svc_Common');
81 my( @tickets ) = $object->tickets; #XXX but actually appointments... filter by presense of the necessary CF? RT::Appointment instead of RT::Ticket ?
83 my ($openlabel, $open_link, $res_link, $thing);
84 $openlabel = join('/', FS::TicketSystem->statuses );
86 # not the nicest way to do this--FS::has_tickets_Common?
87 #if ( $object->isa('FS::cust_main') ) {
89 $open_link = FS::TicketSystem->href_customer_tickets($object->custnum);
91 $res_link = FS::TicketSystem->href_customer_tickets(
93 { 'statuses' => [ 'resolved' ] }
95 #} elsif ( $object->isa('FS::cust_svc') ) {
97 # return '' unless $object->pkgnum;
100 # $open_link = FS::TicketSystem->href_service_tickets($object->svcnum);
102 # $res_link = FS::TicketSystem->href_service_tickets(
104 # { 'statuses' => [ 'resolved' ] }
108 #not actually used, appointments are all about what day this week and the time,
109 # so formatting them with that in mind
110 #my $format = $conf->config('date_format') || '%Y-%m-%d';
112 #my $date_formatter = sub {
113 # my $time = parse_datetime($_[0], 'GMT');
114 # # exclude times within 24 hours of zero
115 # ($time > 86400) ? time2str($format, $time) : '';