% my $agent; if ( $cgi->param('error') ) { $agent = new FS::agent ( { map { $_, scalar($cgi->param($_)) } fields('agent') } ); } elsif ( $cgi->keywords ) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; $agent = qsearchs( 'agent', { 'agentnum' => $1 } ); } else { #adding $agent = new FS::agent {}; } my $action = $agent->agentnum ? 'Edit' : 'Add'; my $hashref = $agent->hashref; print header("$action Agent", menubar( 'Main Menu' => $p, 'View all agents' => $p. 'browse/agent.cgi', )); print qq!Error: !, $cgi->param('error'), "" if $cgi->param('error'); print '