Put each svc listing on its own line. See RT#29087.
[freeside.git] / httemplate / edit / part_virtual_field.cgi
1 <% include('/elements/header.html', "$action Virtual Field Definition") %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM ACTION="<%$p1%>process/generic.cgi" METHOD="POST">
6
7 <INPUT TYPE="hidden" NAME="table" VALUE="part_virtual_field">
8 <INPUT TYPE="hidden" NAME="redirect_ok" 
9     VALUE="<%popurl(2)%>browse/part_virtual_field.cgi">
10 <INPUT TYPE="hidden" NAME="vfieldpart" VALUE="<%
11   $vfieldpart%>">
12 Field #<B><%$vfieldpart or "(NEW)"%></B><BR><BR>
13
14 <%ntable("#cccccc",2)%>
15   <TR>
16     <TD ALIGN="right">Name</TD>
17     <TD><INPUT TYPE="text" NAME="name" MAXLENGTH=32 VALUE="<%
18     $part_virtual_field->name%>"></TD>
19   </TR>
20   <TR>
21     <TD ALIGN="right">Table</TD>
22     <TD>
23 % if ($action eq 'Add') { 
24
25       <SELECT SIZE=1 NAME="dbtable">
26 %
27 %        my $dbdef = dbdef;  # ick
28 %        #foreach my $dbtable (sort { $a cmp $b } $dbdef->tables) {
29 %        foreach my $dbtable (qw( svc_broadband router )) {
30 %          if ($dbtable !~ /^h_/
31 %          and $dbdef->table($dbtable)->primary_key) { 
32
33             <OPTION VALUE="<%$dbtable%>"><%$dbtable%></OPTION>
34 %
35 %          }
36 %        }
37 %      
38 </SELECT>
39 %
40 %    } else { # Edit
41 %    
42 <%$part_virtual_field->dbtable%>
43     <INPUT TYPE="hidden" NAME="dbtable" VALUE="<%$part_virtual_field->dbtable%>">
44 % } 
45
46     </TD>
47   <TR>
48     <TD ALIGN="right">Label</TD>
49     <TD><INPUT TYPE="text" NAME="label" MAXLENGTH="80" VALUE="<%
50     $part_virtual_field->label%>"></TD>
51   </TR>
52   <TR>
53     <TD ALIGN="right">Length</TD>
54     <TD><INPUT TYPE="text" NAME="length" MAXLENGTH=4 VALUE="<%
55     $part_virtual_field->length%>"></TD>
56   </TR>
57   <TR>
58     <TD ALIGN="right">Check</TD>
59     <TD><TEXTAREA COLS="20" ROWS="4" NAME="check_block"><%
60     $part_virtual_field->check_block%></TEXTAREA></TD>
61   </TR>
62   <TR>
63     <TD ALIGN="right">List source</TD>
64     <TD><TEXTAREA COLS="20" ROWS="4" NAME="list_source"><%
65     $part_virtual_field->list_source%></TEXTAREA></TD>
66   </TR>
67 </TABLE><BR><INPUT TYPE="submit" VALUE="Submit">
68
69 </FORM>
70
71 <BR>
72 <FONT SIZE=-2>If you don't understand what <I>check_block</I> and 
73 <I>list_source</I> mean, <B>LEAVE THEM BLANK</B>.  We mean it.</FONT>
74
75 <% include('/elements/footer.html') %>
76
77 <%init>
78
79 die "access denied"
80   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
81
82 my ($vfieldpart, $part_virtual_field);
83
84 if ( $cgi->param('error') ) {
85   $part_virtual_field = new FS::part_virtual_field ( {
86     map { $_, scalar($cgi->param($_)) } fields('part_virtual_field')});
87   $vfieldpart = $part_virtual_field->vfieldpart;
88 } else {
89   my($query) = $cgi->keywords;
90   if ( $query =~ /^(\d+)$/ ) { #editing
91     $vfieldpart=$1;
92     $part_virtual_field=qsearchs('part_virtual_field',
93         {'vfieldpart' => $vfieldpart})
94       or die "Unknown vfieldpart!";
95   
96   } else { #adding
97     $part_virtual_field = new FS::part_virtual_field({});
98   }
99 }
100 my $action = $part_virtual_field->vfieldpart ? 'Edit' : 'Add';
101
102 my $p1 = popurl(1);
103
104 </%init>