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 %# just a link for now, should probably be FS::TicketSystem->href_schedule
6 %# maybe need to add a dropdown for type (install etc.) from a custom field
7 %# or maybe change to a popup and get that info there
8 % my @sched_item = qsearch('sched_item', { 'disabled' => '', });
9 % my @username = map $_->access_user->username, @sched_item;
10 % my $query = join('&', map "username=$_", @username).
11 % '&LengthMin=180'. #XXX appointment length
12 % '&custnum='. $cust_main->custnum; #.
13 % #XXX '&pkgnum=$pkgnum";need to be for specific package/location, not just for a customer... default to active(/ordered) package in a pkg_class w/ticketing_queueid, otherwise, a popup? we're getting complicated like form-creat_ticket.html
14 <A HREF="<%$p%>rt/Search/Schedule.html?<% $query %>">Make appointment</A>
19 %# <A HREF="<% $open_link %>"><% mt($openlabel) |h %></A> |
20 %# <A HREF="<% $res_link %>"><% mt('resolved') |h %></A>
23 <& /elements/table-grid.html &>
24 % my $bgcolor1 = '#eeeeee';
25 % my $bgcolor2 = '#ffffff';
29 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Type') |h %></TH>
30 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
31 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
32 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH>
35 % foreach my $ticket ( @tickets ) {
36 % my $href = FS::TicketSystem->href_ticket($ticket->{id});
37 % if ( $bgcolor eq $bgcolor1 ) {
38 % $bgcolor = $bgcolor2;
40 % $bgcolor = $bgcolor1;
43 % use Date::Parse qw( str2time );
44 % my $starts = str2time( $ticket->{starts} ); #default format here sucks
45 % my $starts_pretty = '';
46 % $starts_pretty = time2str('%a %h %o %Y %l:%M%P', $starts)
51 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
52 <A HREF=<%$href%>><% 'custom field magic type' %></A>
55 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
56 <A HREF=<%$href%>><% $starts_pretty %></A>
59 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
60 <% $ticket->{status} %>
63 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
64 <% $ticket->{owner} %>
75 my $cust_main = shift;
76 my $object = $cust_main;
78 #total false laziness & just copied from elements/table-tickets.html
81 my $conf = new FS::Conf;
83 return '' unless $conf->config('ticket_system');
85 #my $object = $opt{'object'};
86 #$object = $object->cust_svc if $object->isa('FS::svc_Common');
87 my( @tickets ) = $object->tickets; #XXX but actually appointments... filter by presense of the necessary CF? RT::Appointment instead of RT::Ticket ?
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') ) {
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) : '';