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

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

my $new = new FS::part_referral ( {
  map {
    $_, scalar($cgi->param($_));
  } fields('part_referral')
} );

my $error;
if ( $refnum ) {
  my $old = qsearchs( 'part_referral', { 'refnum' =>$ refnum } );
  die "(Old) Record not found!" unless $old;
  $error = $new->replace($old);
} else {
  $error = $new->insert;
}
$refnum=$new->refnum;

if ( $error ) {
  $cgi->param('error', $error);
  print $cgi->redirect(popurl(2). "part_referral.cgi?". $cgi->query_string );
} else {
  print $cgi->redirect(popurl(3). "browse/part_referral.cgi");
}

%>