ffce0438ffe738259e9f3fc07d4210def1e5b275
[freeside.git] / httemplate / edit / part_export.cgi
1 <!-- mason kludge -->
2 <%
3
4 #if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
5 #  $cgi->param('clone', $1);
6 #} else {
7 #  $cgi->param('clone', '');
8 #}
9 #if ( $cgi->param('svcpart') && $cgi->param('svcpart') =~ /^(\d+)$/ ) {
10 #  $cgi->param('svcpart', $1);
11 #} else {
12 #  $cgi->param('svcpart', '');
13 #}
14
15 my($query) = $cgi->keywords;
16 my $action = '';
17 my $part_export = '';
18 my $options = {};
19 if ( $cgi->param('error') ) {
20   $part_export = new FS::part_export ( {
21     map { $_, scalar($cgi->param($_)) } fields('part_export')
22   } );
23 }
24
25 warn "***$query***";
26 if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
27   $action = 'Add';
28   my $old_part_export = qsearchs('part_export', { 'exportnum' => $1 } );
29   unless ( $part_export ) {
30     ($part_export, $options) = $old_part_export->clone;
31   }
32 } elsif ( $cgi->param('new_with_svcpart') 
33           && $cgi->param('new_with_svcpart') =~ /^(\d+)$/ ) {
34   $part_export ||= new FS::part_export ( { 'svcpart' => $1 } );
35 } elsif ( $query =~ /^(\d+)$/ ) {
36   $part_export ||= qsearchs('part_export', { 'exportnum' => $1 } );
37 }
38 $action ||= $part_export->exportnum ? 'Edit' : 'Add';
39
40 my @types = qw(shell bsdshell textradius sqlradius cp);
41
42 %>
43 <%= header("$action Export", menubar(
44   'Main Menu' => popurl(2),
45 ), ' onLoad="visualize()"')
46 %>
47
48 <% if ( $cgi->param('error') ) { %>
49 <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
50 <% } %>
51
52 <FORM ACTION="<%= popurl(1) %>process/part_export.cgi" METHOD=POST>
53 <% #print '<FORM NAME="dummy">'; %>
54
55 <%= ntable("#cccccc",2) %>
56 <TR>
57   <TD ALIGN="right">Service</TD>
58   <TD BGCOLOR="#ffffff">
59     <%= $part_export->svcpart %> - <%= $part_export->part_svc->svc %>
60   </TD>
61 </TR>
62 <TR>
63   <TD ALIGN="right">Export</TD>
64   <TD><SELECT NAME="exporttype"><OPTION></OPTION>
65 <% foreach my $type ( @types ) { %>
66     <OPTION><%= $type %></OPTION>
67 <% } %>
68   </SELECT></TD>
69 </TR>
70 <TR>
71   <TD ALIGN="right">Export host</TD>
72   <TD>
73     <INPUT TYPE="text" NAME="machine" VALUE="<%= $part_export->machine %>">
74   </TD>
75 </TR>
76 </TABLE>
77 </FORM>
78 </BODY>
79 </HTML>
80