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 % if ( $custom_field ) {
23 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Type') |h %></TH>
25 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
26 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
27 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH>
31 % foreach my $ticket ( @tickets ) {
32 % my $href = FS::TicketSystem->href_ticket($ticket->{id});
33 % if ( $bgcolor eq $bgcolor1 ) {
34 % $bgcolor = $bgcolor2;
36 % $bgcolor = $bgcolor1;
39 % use Date::Parse qw( str2time );
40 % my $starts = str2time( $ticket->{starts} ); #default format here sucks
41 % my $starts_pretty = '';
42 % $starts_pretty = time2str('%a %h %o %Y %l:%M%P', $starts)
47 % if ( $custom_field ) {
48 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
49 <A HREF=<%$href%>><% $ticket->{"CF.{$custom_field}"} |h %></A>
53 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
54 <A HREF=<%$href%>><% $starts_pretty %></A>
57 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
58 <% $ticket->{status} %>
61 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
62 <% $ticket->{owner} %>
73 my $cust_main = shift;
74 my $object = $cust_main;
76 #total false laziness & just copied from elements/table-tickets.html
79 my $conf = new FS::Conf;
81 return '' unless $conf->config('ticket_system');
83 #my $object = $opt{'object'};
84 #$object = $object->cust_svc if $object->isa('FS::svc_Common');
85 my @tickets = $object->appointments;
87 my $custom_field = $conf->config('ticket_system-appointment-custom_field');
89 # my ($openlabel, $open_link, $res_link, $thing);
90 # $openlabel = join('/', FS::TicketSystem->statuses );
92 # not the nicest way to do this--FS::has_tickets_Common?
93 #if ( $object->isa('FS::cust_main') ) {
94 # $thing = 'customer';
95 # $open_link = FS::TicketSystem->href_customer_tickets($object->custnum);
97 # $res_link = FS::TicketSystem->href_customer_tickets(
99 # { 'statuses' => [ 'resolved' ] }
101 #} elsif ( $object->isa('FS::cust_svc') ) {
103 # return '' unless $object->pkgnum;
105 # $thing = 'service';
106 # $open_link = FS::TicketSystem->href_service_tickets($object->svcnum);
108 # $res_link = FS::TicketSystem->href_service_tickets(
110 # { 'statuses' => [ 'resolved' ] }
114 #not actually used, appointments are all about what day this week and the time,
115 # so formatting them with that in mind
116 #my $format = $conf->config('date_format') || '%Y-%m-%d';
118 #my $date_formatter = sub {
119 # my $time = parse_datetime($_[0], 'GMT');
120 # # exclude times within 24 hours of zero
121 # ($time > 86400) ? time2str($format, $time) : '';