grandstream device configuration support #4220
[freeside.git] / httemplate / edit / part_device.html
index 4f2fe93..aa626b3 100644 (file)
@@ -6,6 +6,7 @@
                                'devicename' => 'Device name',
                              },
                  'viewall_dir' => 'browse',
+                 'html_bottom' => $html_bottom_sub,
            )
 %>
 <%init>
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
 
+my $extra_sql =
+  join( ' OR ', map { "exporttype = '$_'" }
+                keys %{FS::part_export::export_info('part_device')}
+      );
+$extra_sql = $extra_sql ? " WHERE ( $extra_sql ) " : " WHERE 0 = 1 ";
+
+my $html_bottom_sub = sub {
+  my $part_device = shift;
+
+  '<BR>'.
+  '<FONT SIZE="+1">Exports</FONT><BR>'.
+
+  '<TABLE BGCOLOR="#cccccc" WIDTH=100%>'.
+  '<TR><TD>'.
+  include( '/elements/checkboxes-table.html',
+             'source_obj'    => $part_device,
+             'link_table'    => 'export_device',
+             'target_table'  => 'part_export',
+             'extra_sql'     => $extra_sql,
+             'name_callback' => sub { my $o = shift;
+                                      $o->exporttype. ' to '. $o->machine;
+                                    },
+         ).
+  '<BR>'.
+  '</TD></TR></TABLE>';
+
+};
+
 </%init>
+