aa626b3797a869929ee1893e3c328738e7e140b2
[freeside.git] / httemplate / edit / part_device.html
1 <% include( 'elements/edit.html',
2                  'name'   => 'Phone device type',
3                  'table'  => 'part_device',
4                  'labels' => { 
5                                'devicepart' => 'Part number',
6                                'devicename' => 'Device name',
7                              },
8                  'viewall_dir' => 'browse',
9                  'html_bottom' => $html_bottom_sub,
10            )
11 %>
12 <%init>
13
14 die "access denied"
15   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
16
17 my $extra_sql =
18   join( ' OR ', map { "exporttype = '$_'" }
19                 keys %{FS::part_export::export_info('part_device')}
20       );
21 $extra_sql = $extra_sql ? " WHERE ( $extra_sql ) " : " WHERE 0 = 1 ";
22
23 my $html_bottom_sub = sub {
24   my $part_device = shift;
25
26   '<BR>'.
27   '<FONT SIZE="+1">Exports</FONT><BR>'.
28
29   '<TABLE BGCOLOR="#cccccc" WIDTH=100%>'.
30   '<TR><TD>'.
31   include( '/elements/checkboxes-table.html',
32              'source_obj'    => $part_device,
33              'link_table'    => 'export_device',
34              'target_table'  => 'part_export',
35              'extra_sql'     => $extra_sql,
36              'name_callback' => sub { my $o = shift;
37                                       $o->exporttype. ' to '. $o->machine;
38                                     },
39          ).
40   '<BR>'.
41   '</TD></TR></TABLE>';
42
43 };
44
45 </%init>
46