more for the new world of export...
[freeside.git] / httemplate / edit / process / part_export.cgi
1 <%
2
3 my $exportnum = $cgi->param('exportnum');
4
5 my $old = qsearchs('part_export', { 'exportnum'=>$exportnum } ) if $exportnum;
6
7 #fixup options
8 my %options = map { $_=>$cgi->param($_) } $cgi->param('options');
9
10 my $new = new FS::part_export ( {
11   map {
12     $_, scalar($cgi->param($_));
13   } fields('part_export')
14 } );
15
16 local $SIG{HUP} = 'IGNORE';
17 local $SIG{INT} = 'IGNORE';
18 local $SIG{QUIT} = 'IGNORE';
19 local $SIG{TERM} = 'IGNORE';
20 local $SIG{TSTP} = 'IGNORE';
21 local $SIG{PIPE} = 'IGNORE';
22
23 local $FS::UID::AutoCommit = 0;
24
25 my $error;
26 if ( $exportnum ) {
27   $error = $new->replace($old,\%options);
28 } else {
29   $error = $new->insert,\%options);
30 #  $exportnum = $new->exportnum;
31 }
32
33 if ( $error ) {
34   $cgi->param('error', $error );
35   print $cgi->redirect(popurl(2). "part_export.cgi?". $cgi->query_string );
36 } else {
37   print $cgi->redirect(popurl(3). "browse/part_svc.cgi");
38 }
39
40 %>