% 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!Error: !, $cgi->param('error'), "" if $cgi->param('error'); %>