blob: fb10321e84ddbbe7cb85f401ea40bc490367aa80 (
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
|
<!-- mason kludge -->
<%
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);
print header("$action Virtual Field Definition", '');
print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
"</FONT>"
if $cgi->param('error');
%>
<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=15 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) {
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="20" 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><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>
</BODY>
</HTML>
|