blob: ad550cc377f1b55ed96e9196393c30b5bd60e8c9 (
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
|
%if ( $error ) {
% $cgi->param('error', $error);
<% $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ) %>
%} else {
<% $cgi->redirect(popurl(3). "browse/agent.cgi") %>
%}
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
my $agentnum = $cgi->param('agentnum');
my $old = qsearchs('agent',{'agentnum'=>$agentnum}) if $agentnum;
my $new = new FS::agent ( {
map {
$_, scalar($cgi->param($_));
} fields('agent')
} );
my $error;
if ( $agentnum ) {
$error=$new->replace($old);
} else {
$error=$new->insert;
$agentnum=$new->getfield('agentnum');
}
</%init>
|