ticket_system-appointment-custom_field, RT#34237
[freeside.git] / httemplate / view / cust_main / appointments.html
index f8c1bb6..9bf5be1 100644 (file)
@@ -2,16 +2,7 @@
 <A NAME="appointments"><FONT CLASS="fsinnerbox-title">Appointments</FONT></A>
 
 % if ( $FS::CurrentUser::CurrentUser->access_right('Make appointment') ) { 
-%# just a link for now,  should probably be FS::TicketSystem->href_schedule
-%# maybe need to add a dropdown for type (install etc.) from a custom field
-%# or maybe change to a popup and get that info there
-% my @sched_item = qsearch('sched_item', { 'disabled' => '', });
-% my @username = map $_->access_user->username, @sched_item;
-% my $query = join('&', map "username=$_", @username).
-%             '&LengthMin=180'. #XXX appointment length
-%             '&custnum='. $cust_main->custnum; #.
-%             #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
-<A HREF="<%$p%>rt/Search/Schedule.html?<% $query %>">Make appointment</A>
+  <& /elements/popup_link-make_appointment.html, custnum=>$cust_main->custnum &>
 % }
 
 %#  |
@@ -28,7 +19,9 @@
 
 <THEAD>
 <TR>
-  <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Type') |h %></TH>
+% if ( $custom_field ) {
+    <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Type') |h %></TH>
+% }
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH>
 %       if $starts > 86400;
 
   <TR>
-  
-    <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
-      <A HREF=<%$href%>><% 'custom field magic type' %></A>
-    </TD>
+
+%   if ( $custom_field ) {
+      <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+        <A HREF=<%$href%>><% $ticket->{"CF.{$custom_field}"} |h %></A>
+      </TD>
+%   }
   
     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
       <A HREF=<%$href%>><% $starts_pretty %></A>
@@ -87,20 +82,22 @@ return '' unless $conf->config('ticket_system');
 
 #my $object = $opt{'object'};
 #$object = $object->cust_svc if $object->isa('FS::svc_Common');
-my( @tickets )  = $object->tickets; #XXX but actually appointments... filter by presense of the necessary CF?  RT::Appointment instead of RT::Ticket ?
+my @tickets = $object->appointments;
 
-my ($openlabel, $open_link, $res_link, $thing);
-$openlabel = join('/', FS::TicketSystem->statuses );
+my $custom_field = $conf->config('ticket_system-appointment-custom_field');
+
+# my ($openlabel, $open_link, $res_link, $thing);
+# $openlabel = join('/', FS::TicketSystem->statuses );
 
 # not the nicest way to do this--FS::has_tickets_Common?
 #if ( $object->isa('FS::cust_main') ) {
-  $thing  = 'customer';
-  $open_link = FS::TicketSystem->href_customer_tickets($object->custnum);
-
-  $res_link  = FS::TicketSystem->href_customer_tickets(
-                    $object->custnum,
-                    { 'statuses' => [ 'resolved' ] }
-                  );
+#  $thing  = 'customer';
+#  $open_link = FS::TicketSystem->href_customer_tickets($object->custnum);
+#
+#  $res_link  = FS::TicketSystem->href_customer_tickets(
+#                    $object->custnum,
+#                    { 'statuses' => [ 'resolved' ] }
+#                  );
 #} elsif ( $object->isa('FS::cust_svc') ) {
 #
 #  return '' unless $object->pkgnum;