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