d0c87a02a75d1beb74425adc33532a60ede57113
[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 warn join('-', split(',',$cgi->param('options')));
9 my %options = map { $_=>$cgi->param($_) } split(',',$cgi->param('options'));
10
11 my $new = new FS::part_export ( {
12   map {
13     $_, scalar($cgi->param($_));
14   } fields('part_export')
15 } );
16
17 my $error;
18 if ( $exportnum ) {
19   warn $old;
20   warn $exportnum;
21   $error = $new->replace($old,\%options);
22 } else {
23   $error = $new->insert(\%options);
24 #  $exportnum = $new->exportnum;
25 }
26
27 if ( $error ) {
28   $cgi->param('error', $error );
29   print $cgi->redirect(popurl(2). "part_export.cgi?". $cgi->query_string );
30 } else {
31   print $cgi->redirect(popurl(3). "browse/part_svc.cgi");
32 }
33
34 %>