summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/part_svc.cgi
blob: 4c972e4d7c4283d6160637c972bce45c5bd54e67 (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
<%

my $svcpart = $cgi->param('svcpart');

my $old = qsearchs('part_svc',{'svcpart'=>$svcpart}) if $svcpart;

my $new = new FS::part_svc ( {
  map {
    $_, scalar($cgi->param($_));
#  } qw(svcpart svc svcdb)
  } fields('part_svc')
} );

my $error;
if ( $svcpart ) {
  $error = $new->replace($old);
} else {
  $error = $new->insert;
  $svcpart=$new->getfield('svcpart');
}

if ( $error ) {
  $cgi->param('error', $error);
  $Response->Redirect(popurl(2). "part_svc.cgi?". $cgi->query_string );
} else {
  warn "redirecting to ". popurl(3)."browse/part_svc.cgi via $Response";
  $Response->Redirect(popurl(3)."browse/part_svc.cgi");
}

%>